LTSpice is extremely versatile in terms of input -- it's even possible to take your input from a WAVE file and pipe the output to another WAVE file, which is great if you're building audio amplifiers.
Using WAVE files as input Edit
Using WAVE files as input is pretty straightforward. Instead of using a traditional voltage source as input for your circuit, replace the voltage expression with a WAVE-file expression:
In the expression above, the path refers to a file when using LTSpice through WINE on Linux. The path can be expressed as either a full path or a path relative to the location of the circuit schematic file.
"chan" refers to the respective channel in the WAVE file used for the simulation, and can be a number between 1 and 65535 -- although usually channel 0 refers to the left channel and channel 1 refers to the right channel.
Using WAVE files as output Edit
Using LTSpice, it is extremely easy to export the output as a WAVE file. The following SPICE directive is used for this:
.wave "z:/home/runejuhl/out3.wav" 16 44100 out1
In the directive above, the path is full path, 16 refers to the bitrate, 44100 is the sampling frequency and out1 is referring to a label in the circuit.
Although not confirmed, it seems that the output has to be in the range between -1 and +1V.
General considerations Edit
- Simulations take a long time. Even if you use the .tran directive to only simulate for a short while, it seems to take just as long to start up the simulation as if you'd used a full song-length WAVE file.
- Redrawing the screen is a pain in the ass. Clear all plots before simulating to help yourself later on.
- The number of channels, the frequency and bitrate can vary as needed. If you want to be able to listen to the output WAVE file, you need to make sure your music player understands the output. For regular persons this means 1 or 2 channels, 8 or 16 bit/channel and 11025, 22050 or 44100Hz bitrate.
Further reading Edit
- LTSpice Documentation [PDF]: http://ltspice.linear.com/software/scad3.pdf