WAV to Voltage vs Time

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Hello all,

I am looking for a way to digitally decode a WAV file and output a voltage level for every time sample. So for a 44.1kHz WAV file that would be a voltage level every 20µs. Is there any way to emulate digitally what a DAC does? I realize WAV files are PCM, so I'm not sure how to convert that to a time varying signal.

The goal is to output a voltage vs time plot from an audio recording, and then perform an FFT of that dataset. It seems like there should be some algorithm for doing this, but I have been unable to find anything online. Any suggestions or ideas would be greatly appreciated! Thanks in advance.
 
I recently asked for the author of Visual Analyser Visual Analyser 2011

to include a feature permitting FFTs of files to be performed, but I haven't received an answer.

In the absence of such a feature the simplest thing is to use 2 PCs. (It might be possible to do output and input simultaneously on one PC)

Connect the audio output of one PC to the input of the second (or connect 1 PC in loopback).

Run VA or other audio analysis program (AudioTester). Play the audio file on the software player of your choice. Capture the FFT into the analysis program.

w
 
Wakibaki,

Let me know if you hear anything back from about the Visual Analyser.

I considered your recommendation which would pass the signal through a DAC and then get recorded by an ADC to get the data. There has to be a better way; one that doesn't introduce distortion by having to loop from digital to analog then back to digital.
 
OK I have written to the author again...

An FFT is not a difficult algorithm. You could just print out the values, say 8192 of them, then do the butterflies manually. It would take a while... Or if you have software skills, read the .wav and write a program to do it.

I could do it, but it's a while since I wrote anything like that, I'm a bit lazy. I'll look it up and see how much work it would take...

w
 
quite a few freeware options - that read .wav directly

SciLab, Octave are MatLab work-alikes, both free, handle more points than Excel but still not good for more than a few x 10e7 points some syntax to master - I know SciLab, OK graphic interface, Octave rumored to run MatLab scripts better? - may need xwav scripts for 24 bit - actually more efficient to save as 32 bit wav in Audacity and read as 32 bit in SciLab - playing with bytes is expensive

LtSpice free simulator can read in .wav in a sim - you can then look at the fft in the plot tools, read magnitude, phase, compare ratios with dual cursors - handy if you're familiar with LtSpice

Audacity is a freeware sound editor project - not the highest res fft but good for stimulus/response playback/recording through a soundcard and extensive wav editing tools
 
Last edited:
A standard PCM wav file (They can contain various other things) is in essence a header plus a stream of sample values so plotting from the sample values is trivial in either the sample value or frequency domain.

Emulating the reconstruction filter so that you actually get something that looks like an analogue signal takes a little more work, especially if you are changing magnification often....

I don't know about Windows but on Linux there is JAAA and JAPA depending on exactly what you want to see for running realtime plots and any number of file IO utilities for reading the source data.

Failing that, hack something together with FFTW, libSoundFile and Gnuplot, should take less then an hour even given Windows pathetic excuse for a command shell.

Regards, Dan.
 
there are some oddities - Ltspce .TRAN will do a 1st order linear interpolation between points, if you use a high resolution time step, long fft record size you won't see the classic 1:1 reflection of the spectum around fs/2 - but the passband below fs/2 should still be representative (the images are sinc^2 filtered by the 1st order hold)

you could tweak the .tran settings, fft length to get closer to the "pure math" DiracDelta "no order hold" plots you would get with SciLab, ect

also you need to learn about window functions - but that applies to getting clean results from any time limited fft (I default to using Blackman)
 
Last edited:
Looks like Audacity is the easiest, you can just load the .wav, highlight the bit you're interested in by clicking and dragging the cursor, and going Analyze/Plot Spectrum. It doesn't provide a lot of illumination as to exactly what it's doing though. You can set the number of samples and the window, but it doesn't say whether it starts at the beginning, processes the number of samples and quits or whether it starts again and overlays the results or what.

LTSpice is a bit idiosyncratic in the UI, I haven't got it to work yet, but now I'm thinking Octave or Scilab is going to be the best option for fine control.

As regards the windowing, which I'd forgotten about in the context of writing a program, it's most convenient to be able to switch between them and observe the effect. Of those available in Audacity only the Hanning is of much use, and it doesn't seem to apply it consistently anyway. The leakage with the others is considerable, as can be seen if you generate a tone and then analyse it.

w
 
I don't know of an open file format for DSD but if you can massage it into a format recognized by the software you should be able to see the audio baseband content in fft although the high sample rate may limit the record time

but I find signal theory and digital processing work admirably and filtering DSD bit stream makes perfect sense - you do know that Sony recommends 50 KHz DSD analog reconstrruction filtering - and it needs to be higher than 5th order?
 
you do know that Sony recommends 50 KHz DSD analog reconstrruction filtering - and it needs to be higher than 5th order?

I didn't, but I do now. Unfortunately,technically interesting as such products may be, I get a bit impatient with them on more than one count, which makes me disinclined to investigate them in any depth.

The first two generations of Sony's PlayStation 3 (PS3) game console were capable of reading SACD discs. Starting with the third generation (introduced October 2007), SACD playback was removed altogether. Source: Wikipedia

w
 
Hello all,

I am looking for a way to digitally decode a WAV file and output a voltage level for every time sample. So for a 44.1kHz WAV file that would be a voltage level every 20µs. Is there any way to emulate digitally what a DAC does? I realize WAV files are PCM, so I'm not sure how to convert that to a time varying signal.

The goal is to output a voltage vs time plot from an audio recording, and then perform an FFT of that dataset. It seems like there should be some algorithm for doing this, but I have been unable to find anything online. Any suggestions or ideas would be greatly appreciated! Thanks in advance.

I don't understand why you want to output the WAV file as a voltage signal if you want to perform an FFT on it. If you really want a voltage vs time signal, simply play the WAV file (e.g., Windows Media Player). The signal driving your speakers fits your request. If you want a digital voltage vs time representation, that's what the WAV file is. If you want to FFT the WAV file, there are plenty of free VST plugins available (BlueCatAudio, DtBlkFx, Melda Production mAnalyzer or Voxengo SPAN to name a few), but you will need some music SW to use the VST in (e.g., Cakewalk Sonar, Cubase, etc.). There are also free Audio/MIDI Sequencers available that will allow you to plug in a VST (e.g., Audacity, Kristal, etc. - Check freemusicsoftware.org).

I hope some of this will be helpful to you.

Regards,
bbent
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.