Message Boards Message Boards

GROUPS:

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

Posted 1 month ago
205 Views
|
4 Replies
|
1 Total Likes
|

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!

4 Replies
Posted 1 month ago

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

Posted 1 month ago

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

Attachments:
Posted 1 month ago

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

ListPlay[data, SampleRate -> QuantityMagnitude[AudioSampleRate[short]]]
Posted 1 month ago

Thanks very much!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract