Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Although this thread is years old, I found it very helpful. I just wanted to give my input to anyone who finds this and are trying to create something similar.</p> <p>As for the division into bars this should not be done as antti suggest, by dividing the data equally based on the number of bars. The most useful would be to divide the data into octave parts, each octave being double the frequency of the previous. (ie. 100hz is one octave above 50hz, which is one octave above 25hz). </p> <p>Depending on how many bars you want, you divide the whole range into 1/X octave ranges. Based on a given center frequency of A on the bar, you get the upper and lower limits of the bar from:</p> <pre><code>upper limit = A * 2 ^ ( 1 / 2X ) lower limit = A / 2 ^ ( 1 / 2X ) </code></pre> <p>To calculate the next adjoining center frequency you use a similar calculation:</p> <pre><code>next lower = A / 2 ^ ( 1 / X ) next higher = A * 2 ^ ( 1 / X ) </code></pre> <p>You then average the data that fits into these ranges to get the amplitude for each bar.</p> <p>For example: We want to divide into 1/3 octaves ranges and we start with a center frequency of 1khz.</p> <pre><code>Upper limit = 1000 * 2 ^ ( 1 / ( 2 * 3 ) ) = 1122.5 Lower limit = 1000 / 2 ^ ( 1 / ( 2 * 3 ) ) = 890.9 </code></pre> <p>Given 44100hz and 1024 samples (43hz between each data point) we should average out values 21 through 26. ( 890.9 / 43 = 20.72 ~ 21 and 1122.5 / 43 = 26.10 ~ 26 )</p> <p>(1/3 octave bars would get you around 30 bars between ~40hz and ~20khz). As you can figure out by now, as we go higher we will average a larger range of numbers. Low bars typically only include 1 or a small number of data points. While the higher bars can be the average of hundreds of points. The reason being that 86hz is an octave above 43hz... while 10086hz sounds almost the same as 10043hz.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload