iTunes Visualizer Spectrum - What does it mean?

SaintTheo's picture

So the iTunes audio spectrum input is a structure consisting of 16 values. What exactly do these values represent? Do the values correspond to different frequencies, and if so, which frequencies do these values represent?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cwright's picture
Re: iTunes Visualizer Spectrum - What does it mean?

each is a different bucket of frequencies. which ones exactly are undefined.

SaintTheo's picture
Re: iTunes Visualizer Spectrum - What does it mean?

I ran an assortment of square waves at different frequencies through it; below around 128 Hz (I think) it showed up oddly (all the values were oscillating between 2 large values), and for higher frequencies one level would have a greater value than the others at each frequency.

SaintTheo's picture
Re: iTunes Visualizer Spectrum - What does it mean?

I figured it out. iTunes creates a spectrum of 256 samples, ranging (for me) from 22050/256 to 22050 Hz in a linear fashion (~86 Hertz). The spectrum passed to Quartz Composer uses 16 different averages of these 256 samples. These are averaged by the following formula:

(Frequency = iTunes*22050/256 Hz)

QC - iTunes - # of Samples

0 - [1,3] - 3

1 - [4,6] - 3

2 - [7,9] - 3

3 - [10,12] - 3

4 - [13,20] - 8

5 - [21,28] - 8

6 - [36,29] - 8

7 - [37,48] - 12

8 - [49,60] - 12

9 - [61,72] - 12

10 - [73,88] - 16

11 - [89,104] - 16

12 - [105,128] - 24

13 - [129,152] - 24

14 - [153,184] - 32

15 - [185,256] - 72

I first figured this out when I created a sine wave at 11025 Hz (1/2 my maximum), and only index 12 in iTunes responded (with every other index equal to zero, which has never happened to me before). Then, after creating several (~100) more samples, I got a general idea of where certain frequencies were being stored. I narrowed them down to intervals of ~86 or 22050/256 Hertz.