No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download


SPICE audio tools

This repository has two programs for importing wav file to SPICE and
exporting the output as a wav file.

- This tool converts a wav file with a list of values, which can be read
  using ngspices file source. If wav file has multiple channels only the values
  of the first channel are returned.

- Usage: python <input file> <output file>

- Ngspice must have been compiled with xspice support. File source can be used
  like follows:

    a1 %v([in]) filesrc
    .model filesrc filesource (file="values" amploffset=[0] amplscale=[1]
    +                          timeoffset=0 timescale=1
    +                          timerelative=false amplstep=false)

 See ngspice manual for possible options.

- This tool converts ngspice output to wav file. Compatibility with other
  simulators is untested.

- Use "wrdata" command in the spice netlist to save data to file.
  Run the ngspice in batch mode using the command line flag -b.

- Usage: python <SPICE output file> <Output wav> [clipping voltage].
  Clipping voltage is optional and if it's unspecified wav is written
  with maximum amplitude such that clipping doesn't occur.

# Example

Following commands can be used to get output from lowpass filter example file
when run on Linux:

    $ ./ file.wav inputvalues
    $ ngspice -b examples/lowpass.cir
    $ ./ output.wav