/usr/lib/lv2/mbeq-swh.lv2/plugin.ttl is in swh-lv2 1.0.16+git20160519~repack0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | @prefix : <http://lv2plug.in/ns/lv2core#> .
@prefix swh: <http://plugin.org.uk/swh-plugins/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix swhext: <http://plugin.org.uk/extensions#> .
@prefix pg: <http://lv2plug.in/ns/ext/port-groups#> .
@prefix pprops: <http://lv2plug.in/ns/ext/port-props#> .
swh:mbeq a :Plugin ;
a :MultiEQPlugin ;
doap:name "Multiband EQ" ;
doap:maintainer [
foaf:name "Steve Harris";
foaf:homepage <http://plugin.org.uk/> ;
foaf:mbox <mailto:steve@plugin.org.uk> ;
] ;
doap:license <http://usefulinc.com/doap/licenses/gpl> ;
:documentation <http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html#mbeq> ;
:pluginProperty :hardRtCapable ;
:port [
a :InputPort, :ControlPort ;
:name "50Hz gain (low shelving)" ;
:index 0 ;
:symbol "band_1" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "100Hz gain" ;
:index 1 ;
:symbol "band_2" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "156Hz gain" ;
:index 2 ;
:symbol "band_3" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "220Hz gain" ;
:index 3 ;
:symbol "band_4" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "311Hz gain" ;
:index 4 ;
:symbol "band_5" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "440Hz gain" ;
:index 5 ;
:symbol "band_6" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "622Hz gain" ;
:index 6 ;
:symbol "band_7" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "880Hz gain" ;
:index 7 ;
:symbol "band_8" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "1250Hz gain" ;
:index 8 ;
:symbol "band_9" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "1750Hz gain" ;
:index 9 ;
:symbol "band_10" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "2500Hz gain" ;
:index 10 ;
:symbol "band_11" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "3500Hz gain" ;
:index 11 ;
:symbol "band_12" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "5000Hz gain" ;
:index 12 ;
:symbol "band_13" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "10000Hz gain" ;
:index 13 ;
:symbol "band_14" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "20000Hz gain" ;
:index 14 ;
:symbol "band_15" ;
:minimum -70 ;
:maximum +30 ;
:default 0.0 ;
] ;
:port [
a :InputPort, :AudioPort ;
:name "Input" ;
:index 15 ;
:symbol "input" ;
] ;
:port [
a :OutputPort, :AudioPort ;
:name "Output" ;
:index 16 ;
:symbol "output" ;
] ;
:port [
a :OutputPort, :ControlPort ;
:name "latency" ;
:index 17 ;
:symbol "latency" ;
:portProperty :reportsLatency ;
] ;
swhext:code """
#include <string.h>
#include <fftw3.h>
typedef fftwf_plan fft_plan;
typedef float fftw_real;
#include "ladspa-util.h"
#define FFT_LENGTH 1024
#define OVER_SAMP 4
#define BANDS 15
float bands[BANDS] =
{ 50.00f, 100.00f, 155.56f, 220.00f, 311.13f,
440.00f, 622.25f, 880.00f, 1244.51f, 1760.00f, 2489.02f,
3519.95, 4978.04f, 9956.08f, 19912.16f };
""" ;
swhext:callback [
swhext:event "instantiate" ;
swhext:code """
int i, bin;
float last_bin, next_bin;
float db;
float hz_per_bin = (float)s_rate / (float)FFT_LENGTH;
in_fifo = calloc(FFT_LENGTH, sizeof(LADSPA_Data));
out_fifo = calloc(FFT_LENGTH, sizeof(LADSPA_Data));
out_accum = calloc(FFT_LENGTH * 2, sizeof(LADSPA_Data));
real = calloc(FFT_LENGTH, sizeof(fftw_real));
comp = calloc(FFT_LENGTH, sizeof(fftw_real));
window = calloc(FFT_LENGTH, sizeof(float));
bin_base = calloc(FFT_LENGTH/2, sizeof(int));
bin_delta = calloc(FFT_LENGTH/2, sizeof(float));
fifo_pos = 0;
plan_rc = fftwf_plan_r2r_1d(FFT_LENGTH, real, comp, FFTW_R2HC, FFTW_MEASURE);
plan_cr = fftwf_plan_r2r_1d(FFT_LENGTH, comp, real, FFTW_HC2R, FFTW_MEASURE);
// Create raised cosine window table
for (i=0; i < FFT_LENGTH; i++) {
window[i] = -0.5f*cos(2.0f*M_PI*(double)i/(double)FFT_LENGTH)+0.5f;
window[i] *= 2.0f;
}
// Create db->coeffiecnt lookup table
db_table = malloc(1000 * sizeof(float));
for (i=0; i < 1000; i++) {
db = ((float)i/10) - 70;
db_table[i] = pow(10.0f, db/20.0f);
}
// Create FFT bin -> band + delta tables
bin = 0;
while (bin <= bands[0]/hz_per_bin) {
bin_base[bin] = 0;
bin_delta[bin++] = 0.0f;
}
for (i = 1; i < BANDS-1 && bin < (FFT_LENGTH/2)-1 && bands[i+1] < s_rate/2; i++) {
last_bin = bin;
next_bin = (bands[i+1])/hz_per_bin;
while (bin <= next_bin) {
bin_base[bin] = i;
bin_delta[bin] = (float)(bin - last_bin) / (float)(next_bin - last_bin);
bin++;
}
}
for (; bin < (FFT_LENGTH/2); bin++) {
bin_base[bin] = BANDS-1;
bin_delta[bin] = 0.0f;
}
""" ;
] ;
swhext:callback [
swhext:event "activate" ;
swhext:code """
fifo_pos = 0;
""" ;
] ;
swhext:callback [
swhext:event "cleanup" ;
swhext:code """
fftwf_destroy_plan(plugin_data->plan_rc);
fftwf_destroy_plan(plugin_data->plan_cr);
free(plugin_data->in_fifo);
free(plugin_data->out_fifo);
free(plugin_data->out_accum);
free(plugin_data->real);
free(plugin_data->comp);
free(plugin_data->window);
free(plugin_data->bin_base);
free(plugin_data->bin_delta);
free(plugin_data->db_table);
""" ;
] ;
swhext:callback [
swhext:event "run" ;
swhext:code """
int i, bin, gain_idx;
float gains[BANDS + 1] =
{ band_1, band_2, band_3, band_4, band_5, band_6, band_7, band_8, band_9,
band_10, band_11, band_12, band_13, band_14, band_15, 0.0f };
float coefs[FFT_LENGTH / 2];
unsigned long pos;
int step_size = FFT_LENGTH / OVER_SAMP;
int fft_latency = FFT_LENGTH - step_size;
// Convert gains from dB to co-efficents
for (i = 0; i < BANDS; i++) {
gain_idx = (int)((gains[i] * 10) + 700);
gains[i] = db_table[LIMIT(gain_idx, 0, 999)];
}
// Calculate coefficients for each bin of FFT
coefs[0] = 0.0f;
coefs[FFT_LENGTH/2-1] = 0.0f;
for (bin=1; bin < (FFT_LENGTH/2-1); bin++) {
coefs[bin] = ((1.0f-bin_delta[bin]) * gains[bin_base[bin]])
+ (bin_delta[bin] * gains[bin_base[bin]+1]);
}
if (fifo_pos == 0) {
fifo_pos = fft_latency;
}
for (pos = 0; pos < sample_count; pos++) {
in_fifo[fifo_pos] = input[pos];
buffer_write(output[pos], out_fifo[fifo_pos-fft_latency]);
fifo_pos++;
// If the FIFO is full
if (fifo_pos >= FFT_LENGTH) {
fifo_pos = fft_latency;
// Window input FIFO
for (i=0; i < FFT_LENGTH; i++) {
real[i] = in_fifo[i] * window[i];
}
// Run the real->complex transform
fftwf_execute(plan_rc);
// Multiply the bins magnitudes by the coeficients
comp[0] *= coefs[0];
for (i = 1; i < FFT_LENGTH/2; i++) {
comp[i] *= coefs[i];
comp[FFT_LENGTH-i] *= coefs[i];
}
// Run the complex->real transform
fftwf_execute(plan_cr);
// Window into the output accumulator
for (i = 0; i < FFT_LENGTH; i++) {
out_accum[i] += 0.9186162f * window[i] * real[i]/(FFT_LENGTH * OVER_SAMP);
}
for (i = 0; i < step_size; i++) {
out_fifo[i] = out_accum[i];
}
// Shift output accumulator
memmove(out_accum, out_accum + step_size, FFT_LENGTH*sizeof(LADSPA_Data));
// Shift input fifo
for (i = 0; i < fft_latency; i++) {
in_fifo[i] = in_fifo[i+step_size];
}
}
}
// Store the fifo_position
plugin_data->fifo_pos = fifo_pos;
*(plugin_data->latency) = fft_latency;
""" ;
] ;
swhext:createdBy <http://plugin.org.uk/swh-plugins/toTurtle.xsl> .
|