Simulating circuit in order to build a pedal.

General Discussion about Guitar Amp modelers
nikos.agropoulos
Posts: 6
Joined: Sat Feb 06, 2016 8:23 pm
antispam: 0
Contact:

Simulating circuit in order to build a pedal.

Postby nikos.agropoulos » Sat Feb 06, 2016 9:12 pm

Hi guys! I'm new here but I've been watching the forum for many months and it helped me so much!

I'm really thinking of building my first distortion pedal. Since I know almost zero about programming I will only build a physical version.
My problem is, I want to know how it will sound before I build it. I've seen some of you guys use circuit simulation programs like LTspice, Multisim and similar programs before you build your plugins. I'm pretty clueless about that procedure though...
Since I guess it's impossible to test the circuit with my guitar sound in real time, is it possible to import an audio file into the circuit simulation program(input signal) and hear the proccessed one(output signal)? If it's possible what program does this job? Also, if you have your own procedure I'd be happy to read it.

I appreciate any help. Thanks!

DaveClark
Posts: 77
Joined: Sat Feb 27, 2010 2:39 am
antispam: 6
Contact:

Re: Simulating circuit in order to build a pedal.

Postby DaveClark » Tue Feb 09, 2016 6:02 pm

Hi nikos,

http://www.linear.com/designtools/software/#LTspice

SPICE 3 manual: https://newton.ex.ac.uk/teaching/CDHW/E ... userguide/

You'll have to read the sparse LTspice IV documentation or look at examples to see how to import/export WAV files: You basically create what looks like a comment right on the schematic. The syntax for input and output WAV files differ, so look out for that --- don't mix them up. Beware also that you can place a command on the schematic in such a way as that it will not be read; at least that has been my experience.

I couldn't get LTspice IV to work with floating-point WAV files, but perhaps there is a way. So if you need an input that is greater in magnitude than 1.0 Volts, you can reduce it below 1.0 Volts before input, then scale it back up by the same amount inside the schematic with one of the voltage sources (VCVS E). If you need to output a signal that is greater in magnitude than 1.0 Volts, you can scale it down with a voltage divider, then scale it back up in whatever you use to play it, view it, or whatever.

If you have no idea what I'm talking about, then you probably will become very frustrated in using SPICE. It's not for casual users, but instead for EE's (especially those who understand device models and numerical analysis), and it would take far too long to explain everything in sufficient detail so that you won't make mistakes and obtain meaningless or misleading results.

Also, it's not really convenient, to say the least. The technology dates back to 1973.

Regards,
Dave Clark

User avatar
PVDHP
Posts: 689
Joined: Sat May 21, 2011 6:34 pm
antispam: 6
Location: Russia
Contact:

Re: Simulating circuit in order to build a pedal.

Postby PVDHP » Tue Feb 09, 2016 8:16 pm

Hi!

PM me I'll send you a simulation ready schematic and spice pack. You'll just have to specify your input and output filenames.

nikos.agropoulos
Posts: 6
Joined: Sat Feb 06, 2016 8:23 pm
antispam: 0
Contact:

Re: Simulating circuit in order to build a pedal.

Postby nikos.agropoulos » Wed Feb 10, 2016 11:55 am

DaveClark wrote:Hi nikos,

http://www.linear.com/designtools/software/#LTspice

SPICE 3 manual: https://newton.ex.ac.uk/teaching/CDHW/E ... userguide/

You'll have to read the sparse LTspice IV documentation or look at examples to see how to import/export WAV files: You basically create what looks like a comment right on the schematic. The syntax for input and output WAV files differ, so look out for that --- don't mix them up. Beware also that you can place a command on the schematic in such a way as that it will not be read; at least that has been my experience.

I couldn't get LTspice IV to work with floating-point WAV files, but perhaps there is a way. So if you need an input that is greater in magnitude than 1.0 Volts, you can reduce it below 1.0 Volts before input, then scale it back up by the same amount inside the schematic with one of the voltage sources (VCVS E). If you need to output a signal that is greater in magnitude than 1.0 Volts, you can scale it down with a voltage divider, then scale it back up in whatever you use to play it, view it, or whatever.

If you have no idea what I'm talking about, then you probably will become very frustrated in using SPICE. It's not for casual users, but instead for EE's (especially those who understand device models and numerical analysis), and it would take far too long to explain everything in sufficient detail so that you won't make mistakes and obtain meaningless or misleading results.

Also, it's not really convenient, to say the least. The technology dates back to 1973.

Regards,
Dave Clark


Thanks for the useful info Dave. I think I can understand most of it :cheers:

PVDHP wrote:Hi!

PM me I'll send you a simulation ready schematic and spice pack. You'll just have to specify your input and output filenames.

Thanks for your help! PM'd

DaveClark
Posts: 77
Joined: Sat Feb 27, 2010 2:39 am
antispam: 6
Contact:

Re: Simulating circuit in order to build a pedal.

Postby DaveClark » Wed Feb 10, 2016 6:10 pm

Hi nikos,

I hope that PVDHP's post doesn't mislead you into thinking that SPICE is trivial! It is true that you would need to just replace the input and output files in the schematic (or netlist if you prefer, or in a script that calls the LTspice IV executable scad3.exe), but the circuit being simulated is a specific one, probably not at all what you wanted to simulate. Replacing the schematic, choosing the best models for all nonlinear devices, and setting the tolerances and time steps is where the nontrivial work will be.

PVDHP's "SPICE pack" is his installation of LTspice IV as he may have told you. It may have better selections for tolerances than the Linear Technology defaults, and Linear Technology does permit redistribution of its code, so there is no problem with his zipping it up for you.

Regards,
Dave Clark

User avatar
PVDHP
Posts: 689
Joined: Sat May 21, 2011 6:34 pm
antispam: 6
Location: Russia
Contact:

Re: Simulating circuit in order to build a pedal.

Postby PVDHP » Wed Feb 10, 2016 8:17 pm

Yes, but don't take me as a pro LT Spice user, I'm just a big noob there :D

DaveClark
Posts: 77
Joined: Sat Feb 27, 2010 2:39 am
antispam: 6
Contact:

Re: Simulating circuit in order to build a pedal.

Postby DaveClark » Wed Feb 10, 2016 8:23 pm

Hi PVDHP,

You've been a big help on this forum, so a huge Thanks!

Regards,
Dave Clark

nikos.agropoulos
Posts: 6
Joined: Sat Feb 06, 2016 8:23 pm
antispam: 0
Contact:

Re: Simulating circuit in order to build a pedal.

Postby nikos.agropoulos » Wed Feb 10, 2016 9:33 pm

DaveClark wrote:Hi PVDHP,

You've been a big help on this forum, so a huge Thanks!

Regards,
Dave Clark

+1 on that! Also, I love your amp sims!

DaveClark wrote:Hi nikos,

I hope that PVDHP's post doesn't mislead you into thinking that SPICE is trivial! It is true that you would need to just replace the input and output files in the schematic (or netlist if you prefer, or in a script that calls the LTspice IV executable scad3.exe), but the circuit being simulated is a specific one, probably not at all what you wanted to simulate. Replacing the schematic, choosing the best models for all nonlinear devices, and setting the tolerances and time steps is where the nontrivial work will be.

PVDHP's "SPICE pack" is his installation of LTspice IV as he may have told you. It may have better selections for tolerances than the Linear Technology defaults, and Linear Technology does permit redistribution of its code, so there is no problem with his zipping it up for you.

Regards,
Dave Clark

Hi Dave,

I'm basically a noob so it would definitely be a dumb idea to build a tube guitar amp as a first project :lol: Well, lethal voltages, high budget and complex schematics is not the best thing for a beginner project lol
Probably a simpler project like a tube screamer-ish pedal would be ideal. I have the schematics from many sources from the web. It won't be that hard to write them down into LTspice, I guess. I may also try some mods to give it some character before I actually decide to build the pedal irl. I guess that's a safe bet.

Also, I didn't understand the term "time steps" you wrote. Can you explain it please?

Best regards!

DaveClark
Posts: 77
Joined: Sat Feb 27, 2010 2:39 am
antispam: 6
Contact:

Re: Simulating circuit in order to build a pedal.

Postby DaveClark » Thu Feb 11, 2016 7:11 pm

Hi nikos,

Time step:

Perhaps you are already aware of the various types of analyses that SPICE can perform on a circuit. If so, then you may be aware of transient analysis. This is the type of analysis that you would typically specify when you import a WAV file. In this case, SPICE does an initial DC analysis, then proceeds to move forward in time using the values in the WAV file that represent a voltage at each time step, according the the time step that is determined by the sampling rate.

However, SPICE uses its own internal time step which may or may not match the time step of the WAV file, and you have some control over the value of that internal time step. If SPICE has trouble converging (calculating the solution to the system of linear equations), then it will cut back the internal time step and try again. It will do this only a certain number of times before giving up. This is just another place that the user can run into difficulties. If you specify very tight tolerances, the program may never converge, or it may take an exceedingly long time to converge. If you specify too loose of a tolerance somewhere, you may get inaccurate results, or it may go off somewhere, then fail to converge.

-----------

Just FYI --- Some personal experience and observations which you can ignore:

As an example that affected me recently: I wrote my own "code module" for Ngspice in order to import binary, double-precision values, plus I wrote another separate program(*) to convert WAV to the simpler binary format of the code module. Using a code module inside of Ngspice automatically decreases the internal time step dramatically, but it's possible to override this. I did so. I then had trouble subsequently either with convergence or with very long simulation times as I increased the circuit complexity. Circuit complexity in SPICE causes a geometric type of increase in simulation times because it's solving the entire system, not just one stage at a time as is done with amp sims.

In speaking with one of the TI SPICE developers at lunch one day, I happened to mention my results. He told me that I should revisit the tolerance parameters yet again because the defaults were pretty tight. I then realized that I had become somewhat inconsistent in my specifications, so did what he suggested and sped up my simulations by about a factor of 100.

I have a lot of experience with computational physics programs (used in the semiconductor industry), and my friend and former colleague has 30 years of development experience on SPICE. It took he and I together to solve my, as it actually turned out, rather simple problem. This is why I say that it's not for casual use!!! I probably would have eventually figured it all out, but it would have taken me awhile because there were all sorts of possibilities as to why the simulations took so long, for example the new models I had developed, the very high gain I was using, etc. A casual user would have had much more trouble all along the way.

Regards,
Dave Clark

(*) Quite frankly, I don't think that it's appropriate to combine WAV format and SPICE inside of the publicly available, open-source Ngspice; WAV format is only one of many audio formats, and audio is only one particular type of binary format. I cannot criticize the LTspice developer for implementing this capability in LTspice; he may have had a perfectly good proprietary or personal reason for doing that. Ngspice is more of a public project, begin open source and all. And I definitely do not want to sign up to support Ngspice with all the audio and non-audio formats people may request. This is why I wrote a generic binary-format code module and a separate translation program.

nikos.agropoulos
Posts: 6
Joined: Sat Feb 06, 2016 8:23 pm
antispam: 0
Contact:

Re: Simulating circuit in order to build a pedal.

Postby nikos.agropoulos » Fri Feb 12, 2016 10:12 pm

Thanks for being so informative Dave. Much appreciated!

soulkeeper1234
Posts: 29
Joined: Thu Sep 17, 2015 2:29 am
antispam: 6
Contact:

Re: Simulating circuit in order to build a pedal.

Postby soulkeeper1234 » Tue Apr 26, 2016 8:34 am

Thanks you. :D
sbobet online

MMJ
Posts: 161
Joined: Thu Jun 09, 2016 2:28 pm
antispam: 6
Contact:

Re: Simulating circuit in order to build a pedal.

Postby MMJ » Wed Jun 15, 2016 6:08 pm

take 5 pedals use have played for example rat, tube screamer, klon, super overdrive, big muff

go get the schematic and compare using general knowledge of the components this will help you fathom what the differences in schematic have on final tone of unit.

voog46385
Posts: 20
Joined: Sat Nov 19, 2016 8:18 am
antispam: 6
Contact:

Re: Simulating circuit in order to build a pedal.

Postby voog46385 » Mon Jan 09, 2017 6:40 am

What the need for better understanding of each other's needs.gclub royal

john88
Posts: 6
Joined: Thu Nov 24, 2016 7:17 am
antispam: 6
Contact:

Re: Simulating circuit in order to build a pedal.

Postby john88 » Mon Jan 09, 2017 6:42 am

It is all good

Gclub Royal


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests