Archive: Frequency


24th April 2004 01:45 UTC

Frequency
I am very new to AVS. Please excuse my questions if they seem simple, pointless or stupid. That aside I am curious if one is able to detect the specific frequencies in the song? My plan is to do beat detection. However from what I have read in the forums they are not tailored to what I would like. I want the avs to bump to the frequencies a subwhoofer would move to. This would be 25-100 hz for me. Can somebody help or give me a place to find what I am looking for? Thank you in advance.

Jon


24th April 2004 01:58 UTC

getspec(band,width,channel) and getosc(band,width,channel)
band and width are 0 to 1, channel is 0- center, 1- left, 2- right


24th April 2004 02:35 UTC

m²k: that won't help one bit, if you don't know the spectrum and frame size.

To figure out framesize, use a superscope like this:
x=i*2-1;y=getspec(i/576*3,0,0)

The framesize is 576, so a width (relative to 0..1) of 3/576 gives you 3 samples in the spectrum plot.
As far as I know, framesize is independent on sampling rate.

The highest frequency in the spectrum plot is the nyquist frequency, which is half your sampling rate. Most commonly the sampling rate is 44kHz, so the nyquist frequency is 22kHz.

The lowest sample in the frequency component is the DC/0 Hz component. The second sample is 22 kHz / 576 = 38.2 Hz.

The frequency scales up linearly, where frequency = (zero-based index) * 22 kHz / 576:

So getspec(x,0,0), where x is:
0/576 -> 0 Hz/DC
1/576 -> 38.19 Hz
2/576 -> 76.39 Hz
3/576 -> 114.6 Hz
...
574/576 -> 21.92 kHz
575/576 -> 21.96 kHz
576/576 -> 22 kHz

The frequency samples are discrete (as the superscope to discover framesize showed). To figure out in betweens, you would need to convolve the spectrum as dirac impulses, with sin(x****964; )/(x****964; ) where 2***960;/***964; = frequency spacing.

However, you might get away with just linear interpolation though.

For MP3s with other sampling rates, the frequencies are different. As far as I know you can't access the sampling rate from AVS, but 99% of all MP3s are sampled at 44kHz anyway. Maybe you'll find some at 48kHz, but then the frequency shift is minimal.


24th April 2004 03:04 UTC

Unconed:It's likely the n00b will get much more out of that than he would out of m²k's post. It's ummmm..., rather technical.


24th April 2004 03:17 UTC

Nice post UnConeD
:D

You know way to many things for your own good...


24th April 2004 04:30 UTC

That helps a lot. I will have to learn some of the things you talk about but I get the jist of it. Just out of curiousity. Everything I listen to is wav files. So would the sampling be 48.1khz and the nyquist be 24.05kz? And if you guys could give me a link to a good site to learn more that would be great. Maybe like a tutorial? Thanks so much.


24th April 2004 05:09 UTC

I have a question: If my getspec was around 100/222 then what's frequency I will get?

I experienced this question many times, But, I did not get my favorite answer.
If UnConeD knows please tell me.


24th April 2004 05:37 UTC

WAV files? o_O big files :D
on what do you need a tutorial?

To use what unconed just explained:
value=getspec(Hz/nyquist,0,channel);
or
value=getspec(Hz/sampling*2,0,channel);

where channel is 0 for center, 1 for left and 2 for right channel


24th April 2004 08:17 UTC

DynamicMovement: use your brain for 5 seconds and you should be able to figure it out with what I said.


24th April 2004 10:52 UTC

For some good Tutorials search the forums for Atero's Primer and PiR's AVS tutorial. There's some good stuff on visbot as well. I'm still working on my own tutorials which will eventually come on www.iabvisuals.tk .


8th June 2004 20:41 UTC

Originally posted by DynamicMovement
I have a question: If my getspec was around 100/222 then what's frequency I will get?
I thing it will be 9909,909... Hz.

100/220*22khz=9909,909... Hz
or
100*22Khz/220=9909,909... Hz
;)

I hope I am right:confused:

8th June 2004 21:54 UTC

Please don't revive dead threads with useless information.
It is most likely the guy doesn't even read these threads anymore since these are his only two posts over the entire WA forum.