Dividing Audio

I'm trying to divide an audio sample into 16 equal "slices". I currently use the sum 1 / s. Using my row of 16 buttons (GUI) and printing to the console from left to right the result is: inf, 1, 0.5, 0.33, 0.2, ect. I'm trying to have something starting from 0 this being the beginning of the sample on the furthest left button until the 16th button plays the last even division of the audio? Would anyone understand the maths to this?
what is 1/s?
are you trying to divide it into 16 parts of equal TIME duration, or are you trying to split into some sort of frequency channels, like an FFT?
16 parts of equal Time duration. s (sample) needs to be 16 equal durations scaled to 0 - 1
I think the answer may be sample * 0.0625. 0.0625 is 1/16th of 1.
This isn't code, just an idea of the maths
totalsamples =  ? ; //  you provide the size of entire audio  

slice = totalsamples / 16

// slice 1 
    start  = 0 * slice 
    finish = start + slice

// slice 2 
    start  = 1 * slice 
    finish = start + slice

// slice 3 
    start  = 2 * slice 
    finish = start + slice

... 


// slice 16 
    start  = 15 * slice 
    finish = start + slice


The labels would be something like
 1/16, 2/16, 3/16 ... 15/16, 16/16
Last edited on
Topic archived. No new replies allowed.