[?] Play back an imported audio file using ListPlay?

Dear all,

I am a complete beginner at Mathematica in general, and at using it to try to investigate sounds in particular. I have done the following thing: Imported a short sample of spoken text using Import. I then looked at the plot of this imported object, using AudioPlot. The signal looks to be the same as how it was when I had the file open in another program (audacity).

Then I used AudioData to extract a sample from the imported file. At this point I am confused as to what AudioData is actually doing, because when I then use ListPlot to visualize the extracted data, it had quite clearly been clipped. Then when I tried playing back the data using ListPlay, it has transformed a sample that is 9 seconds long into a load of unintelligible nonsense that lasts for nearly a minute.

Can anyone give me a clue as to what is going on? Do I need to upload the sample file and notebook?

Thanks very much!

Sara,

It would certainly help if you could attach a sample file and notebook. Some guesses:

Try adding the PlotRange -> All option to ListLinePlot. Does it still look clipped?

The output from AudioData does not have any sample rate information, so ListPlay uses a default, which is most likely different from the original. If the symbol audio is assigned to the sound sample then try adding the SampleRate -> AudioSampleRate[audio] option to ListPlay.

Rohit

Thanks very much! The PlotRange → All certainly did something.

The second part I didn’t understand though - I’ve uploaded my sample and a notebook, maybe you can tell me what I’m doing wrong.

Sara


sounds_brief.nb (14.9 MB)

Ah. I forgot that the SampleRate option only accepts a numeric value rather than a Quantity. This works.

ListPlay[data, SampleRate -> QuantityMagnitude[AudioSampleRate[short]]]

Thanks very much!