Page 1 of 1

Generating (time, amplitude) data table using sound samples

Posted: Tue Jan 06, 2015 1:17 am
by princee
   
How do I return the points of every nth sample in a .wav file?

I want to export the amplitude of each sample with respect to time into a file.
Note that my sound files are only 1 second long, so I don't think the data processing will be too difficult. Thus, I think that the n in "every nth" is 1.

See the below picture for clarification:
Image


Also, if possible, how can I create a best fit curve — preferably in the form

Code: Select all

a * sin(bx + c) + d
for a selection of sound samples?

Thanks!

Re: Generating (time, amplitude) data table using sound samp

Posted: Tue Jan 06, 2015 1:39 am
by steve

Re: Generating (time, amplitude) data table using sound samp

Posted: Tue Jan 06, 2015 5:32 am
by Robert J. H.
steve wrote:How about "Sample Data Export"?
http://manual.audacityteam.org/o/man/sa ... xport.html
Since you want only each nth sample, you could preprocess the audio.
  1. open the nyquist prompt
  2. Code: Select all

    (snd-avg s 1 <nth sample> op-average)
    --> OK
  3. Change the sample rate in the track dropdown menu (Set Rate --> Other)
The last point is optional but it assures the right time indexing.
The new sample rate is

Code: Select all

old sample rate / nth sample
The code is meant to work with mono tracks, don't enter < and >, just the number.