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:

wavefile="z:/home/runejuhl/kashmir.wav" chan=0

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.


The WAVE file kashmir.wav acts as a voltage source. Only channel 0, the first channel, is used in this simulation. The lower voltage source is constant, used in this example to bias the input from the WAVE file with +6V.

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.

In these SPICE directives the transient analysis is set to a length of 30 seconds, beginning at t=0. As opamps are used in the simlation, the directive is included. .four, the Fourier transformation function of LTSpice has been used previously, but is now commented out. In the final line, the .wave directive is set up. out2 is referring to a label at the place we want our output.

Further reading Edit

Community content is available under CC-BY-SA unless otherwise noted.