how to export raw data to Matlab?

Hello everyone,

I have a newbie question. I want to export raw data of sound intensity into a text file or an excel file for further processing in Matlab. I basically need two columns of data: 1) timestamps of each sample; 2) sound intensity level at each sample.

I am not interested in music or complex sound properties, all I need is to extract how sound intensity changes over time.

Many thanks,

What exactly do you mean? Do you want individual sample values, peak levels within a time frame, RMS values within a time frame, average energy levels, or something else?

Could you perhaps export the audio from Audacity as raw data, then read that directly into MatLab?

Basically I have the same question as Ahajnal.

For a stereo signal, how do I export the signal as two text files each representing one channel?

Kindest Regards,

And like Ahajnal you have not said what kind of “representation” you want.

Thanks Steve, the file specs were incomplete. What I am looking for is two integer text export files for a stereo recording (one file for each channel) that records a stereo signal as:

Filename ch 1.dat
[ASCII 44100Hz, Channels: 1, Samples: 34433, Flags: 1]

Filename Ch 2.dat
[ASCII 44100Hz, Channels: 2, Samples: 34433, Flags: 1]

The " Ch 1" and " Ch 2" would be an automatic addition to the input file name when this option is used.

Kindest Regards,

Not in Audacity (that I know of), but you might be able to get the data from a hex editor. This is Hex Fiend opening up my piano2.wav file on a Mac.

Of course you’ll need to know exactly what the file format is ahead of time and it can’t be compressed. No MP3 files for you.


You can get easily the sample values using Nyquist. I’m not familiar with Matlab, so I’ve no idea what the integers that you refer to represent.

Does Sox help you - import the WAV then write as textual data, which I figure would give you the amplitude of each sample (e.g. -0.888617 at one particular sample then + 0.323733 one hundred samples down the line) - something like the data that another user produced from a VB dump:

I’m not sure if opening the audio in a hex editor will let you get at the dec data - the hex editor I have won’t let you do that.


Steve, I don’t know “Nyquist” other than in “Nyquist frequency”, obviously out of context.

Gale, thanks for the suggestion. From the specifications it looks like it will work. I have spent some time on how I would streamline the Audacity output. Unfortunately I write it in Word with graphics. I found out too late that I cannot post that. I have asked for some advice on that one.

The more I work with Audacity, the more I like it. I use it and want to use it more to check on multi-channel measurements presented to Audacity as an analog channel output, just like sound. So far I have only done 2 channels, but soon I’ll try more.

Kindest Regards,


You can’t post very much stuff directly to the forum. You can post stuff Somewhere Else and point to it on the forum. I usually push stuff up to my own web site and write the URL here. My web site is starting to look like my garage.

Most normal people find a free hosting service that will allow you to put some stuff on line in exchange for commercials or something.


Here is a Nyquist plug-in that will create a text file with the sample values for the left and right channels of a stereo track.
Audacity 1.3 is required.

I don’t know if this will be any good for Matlab (it’s not exactly in the form that you are asking for), but it gives you a text print out of the numerical value of each sample. Perhaps you can do something with it.

To use, unzip the file into the Audacity plug-ins folder.
The plug-in will appear in the “Analyze” menu when you restart Audacity. (552 Bytes)

That’s what I advised Mari to do if her file was large, but I’ve now allowed attaching a PDF of up to 1 MB. They won’t display inline though - I assume phpBB does not support that.