Message Boards Message Boards

0
|
4849 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
Share this post:

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

Posted 5 years ago

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!

POSTED BY: Sara Ann
4 Replies
Posted 5 years ago

Thanks very much!

POSTED BY: Sara Ann
Posted 5 years 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 BY: Rohit Namjoshi
Posted 5 years 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 BY: Sara Ann
Posted 5 years 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 BY: Rohit Namjoshi
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