Generating (time, amplitude) data table using sound samples

How do I return the points of every _n_th 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 _n_th” is 1.

See the below picture for clarification:




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

a * sin(bx + c) + d

for a selection of sound samples?

Thanks!

How about “Sample Data Export”?
http://manual.audacityteam.org/o/man/sample_data_export.html

Since you want only each nth sample, you could preprocess the audio.

  1. open the nyquist prompt

(snd-avg s 1 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

```text
old sample rate / nth sample

The code is meant to work with mono tracks, don’t enter < and >, just the number.