[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: Speaker SPICE modeling with gschem and ng-spice/gnucap



On Monday 12 September 2011, Hannu Vuolasaho wrote:
> Is it possible to do same thing? Input wav to simulator and
> get speaker's output and hear it? I know it's not perfect
> but it could be very helpful. Has someone done this before
> and provide some hints, examples or links?

If you can do some coding, you could write plugins for gnucap 
that could implement WAV in and out in a sense similar to what 
LTspice has.

For WAV input, one way is to make a "bm" plugin, that would make 
a variant of the voltage source, or anything else, but that is 
beyond what you are asking for.  It should be simple to read the 
WAV file and buffer it using the gnucap WAVE class.  You could 
use "bm_pwl.cc" as a starting point.  That is the plugin that 
provides Spice-style PWL.  Look at the transmission line 
(d_trln.cc) as an example of the use of the WAVE class.

For WAV output, make a new device, as a plugin.  Start with the 
current source (d_cs.cc) .. strip out most of it, and use 
"tr_accept" to write out the WAV file.  You would need to use a 
bit of trickery to write out fixed time steps from gnucap's 
variable steps.  You could force the time steps, that's easy, 
but it would run very slow.

This is just ideas .. seems fairly simple to me, but I haven't 
actually done it.

Of course you could write programs to translate files, but I 
think the plugin approach should be easier, and it will 
certainly run faster.  

Generating a PWL for input is fairly universal, but the spice 
"raw" files are different for every version of spice.  I am 
bewildered at why ngspice hasn't moved on to something more 
standard.  Both ways, the text mode translations on every time 
step will certainly be slow, and could also lose some precision.  
That may even be slower than the calculations.



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user