Csound Csound-dev Csound-tekno Search About

[Csnd] fft EQ design: linear vs. logarithmic

Date2009-04-04 17:57
Frompeiman khosravi
Subject[Csnd] fft EQ design: linear vs. logarithmic
Hello,

I am trying to create a multi-band EQ using pvsfilter. So far I am
dynamically writing into a table which pvsilter uses to multiply my
input sound. It sounds fine but I am wondering if it is possible to
convert from logarithmic values into the linear fft table. How is it
possible to break a table consisting of say 1024+1 values (each
representing one fft bin) into 32 bands logarithmically distributed
(so each band is an octave or whatever, I think the standard is 1.3
oct)? At the moment I am linearly dividing the 1024+1 values...

Many thanks
Peiman

Date2009-04-04 23:32
FromTim Mortimer
Subject[Csnd] Re: fft EQ design: linear vs. logarithmic
heres how i do it

convert the freq value of each bin to a float representing a "midi note
value" between 0 & the sample rate. 

so for example, i think 48k (being 24k cutoff) peaks at a (theoretical)
"midi note" value of around 139 or so...

then write a short python script to assign a "group id" to each bin (if it
falls within the requisite range)

i usually just save these type of "group assign masks" as .txt files & load
them with gen23

then apply this "channel group" attenuation to each bin using pvs table read
/ write combo

so your "group mask" ends up being skewed along the lines of

0 1 2 2 3 3 3 4 4 4 4 4 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 [ad lib
example]

& dont forget to convert the attenuation scale to dB rather than amplitude
while your at it ; )

sorry no example - its on my other pc but i know your well on top of fft
stuff so im sure you'll work the solution


peiman wrote:
> 
> Hello,
> 
> I am trying to create a multi-band EQ using pvsfilter. So far I am
> dynamically writing into a table which pvsilter uses to multiply my
> input sound. It sounds fine but I am wondering if it is possible to
> convert from logarithmic values into the linear fft table. How is it
> possible to break a table consisting of say 1024+1 values (each
> representing one fft bin) into 32 bands logarithmically distributed
> (so each band is an octave or whatever, I think the standard is 1.3
> oct)? At the moment I am linearly dividing the 1024+1 values...
> 
> Many thanks
> Peiman
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
> 
> 


-----
http://www.phasetransitions.net
http://www.facebook.com/pages/hermetic-music/38525750672
http://www.myspace.com/hermeticmusic


-- 
View this message in context: http://www.nabble.com/fft-EQ-design%3A-linear-vs.-logarithmic-tp22885534p22888506.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2009-04-04 23:38
FromAndres Cabrera
Subject[Csnd] Re: fft EQ design: linear vs. logarithmic
Hi,

I understand that its a characteristic the fft to produce linear
frequency bins. You would need something like the wavelet transform
instead of fft.
You can do some conversions to logarithmic, but the bins themselves
cannot change.

Cheers,
Andrés

On Sat, Apr 4, 2009 at 11:57 AM, peiman khosravi
 wrote:
> Hello,
>
> I am trying to create a multi-band EQ using pvsfilter. So far I am
> dynamically writing into a table which pvsilter uses to multiply my
> input sound. It sounds fine but I am wondering if it is possible to
> convert from logarithmic values into the linear fft table. How is it
> possible to break a table consisting of say 1024+1 values (each
> representing one fft bin) into 32 bands logarithmically distributed
> (so each band is an octave or whatever, I think the standard is 1.3
> oct)? At the moment I am linearly dividing the 1024+1 values...
>
> Many thanks
> Peiman
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>



-- 


Andrés


Date2009-04-05 11:18
Frompeiman khosravi
Subject[Csnd] Re: Re: fft EQ design: linear vs. logarithmic
Thank you both for the replies. Tim, I think your answer has clarified
things so I am going to try that now. Andrés, I understood that it is
possible with wavelet but is that available in csound? I am basically
attempting to do a conversion back and forth using fft at the moment
as Tim mentioned.

I think an opcode is called for here though!

Best
Peiman

2009/4/4 Andres Cabrera :
> Hi,
>
> I understand that its a characteristic the fft to produce linear
> frequency bins. You would need something like the wavelet transform
> instead of fft.
> You can do some conversions to logarithmic, but the bins themselves
> cannot change.
>
> Cheers,
> Andrés
>
> On Sat, Apr 4, 2009 at 11:57 AM, peiman khosravi
>  wrote:
>> Hello,
>>
>> I am trying to create a multi-band EQ using pvsfilter. So far I am
>> dynamically writing into a table which pvsilter uses to multiply my
>> input sound. It sounds fine but I am wondering if it is possible to
>> convert from logarithmic values into the linear fft table. How is it
>> possible to break a table consisting of say 1024+1 values (each
>> representing one fft bin) into 32 bands logarithmically distributed
>> (so each band is an octave or whatever, I think the standard is 1.3
>> oct)? At the moment I am linearly dividing the 1024+1 values...
>>
>> Many thanks
>> Peiman
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>
>
>
>
> --
>
>
> Andrés
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2009-04-05 11:57
Frompeiman khosravi
Subject[Csnd] Re: Re: fft EQ design: linear vs. logarithmic
Been doing a little calculation. With an FFT size of 2048 you would
get 1024 useful bins representing the frequency range of 0 - sr/2. So
with a sample rate of 44100:

(44100/2)/(2048/2)=21.53

So each fft bin has a frequency range of about 21.53 Hz. We might as
well round this up to 22 or 21.

Does this make sense? How I wish I hadn't slept through all those math
lessons at school!

Peiman

2009/4/5 peiman khosravi :
> Thank you both for the replies. Tim, I think your answer has clarified
> things so I am going to try that now. Andrés, I understood that it is
> possible with wavelet but is that available in csound? I am basically
> attempting to do a conversion back and forth using fft at the moment
> as Tim mentioned.
>
> I think an opcode is called for here though!
>
> Best
> Peiman
>
> 2009/4/4 Andres Cabrera :
>> Hi,
>>
>> I understand that its a characteristic the fft to produce linear
>> frequency bins. You would need something like the wavelet transform
>> instead of fft.
>> You can do some conversions to logarithmic, but the bins themselves
>> cannot change.
>>
>> Cheers,
>> Andrés
>>
>> On Sat, Apr 4, 2009 at 11:57 AM, peiman khosravi
>>  wrote:
>>> Hello,
>>>
>>> I am trying to create a multi-band EQ using pvsfilter. So far I am
>>> dynamically writing into a table which pvsilter uses to multiply my
>>> input sound. It sounds fine but I am wondering if it is possible to
>>> convert from logarithmic values into the linear fft table. How is it
>>> possible to break a table consisting of say 1024+1 values (each
>>> representing one fft bin) into 32 bands logarithmically distributed
>>> (so each band is an octave or whatever, I think the standard is 1.3
>>> oct)? At the moment I am linearly dividing the 1024+1 values...
>>>
>>> Many thanks
>>> Peiman
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>
>>
>>
>>
>> --
>>
>>
>> Andrés
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>