Spice With A Sound Card

In years gone by, trying out a new circuit probably would have meant heating up a soldering iron. Solderless breadboards have made that even easier and computer simulation is easier still, but there’s something not quite as satisfying about building a circuit virtually. [Thedeuluiz] has a way to get some of the best of both worlds with the RTSpice project.

The idea is simple in concept, although not as simple in execution. The program does a Spice-like simulation of a circuit and can accept input and produce output from a PC’s sound card. Obviously, that means you can’t simulate RF circuits — at least not at the input and the output. It also means the simulation has to run lightning fast to keep up with the sound card sample rate. According to the author, it works best with modest circuits but exactly how big you can go will depend on your hardware.

The simulation engine isn’t as complete as some other programs, however it also has special tags for inputs, probes, and parameters. These create inputs, virtual potentiometers, and outputs, respectively.

It looks like the code is set up for Linux but since Jack — the audio interface — is available on Windows, it might be possible to build it there, too. Planned improvements include a GUI schematic editor, better pot models, and subcircuits.

We like Spice in general. We use it and a browser-based simulator in our Circuit VR series.

11 thoughts on “Spice With A Sound Card

    1. If you know the actual transfer function, then a DSP would be better than a FPGA. :P
      Spice is used when you only have the raw circuit as it uses brute force numeric method to calculate circuit node voltages/currents over time.

  1. In years gone by, trying out a new circuit probably would have meant heating up a soldering iron. Solderless breadboards have made that even easier and computer simulation is easier still,

    Modern solderless breadboard have been around since the early 70’s as soon as 0.1″ components hit the market. Prior versions go back to the early 60’s. Before that, people hammered nails into wood boards (sometimes on top of the schematic) and used the nails as binding posts to wrap the wires around. Solderless breadboards did not replace soldering as a prototyping method unless you want to go back to vacuum tube days, and then it’s that I just don’t know about that time period.

  2. “According to the author, it works best with modest circuits but exactly how big you can go will depend on your hardware.”

    Does the program warn you when it’s pushing the hardware boundaries?

    1. Base on my experience with LTSpice:

      The internal solver uses an iterative approach to inverse a matrix, the solving speed depends on how fast it convergences. The closer you are towards a singular matrix, the more iterations it would take. Sometimes you add silly dummy components to make it converge faster. There is no way of knowing until you try.
      Sometime the time steps are small especially during the startup when the circuits are at fully operational voltages or steady state.

  3. There is whole VST audio plug-in industry that is used in mastering that often does this. Many old well-known compressors and EQs have software emulations now. Many literally run Spice code for the transfer function. Black Rooster Audio is one.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.