Examples for wav audio simulation.
This commit is contained in:
parent
a7184842af
commit
d3510667e5
|
|
@ -0,0 +1,35 @@
|
||||||
|
README.examples, slightly adapted to the new ngspice wav capability,
|
||||||
|
taken from http://gareus.org/oss/spicesound/examples
|
||||||
|
Simulation either as batch mode
|
||||||
|
ngspice -b xxx.cir
|
||||||
|
or in control mode
|
||||||
|
ngspice xxx.cir
|
||||||
|
|
||||||
|
output of jimi_fuzz-snd.cir, ready to compare
|
||||||
|
git-fuzz64.mp3
|
||||||
|
git-fuzz64.wav
|
||||||
|
|
||||||
|
input for jimi_fuzz-snd.cir
|
||||||
|
gits.wav
|
||||||
|
|
||||||
|
circuit of fuzzer in jimi_fuzz-snd.cir
|
||||||
|
jhfface.pdf
|
||||||
|
|
||||||
|
just a simulation file of the fuzzer circuit
|
||||||
|
jimi_fuzz.cir
|
||||||
|
|
||||||
|
guitar input, fuzzified output on the left,
|
||||||
|
original on the right channel
|
||||||
|
jimi_fuzz-snd.cir
|
||||||
|
|
||||||
|
bandpass RC filter, input sweep_sin20_20k_5s48k.wav
|
||||||
|
rcfilter.cir
|
||||||
|
|
||||||
|
just a simulation file for the RC filter
|
||||||
|
rcsim.cir
|
||||||
|
|
||||||
|
wav simulation input (gits.wav) is output
|
||||||
|
sndtst.cir
|
||||||
|
|
||||||
|
input to rcfilter.cir
|
||||||
|
sweep_sin20_20k_5s48k.wav
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
This branch, based on ngspice-32+ from pre-master branch on 25.07.2020,
|
||||||
|
contains functions to read, simulate and output wav audio files.
|
||||||
|
|
||||||
|
The origin of the code stems from
|
||||||
|
http://gareus.org/oss/spicesound/start
|
||||||
|
http://gareus.org/oss/spicesound/examples
|
||||||
|
mady by Robin Gareus, enhanced by Hannu Vuolasaho at
|
||||||
|
https://sourceforge.net/p/ngspice/patches/13/
|
||||||
|
|
||||||
|
It uses the external libraries libsndfile and libsamplerate-0.1.9.
|
||||||
|
|
||||||
|
The current setup has been tested only with MSVC 2019 on Windows 10.
|
||||||
|
|
||||||
|
libsndfile has been downloaded from http://www.mega-nerd.com/libsndfile/ as
|
||||||
|
http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28-w64-setup.exe
|
||||||
|
|
||||||
|
libsamplerate-0.1.9 has been downloaded from http://www.mega-nerd.com/SRC/download.html as
|
||||||
|
http://www.mega-nerd.com/SRC/libsamplerate-0.1.9.tar.gz, and compiled
|
||||||
|
with mingw gcc 10.2 for 64 bit Windows 10. libsamplerate.lib has been created
|
||||||
|
from libsamplerate.def by command
|
||||||
|
lib /def:libsamplerate-0.def /out:libsamplerate-0.lib /machine:x64
|
||||||
|
in the Visual Studio 2019 Developer Command Prompt.
|
||||||
|
|
||||||
|
The usage is described in
|
||||||
|
http://gareus.org/oss/spicesound/start
|
||||||
|
|
||||||
|
A complete package for Windows will be made available from the ngspice web pages.
|
||||||
|
Test on Linux and macOS will follow.
|
||||||
|
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,77 @@
|
||||||
|
* jimi hendrix fuzz face - by J. Dunlop
|
||||||
|
*
|
||||||
|
* this netlist does not model the power-supply
|
||||||
|
* as in the original device. a zener and cap
|
||||||
|
* were left out next to the "battery".
|
||||||
|
*
|
||||||
|
* input : V2 - pin 10
|
||||||
|
* output: R50/51 - pin 9
|
||||||
|
*
|
||||||
|
* Pots:
|
||||||
|
* R50+R51 = 500k [Vol]
|
||||||
|
* R100+R101 = 1k [Fuzz]
|
||||||
|
*
|
||||||
|
*----------------------------------------------
|
||||||
|
* SPICE 3 - NETLIST
|
||||||
|
.options
|
||||||
|
|
||||||
|
*------------- Models -------------------------
|
||||||
|
.model NPN NPN(Is=1.0e-16)
|
||||||
|
|
||||||
|
*----------------------------------------------
|
||||||
|
|
||||||
|
V_V2 10 0 dc 0.0 file(gits.wav) snd(0 0 0.5 0 0 32)
|
||||||
|
R_R50 9 0 200k
|
||||||
|
R_R51 3 9 300k
|
||||||
|
R_R100 6 5 100
|
||||||
|
R_R101 5 0 900
|
||||||
|
R_R4 1 8 43k
|
||||||
|
R_R6 4 11 10k
|
||||||
|
C_C4 4 3 0.01u IC=0
|
||||||
|
C_C6 5 0 1u
|
||||||
|
Q_Q2 11 8 6 NPN
|
||||||
|
R_R5 1 4 330
|
||||||
|
Q_Q1 8 7 0 NPN
|
||||||
|
C_C3 7 6 47p IC=0
|
||||||
|
R_R3 7 6 68k
|
||||||
|
C_C2 7 0 1n IC=0
|
||||||
|
C_C1 2 10 2.2u
|
||||||
|
R_R1 10 0 180k
|
||||||
|
R_R2 2 7 100
|
||||||
|
V_V1 1 0 dc 9.0
|
||||||
|
|
||||||
|
*----------------------------------------------
|
||||||
|
|
||||||
|
*.sndparam /tmp/melon-fuzz8.wav 48000 wav32 1.0 0.0
|
||||||
|
**.sndparam git-fuzz9.wav 48000 wav32 3.5 0.0 2
|
||||||
|
**.sndprint tran v(10) v(9)
|
||||||
|
*.tran 2.0833333333333e-05 5.0 0 2.0833333333333e-05
|
||||||
|
*.tran 1.3020833e-06 25.0 0 1.3020833e-06
|
||||||
|
*.tran 1.3020833e-06 7.5 0 1.3020833e-06
|
||||||
|
|
||||||
|
*.tran 2.6041666e-06 2.0 0 2.6041666e-06
|
||||||
|
* /16
|
||||||
|
*.tran 1.3020833e-06 3.0 0.1 1.3020833e-06
|
||||||
|
.tran 6.5104166e-07 3.0 0.1 6.5104166e-07
|
||||||
|
*.tran 3.25520833e-07 3.0 0 3.25520833e-07
|
||||||
|
*.tran 1.627604166e-07 3.0 0 1.627604166e-07
|
||||||
|
*.tran 8.138020833e-08 0.5 0 8.138020833e-08
|
||||||
|
*.tran 4.069010416e-08 0.5 0 4.069010416e-08
|
||||||
|
.op
|
||||||
|
|
||||||
|
.control
|
||||||
|
if $?batchmode
|
||||||
|
else
|
||||||
|
save v(10) v(9)
|
||||||
|
sndparam $inputdir/git-fuzz9.wav 48000 wav32 3.5 0.0 2
|
||||||
|
tran 6.5104166e-07 3.0 0.1 6.5104166e-07
|
||||||
|
* tran 1.3020833e-06 3.0 0.1 1.3020833e-06
|
||||||
|
* tran 2.0833333333333e-05 5.0 0 2.0833333333333e-05
|
||||||
|
rusage
|
||||||
|
sndprint v(10) v(9)
|
||||||
|
rusage time
|
||||||
|
end
|
||||||
|
.endc
|
||||||
|
|
||||||
|
|
||||||
|
.END
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
* jimi hendrix fuzz face - by J. Dunlop
|
||||||
|
*
|
||||||
|
* this netlist does not model the power-supply
|
||||||
|
* as in the original device. a zener and cap
|
||||||
|
* were left out next to the "battery".
|
||||||
|
*
|
||||||
|
* input : V2 - pin 10
|
||||||
|
* output: R50/51 - pin 9
|
||||||
|
*
|
||||||
|
* Pots:
|
||||||
|
* R50+R51 = 500k [Vol]
|
||||||
|
* R100+R101 = 1k [Fuzz]
|
||||||
|
*
|
||||||
|
*----------------------------------------------
|
||||||
|
* SPICE 3 - NETLIST
|
||||||
|
.options
|
||||||
|
|
||||||
|
*------------- Models -------------------------
|
||||||
|
.model NPN NPN(Is=1.0e-16)
|
||||||
|
|
||||||
|
*----------------------------------------------
|
||||||
|
|
||||||
|
V_V2 10 0 dc 0.0 sine(0.0 0.3 440.0 0 0)
|
||||||
|
R_R50 9 0 400k
|
||||||
|
R_R51 3 9 100k
|
||||||
|
R_R100 6 5 950
|
||||||
|
R_R101 5 0 50
|
||||||
|
R_R4 1 8 43k
|
||||||
|
R_R6 4 11 10k
|
||||||
|
C_C4 4 3 0.01u IC=0
|
||||||
|
C_C6 5 0 1u
|
||||||
|
Q_Q2 11 8 6 NPN
|
||||||
|
R_R5 1 4 330
|
||||||
|
Q_Q1 8 7 0 NPN
|
||||||
|
C_C3 7 6 47p IC=0
|
||||||
|
R_R3 7 6 68k
|
||||||
|
C_C2 7 0 1n IC=0
|
||||||
|
C_C1 2 10 2.2u
|
||||||
|
R_R1 10 0 180k
|
||||||
|
R_R2 2 7 100
|
||||||
|
V_V1 1 0 dc 9.0
|
||||||
|
|
||||||
|
*----------------------------------------------
|
||||||
|
|
||||||
|
.print tran v(10) v(9)
|
||||||
|
.tran 2.0833333333333e-05 5.0 0 2.0833333333333e-05
|
||||||
|
.op
|
||||||
|
|
||||||
|
.END
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
This is not a wave file.
|
||||||
|
It is a test vehicle.
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
capacitive bandpass filter
|
||||||
|
|
||||||
|
v1 1 0 file ..\exampleswav\sweep_sin20_20k_5s48k.wav snd(0 0 1.0 0 0 1.0)
|
||||||
|
r1 1 2 200
|
||||||
|
c1 2 0 5u
|
||||||
|
c2 2 33 1u
|
||||||
|
rload 33 0 1k
|
||||||
|
B3 3 0 v = v(33) * 3
|
||||||
|
|
||||||
|
.sndparam ..\exampleswav\test-filter.wav 48000 wav24 1.0 0.0 1.0
|
||||||
|
.sndprint tran v(1) v(3)
|
||||||
|
.tran 2.08333e-05 5.0 0 2.08333e-05
|
||||||
|
.op
|
||||||
|
|
||||||
|
.control
|
||||||
|
if $?batchmode
|
||||||
|
else
|
||||||
|
save v(1) v(3)
|
||||||
|
sndparam ..\exampleswav\test-filter.wav 48000 wav24 1.0 0.0 1.0
|
||||||
|
tran 2.08333e-05 5.0 0 2.08333e-05
|
||||||
|
rusage
|
||||||
|
sndprint v(1) v(3)
|
||||||
|
rusage
|
||||||
|
end
|
||||||
|
.endc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.end
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
capacitive bandpass filter
|
||||||
|
v1 1 0 dc 0 ac 1 ; sin
|
||||||
|
r1 1 2 200
|
||||||
|
c1 2 0 5u
|
||||||
|
c2 2 3 1u
|
||||||
|
rload 3 0 1k
|
||||||
|
.ac lin 50 20 1000
|
||||||
|
.plot ac v(3)
|
||||||
|
.control
|
||||||
|
run
|
||||||
|
plot db(v(3)) xlog xlimit 10 1000
|
||||||
|
.endc
|
||||||
|
.end
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
simple audio test
|
||||||
|
|
||||||
|
V_V2 1 0 file ..\exampleswav\gits.wav snd 0 0 1.0 0 0 32
|
||||||
|
R_R1 1 0 1M
|
||||||
|
|
||||||
|
.sndparam ..\exampleswav\test-io.wav 48000 wav24 1.0 0.0 1.0
|
||||||
|
.sndprint tran v(1)
|
||||||
|
.tran 2.08333e-05 2.0 0 2.08333e-05
|
||||||
|
.op
|
||||||
|
|
||||||
|
.control
|
||||||
|
if $?batchmode
|
||||||
|
else
|
||||||
|
sndparam ..\exampleswav\test-io.wav 48000 wav24 1.0 0.0 1.0
|
||||||
|
tran 6.5104166e-07 3.0 0.1 6.5104166e-07
|
||||||
|
rusage
|
||||||
|
sndprint v(1)
|
||||||
|
rusage
|
||||||
|
end
|
||||||
|
.endc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.END
|
||||||
Binary file not shown.
Loading…
Reference in New Issue