File: notch_iir_1894.xml

package info (click to toggle)
swh-plugins 0.4.17-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,264 kB
  • sloc: ansic: 23,551; xml: 12,633; perl: 1,114; sh: 964; makefile: 218
file content (88 lines) | stat: -rw-r--r-- 3,911 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?xml version="1.0" ?>
<!DOCTYPE ladspa SYSTEM "ladspa-swh.dtd">
<?xml-stylesheet href="ladspa.css" type="text/css" ?>
<ladspa>
	<global>
		<meta name="maker" value="Alexander Ehlert &lt;mag@glame.de&gt;"/>
		<meta name="copyright" value="GPL"/>
		<meta name="properties" value="HARD_RT_CAPABLE"/>
		<code>
			#include "config.h"
			#include "util/iir.h"
                        
		</code>
	</global>

	<plugin label="notch_iir" id="1894" class="NotchPlugin">
		<name>Mag's Notch Filter</name>
                <p> IIR notch filter based using chebishev coefficients. The filter allows you to tweak the number of stages used for
                filtering. Every stage adds two more poles, which leads to a steeper dropoff. More stages need more CPU power.
                </p>

                <callback event="instantiate">
                  sample_rate = s_rate;
		  ufc = lfc = 0.0f;
                </callback>
		<callback event="run">
                  ufc = (center - width*0.5f)/(float)sample_rate;
                  lfc = (center + width*0.5f)/(float)sample_rate;
                  chebyshev(iirf1, first,  2*CLAMP((int)stages,1,10), IIR_STAGE_LOWPASS,  ufc, 0.5f);
                  chebyshev(iirf2, second, 2*CLAMP((int)stages,1,10), IIR_STAGE_HIGHPASS, lfc, 0.5f);
                  iir_process_buffer_ns_5(iirf1, first, input, output, sample_count, RUN_ADDING);
                  iir_process_buffer_ns_5(iirf2, second, input, output, sample_count, 1); /* add to first buffer */

                  // Unused variable
                  (void)(run_adding_gain);
                </callback>

                <callback event="activate">                  
                  ufc = (*(plugin_data->center) - *(plugin_data->width)*0.5f)/(float)sample_rate;
                  lfc = (*(plugin_data->center) + *(plugin_data->width)*0.5f)/(float)sample_rate;
                  first = init_iir_stage(IIR_STAGE_LOWPASS,10,3,2);
                  second = init_iir_stage(IIR_STAGE_HIGHPASS,10,3,2);                  
                  iirf1 = init_iirf_t(first);
                  iirf2 = init_iirf_t(second);
                  chebyshev(iirf1, first, 2*CLAMP((int)(*(plugin_data->stages)),1,10), IIR_STAGE_LOWPASS, ufc, 0.5f);
                  chebyshev(iirf2, second, 2*CLAMP((int)(*(plugin_data->stages)),1,10), IIR_STAGE_HIGHPASS, lfc, 0.5f);
                </callback>

                <callback event="cleanup">
                  free_iirf_t(plugin_data->iirf1, plugin_data->first);
                  free_iirf_t(plugin_data->iirf2, plugin_data->second);
                  free_iir_stage(plugin_data->first);
                  free_iir_stage(plugin_data->second);
                </callback>

                <port label="center" dir="input" type="control" hint="default_middle, sample_rate, logarithmic">
			<name>Center Frequency (Hz)</name>
 			<range min="0.0001" max="0.45"/>
		</port>

                <port label="width" dir="input" type="control" hint="default_middle, sample_rate, logarithmic">
			<name>Bandwidth (Hz)</name>
 			<range min="0.0001" max="0.45"/>
		</port>

                <port label="stages" dir="input" type="control" hint="default_1, integer">
			<name>Stages(2 poles per stage)</name>
			<range min="1.0" max="10.0"/>
		</port>

		<port label="input" dir="input" type="audio">
			<name>Input</name>
		</port>

		<port label="output" dir="output" type="audio">
			<name>Output</name>
		</port>
            
                <instance-data label="iirf1" type="iirf_t*"/>
                <instance-data label="iirf2" type="iirf_t*"/>
                <instance-data label="first" type="iir_stage_t*"/>
                <instance-data label="second" type="iir_stage_t*"/>
                <instance-data label="sample_rate" type="long"/>
                <instance-data label="ufc" type="float"/>
                <instance-data label="lfc" type="float"/>        

	</plugin>
</ladspa>