LiveSPICE

a SPICE-like circuit simulation tool for live audio signals.

More »

Get LiveSPICE

LiveSPICE releases are distributed from the GitHub releases page. Note the following requirements:

  • LiveSPICE is a Windows application.
  • An audio input/output device is required, a device supporting ASIO is recommended.
  • A desktop computer with a recent CPU is recommended for live simulation.
  • Requires the Microsoft .Net framework 4.0.

Getting Started

Here are some resources in the getting started guide to help you start using LiveSPICE:

Examples

Check out some examples of interesting, real circuits LiveSPICE can simulate in real-time:

About

Overview

Main LiveSPICE window.

The main LiveSPICE application window for creating and editing circuit schematics.

LiveSPICE is a SPICE-like circuit simulation tool for processing live audio signals. The motivation for developing LiveSPICE is to help prototype guitar effects and amplifiers, without requiring constructing a physical circuit or waiting for an offline simulation to run to try it out. With LiveSPICE, you can design the circuit in an easy to use visual schematic editor, and simulate it using your real audio device as an input signal and your speakers as the output.

Transient simulation of circuits is an extremely computationally intensive task, making it difficult to perform in real time. In addition, circuit simulation is a difficult problem to parallelize, meaning that most of the computer power improvements in recent years are not useful to speed up circuit simulation. In order to deliver real time, low latency transient simulations for audio signals, LiveSPICE is somewhat unique among circuit simulators in the following ways:

  • LiveSPICE relies heavily on a custom Computer Algebra System (CAS) to perform circuit analysis. This allows LiveSPICE to evaluate and simplify some of the mathematical operations required to simulate the circuit before simulation begins, minimizing the work required during simulation.
  • LiveSPICE Just-In-Time (JIT) compiles a custom simulation program for the particular circuit being simulated. This enables LiveSPICE to separate most of the logic for a simulation for evaluation as a preprocessing step, instead of evaluating it during simulation.
  • LiveSPICE uses simpler component models than most circuit simulators will use for many components, such as transistors and diodes. The simpler models are easier to evaluate quickly, helping the simulation to run in real time. However, the simpler models are less accurate and may not replicate the sound of the real circuit as well as a more advanced simulation would.

Despite these measures, there will always be a limit to the complexity of the circuits that can be simulated in real time. More powerful computers will be able to simulate larger and more complex circuits before running into limitations with simulation performance.

LiveSPICE is a hobby project with no particular goal besides making a tool that is fun to use. It is an open source project hosted on GitHub. If you would like to contribute, take a look at the open issues and send a pull request!

Features

Dynamic poteniometer controls.

Fender Bassman 5F6-A tone stack controls available during simulation.

The obligatory bullet point feature list:

  • Real time, low latency simulations of circuits for live audio signals.
  • Easy to use visual circuit schematic editor. The interfaces of many circuit schematic editors are easily mistaken for a torture device. If you feel that way about LiveSPICE, I'd love to know how it can be improved!
  • Small but growing library of component and part models, including op-amps, transistors, vacuum tubes, transformers, and more. Custom components can easily be added to the library by simply saving them in the library.
  • Support for a subset of SPICE model types (D, NPN, PNP, NJF, PJF) enables utilization of existing SPICE component libraries.
  • Supports ASIO audio devices for ultra low latency audio processing.
  • Dynamically adjust control components such as potentiometers and variable resistors during simulation.

Coming Soon

Planned future features and improvements but not yet implemented:

  • (Possibly limited) interoperability with SPICE netlists.
  • Exporting the simulation to a VST plugin for use in other audio processing applications.
  • More simulation and analysis tools in addition to live transient simulation, such as transfer function analysis and DC operating point analysis/sweeps.
  • Better numerical methods to help simulations of certain types of circuits (those with strong clipping effects, such as op-amps with a saturation model).
  • Major optimizations to the circuit simulation remain. This should enable better component models and larger and more complex circuits to be simulated in real time.

Examples

Here are some examples of what LiveSPICE is currently capable of simulating. All of these examples are screenshots of LiveSPICE during a real-time simulation.

Some notes about the performance data:

  • Performance is reported as the rate of processing by the simulation; if the processing sample rate is greater than the audio sample rate, the simulation can run in real time.
  • Not all simulations require the same oversampling rate to achieve real time performance. The oversampling factor was adjusted from the default of 8x to enable real time simulation as necessary.
  • All of the reported performance data is measured on an Intel i5 2500 (Sandy Bridge) CPU.
  • The performance data is not kept strictly up to date. Although performance is generally improving over time, some improvements have required performance regressions. Hopefully, these are temporary when they do occur!
Boss SD-1 Super Overdrive guitar pedal.

Boss SD-1 "Super Overdrive" guitar pedal.

This simulation runs at 74.3 kHz with an 8x oversampling factor (1.68x real time at a 44.1 kHz sample rate).

Circuit schematic from GM Arts.

Marshall Blues Breaker guitar pedal.

Marshall "Blues Breaker" guitar pedal.

This simulation runs at 97.2 kHz with an 8x oversampling factor (2.2x real time at a 44.1 kHz sample rate).

Circuit schematic from GM Arts.

Fender Bassman 5F6-A preamp.

Fender Bassman 5F6-A preamp and tone stack.

This circuit contains 3 related triodes (using a model derived from the Child-Langmuir law).

This simulation runs at 47.6 kHz with a 4x oversampling factor (1.08x real time at a 44.1 kHz sample rate).

Circuit schematic from Watts Tube Audio.

Ibanez Tube Screamer guitar pedal.

Ibanez "Tube Screamer" TS-9 guitar pedal

This simulation runs at 83 kHz with an 8x oversampling factor (1.88x real time at a 44.1 kHz sample rate).

Circuit schematic from GM Arts.

Basic common emitter transistor amplifier.

A basic transistor amplifier stage.

This circuit is a building block of most transistor amplifiers.

This simulation runs at 268 kHz with an 8x oversampling factor (6.08x real time at a 44.1 kHz sample rate).

Circuit described and analyzed in David Yeh's Dissertation (section 5.3).

Basic common cathode triode amplifier.

A basic triode amplifier stage.

This circuit is a building block of most tube amplifiers.

This simulation runs at 213 kHz with an 8x oversampling factor (4.83x real time at a 44.1 kHz sample rate).

Circuit described and analyzed in David Yeh's Dissertation (section 5.4).

References

Some great references used during the development of LiveSPICE:

  • Julius Smith's online books are an amazing resource for digital signal processing. LiveSPICE is only one of many projects for which I have found this resource very useful.
  • This SPICE reference was very useful for component models.
  • The Qucs (Quite Unversal Circuit Simulator) technical papers were also very useful for learning about component models, as well as some useful numerical techniques for circuit simulation.
  • My first circuit simulations were based on David Yeh's publications.

Documentation

Getting started guide

Installation

Prerequisites

Installing

  1. Download the current release from GitHub releases.
  2. Run LiveSPICESetup.exe and follow the instructions on screen.

Configuring your audio device

To configure your audio device, use the menu to select SimulateAudio Configuration.

  1. Choose the driver to use. Prefer ASIO if your device supports it. ASIO4ALL may also be a better choice than the windows audio driver.
  2. Select your device.
  3. Select channels to use. Multiple channels may be used simultaneously. A typical scenario is to select one input channel corresponding to a microphone/line in device; and two output channels if the output device is a stereo device.

Use the Test button to ensure your device is working. The test mode captures the signal from the input channels, displays the waveform on the scope, and plays the signal to the output channels.

Check that the signal is visible on the scope to ensure the input channels are configured correctly. LiveSPICE maps the digital signal maximum (0 dB) to 1 V. Therefore, if the peak of the signal is near 1 V, it is likely that your audio system will have clipping issues.

Check that you can hear the signal coming from your output device to ensure the output channels are configured correctly.

Note that the device cannot be reconfigured while the Test button is pressed. Click the Test button again to stop testing and enable reconfiguration of the audio device.

Tutorial: RC low-pass filter

This tutorial will walk through using LiveSPICE to build and simulate a simple passive first-order RC low-pass filter.

This tutorial expects that you have already configured your audio device in LiveSPICE.

For some background on the filter circuit to be simulated, see the low-pass filter article on Wikipedia.

Building the circuit

The first step is to build the circuit we are going to simulate. To begin, select FileNew to create a new blank schematic.

Adding components

Next, we will begin adding the circuit components. To add a component, find the component in the Component Library and click it. Then, click on the schematic where you want to place an instance of that component. We're going to need the following components, all from the Generic group in the library, to build the filter:

  • An Input; the input signal will come from this component, which is an ideal voltage source.
  • A Capacitor and a Resistor.
  • A Speaker; the output signal is measured as the voltage across this component.
  • A Ground.

Arrange the components roughly as follows:

RC low-pass filter components.

Parts for the RC low-pass filter.

If you need to move the components, select them and then click and drag them to move them. You can also use the arrow keys to rotate and flip the selected components.

Tips

  • You can search the component library by typing the name of the component you are looking for in the Filter field at the top of the library.
  • Use the arrow keys to rotate and flip components while adding them to the schematic.

Wiring the components

Next, we need to wire the components together. Select the Wire component from the library (or press Ctrl+W). Adding wires is a little different from the rest of the components, to draw a wire between two points, click on one point, and drag to the other point. Draw wires to connect the components as follows:

RC low-pass filter with wires.

RC low-pass filter wired up.

Tips

  • Holding Ctrl will allow you to draw more than one wire without selecting the wire from the library each time.
  • A red terminal indicates that the terminal is not connected. Make sure none of the terminals are red before continuing to the next step.

Setting component values

The next step is to edit the values of the resistor and capacitor to build the circuit that we want. Let's build a filter with a cutoff frequency near a D3 (the D string on a guitar), which is 147 Hz. If we use a 1 µF capacitor, we need roughly a 1 kΩ resistor to achieve this. To change the value of the components in the circuit, select a component by clicking it. This will bring up the properties for this component. Edit the Capacitance and Resistance fields of the appropriate components by clicking on them and typing the value.

Tips

  • You can use u in place of µ when entering a property value. Similarly, Ohm and are interchangeable.
  • While setting incorrect units explicitly for a property will result in an error, unit-less quantities are implicitly interpreted to have the units of the property you are setting.

Running the simulation

Verify that your circuit looks like the following:

Complete RC low-pass filter.

Complete RC low-pass filter.

To run the simulation, select SimulateSimulate on the menu. If you have not yet configured your audio device, you will be prompted to do so now. The simulation should now be running!

Click on any of the wires in the schematic to place a Probe. Probes generate signal data from the simulation, which is displayed in the Scope.

Simulating the RC low-pass filter.

RC low-pass filter simulation.

Using this information, we can verify that the qualitative behavior of the circuit matches our expectations for the circuit we designed:

RC low-pass filter after plucking the low-E string.

Input (red) and output (green) signals after plucking the low E string (E2, 82 Hz) of a guitar.

Plucking the low-E string of the guitar shows the higher harmonics filtered, and the gain of the circuit near unity.

RC low-pass filter after plucking the D string.

Input (red) and output (green) signals after plucking the D string (D3, 147 Hz) of a guitar.

We selected the corner frequency of the circuit to be the frequency of this note, and we can indeed roughly see the expected gain of -3 dB (1/2).

RC low-pass filter after plucking the high-E string

Input (red) and output (green) signals after plucking the high E string (E4, 330 Hz) of a guitar.

Plucking the high-E string shows a gain significantly smaller than unity, as expected.

Tips

  • If the signal is too quiet or too loud, use the gain adjustments on the Audio pane to adjust the amplitude of the signal.
    • Adjusting the Input gain or the gain of one of the input channels will adjust the amplitude of the signal before it is processed.
    • Adjusting the gain of the Output or one of the output channels will adjust the amplitude of the signals after they are processed.