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.
Wouldn’t a FPGA be better at emulating the transfer functions?
I think the idea here is to be able to do audio simulation as simple as possible. Not go with expensive FPGA.
I can see a very good use in schools to learn about modulation and electronics!
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.
“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.
LTSpice has the ability to read and write .wav files, no sound card needed for the simulation (but you need audio out to play the result). It doesn’t run in “real time” but still useful for testing filters, etc. See: https://www.analog.com/en/education/education-library/videos/5579265677001.html and https://www.instructables.com/id/Analog-Sound-Synthesis-on-Your-Computer/
“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?
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.
Abox and done
How about http://www.livespice.org/
It’s missing too many actual circuit elements (I mean, where are the 12AX7s..?) to be completely useful – but excellent for tinkering.
That looks great for working on a stomp box circuit. Too cool.
(Fires up the Windows VM)
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.