[Csnd] Assigning bands to bins
| Date | 2018-11-08 12:58 |
| From | Syl Morrison |
| Subject | [Csnd] Assigning bands to bins |
Hi all, working on a plugin in Cabbage, where I'd like to make the bandwidths for low, mid and high variable so the ranges would be low = 20 to band_1, mid = band_1 to band_2 and high = band_2 to 20000. I'm using pvsanal for my signals, so using the fft, and lets say my fft is 512 bins. I'd like to make sliders for the user to set band_1 and band_2, but it'd be more intuitive for the user to set a frequency and for it to work out what bin corresponds to that frequency rather than having the user just enter the range in bins. Sorry if this is a bit of a dumb question, my brain is melting a wee bit, but could someone give me a bit of a hand with figuring out what bin I need to access for a given frequency?
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
|
| Date | 2018-11-08 15:34 |
| From | Oeyvind Brandtsegg |
| Subject | Re: [Csnd] Assigning bands to bins |
Hi, With an fft size of 1024, you will get 513 bins. These are linearly distributed between zero and the Nyquist frequency, inclusive. The frequency in each bin thus relates to the sampling frequency. With an sr of 48 kHz, you will have one bin for every (24000/512) Hz, starting at zero. So approximately 46 Hz between each bin. With pvs you can get some deviation from these center frequencies, as it is able to better track the partials in each bin. Still, I think it should work well enough to determine frequency bands for the filter you outline above. best Oeyvind Den tor. 8. nov. 2018 kl. 13:58 skrev Syl Morrison <honoonu@gmail.com>:
Oeyvind Brandtsegg Professor of Music Technology NTNU 7491 Trondheim Norway Cell: +47 92 203 205 http://www.partikkelaudio.com/ http://crossadaptive.hf.ntnu.no http://gdsp.hf.ntnu.no/ http://soundcloud.com/brandtsegg http://flyndresang.no/ http://soundcloud.com/t-emp |
| Date | 2018-11-08 17:34 |
| From | Syl Morrison |
| Subject | Re: [Csnd] Assigning bands to bins |
Thank you so much mate, helps a ton! On Thu, Nov 8, 2018 at 3:34 PM Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
|