====== Sound'n'ngSpice Examples ====== Various examples - work in progress. see [[start|spicesound]] for syntax and overview. ===== RC - filter ===== A simple bandpass filter. * {{rcsim.cir}} - simulation - freq plot * {{rcfilter.cir}} - audio processing RC circuit the file ''rcfilter.cir'' reads capacitive bandpass filter v1 1 0 file /tmp/test.wav snd(0 0 1.0 0 0 1) r1 1 2 200 c1 2 0 5u c2 2 3 1u rload 3 0 1k .sndparam /tmp/test-filter.wav 48000 wav24 1.0 0.0 1 .sndprint tran v(1) v(3) .tran 2.08333e-05 5.0 0 2.08333e-05 .op .end This processes the first 5 seconds (the ''5.0'' in the ''.tran'' line) of the input file /tmp/test.wav (using the first channel - the last 0 in ''v1''..''snd''..''0'' line) writing ''/tmp/test-filter.wav'' which is a stereo file. first channel: unprocessed signal ''v(1)'' and 2nd channel: processed signal ''v(3)'' decreasing the time-step yields much better results: 1/96000 or 1/48000/4 .. .tran 1.04166e-05 5.0 0 1.04166e-05 .tran 5.20833e-06 5.0 0 5.20833e-06 .tran 2.08333e-06 5.0 0 2.08333e-06 I've used aliki to generate a frequency sweep from 20Hz to 20kHz: {{sweep_sin20_20k_5s48k.wav.gz}} - screenshots were made with rezound: the plotted result files show the original sound in the top and the processed audio in the bottom waveform. the spectrum plot was done with ngSpice ''iplot''. {{bandpass.png?500|bandpass filter waveform screenshot}} {{rc-freq.png?201|bandpass spectrum}} removing capacitor ''c1'' yields a high-pass filter which I found useful for testing the frequency response and ngSpice's timing accuracy. {{highpass.png?400 |highpass filter waveform screenshot}} {{highpass_zoom.png?400 |highpass filter waveform zoom-in}} ===== Jimi Hendrix Fuzz Face ===== {{git-fuzz.png?400 |fuzz face example waveform zoom-in}} * [[http://www.harpamps.com/schematics/jhfface.pdf|PDF schematic]] * {{jimi_fuzz3.oregano.gz}} - schematic for the [[http://arrakis.gforge.lug.fi.uba.ar/|oregano]] GUI * {{jimi_fuzz.cir}} - ngspice circuit using a sine wave as source * {{jimi_fuzz-snd.cir}} - ngspice circuit reading/writing sound files ==== Audio example ==== Produced with {{jimi_fuzz-snd.cir}} and {{gits.wav.gz}} (unzip to ''/tmp/gits.wav'' and run ''ngspince -b jimi_fuzz-snd.cir''). processed at 1s/(64*48k). The output contains the //original// sound in the left and the //fuzz-processed// audio in the right channel. //Original// here is a test-clamp audio output, which includes ngspice resampling: it's not a copy from the source-file data. * {{git-fuzz64.wav.gz}} * {{git-fuzz64.mp3}} Be aware that this example simulates an old fuzz distortion; recorded direct-in without any further processing. Therefore the //weird// sound is somewhat expected ;) - the circuit still needs fine-tuning: eg. tweak the input voltage range of the //guitar// and fuzz/volume potentiometers. ===== foxxfuzz ===== {{:wiki:foxx.oregano.gz}} is modeled after: * http://www.geocities.com/CollegePark/Library/1355/tonemachine.gif * http://www.geofex.com/FX_images/foxxfuzz.gif NOTEs: * The simulated Diodes and NPNs are not the original, but the default models available with //oregano//. * the gain/sustain pot is modeled in R50/R51 - sum 50k * the tone pot is modeled in R60/R61 - sum 50k * flip the octave switch, by removing diode D1. w/o Diode = off Beware: it's not yet debugged...