create audio file from arduino sensor data

Hello, Does anyone know an approach to create an audio file from the signal my arduino is reading off of the analog pin? I am currently reading the sensor and sampling it and sending the digital signal to the computer over the serial port. is there any way to use processing to create an audio file from the data from the serial port?

Hi, you can try using the minim library to generate sounds using the data that you receive. For example, if you have 3 inputs one will control the wave form ( i.e. Sine, Square, Triangle, etc), another controls the amplitude (loudness of the sound) and the last one will control the frequency (pitch) of the sound. Try out the examples like 'Frequency modulation' for the minim library and adapt it to your need.

If that library is still actively maintained, yes. I used it maybe around 2009-2010. At the moment I didn't use Arduino but a PC to record from mic. It turns out my PC had a problem with sound card timing. An hour long lecture is more than enough to make audio and video out of sync enough to be unusable :)

Another way is to use arduino and some minimal hardware to generate a waveform for a PC to record on its stereo jack. What's preventing you from doing just that?

cte471:
Hello,
Does anyone know an approach to create an audio file from the signal my arduino is reading off of the analog pin? I am currently reading the sensor and sampling it and sending the digital signal to the computer over the serial port. is there any way to use processing to create an audio file from the data from the serial port?

You can use a serial terminal and “download” the data to a file. Have your Arduino send the data as ascii hex values, download the data as text, then externally convert the text file to a binary file and add a WAV header to it.

Attached is a utility I wrote a long time ago called “wavefix”. It can edit existing or create new WAV headers for files. I wrote it specifically for converting data files into sound files (actually, to listen to the sound of a combustion chamber pressure transducer in a small rocket engine by adding a WAV header to the transducer data).

The attached ZIP file has a Win32 console EXE file precompiled and the C source code. It will compile in Linux and will probably compile in MacOS (haven’t tried it on a Mac).

Hope this helps.

wavefix.zip (21.5 KB)