Question

If I call the read() method, as

record.read(lin, 0, R_fft);  

where lin is a short array of size 256 and R_fft is 8, in what order does the read() function store the audio samples from MIC in? For instanc, is it

lin[0] -> oldest sample  
.  
.  
lin[8] -> newest sample  

or is it the other way round, that is

lin[0] -> newest sample  
.  
.  
lin[8] -> oldest sample  

or do the samples go towards the higher end of the lin[] array, that is towards, lin[248] to lin[255]?

Was it helpful?

Solution

The second argument to read() is an offset that specifies where in the array you want the samples to be stored. Since you're passing 0 you'll get the samples at the beginning of the array (i.e. at lin[0..7]).

The oldest sample will be stored at the lowest address (lin[0]), and the latest sample at the highest address (lin[7]).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top