|
Post by aquin43 on Apr 28, 2020 9:05:13 GMT -5
Following an earlier post, I have refined and simplified the string model with delay lines and found that it can be used to produce an audible output using the .wave file writing instruction in LTSpice. The model is shown in the following diagram. It now includes only the minimum number of line terminating resistors and adds a frequency dependent loss at the reflection from the bridge. This causes the waveform to soften towards a sine wave as time elapses. The pluck is assumed to be a spike of acceleration, modelled as a short pulse of voltage. The pickup output is the sum of the forward and backward waves at the pickup position. The pickup senses the velocity of the string. Because we have chosen voltage to represent acceleration on the delay lines and velocity is the integral of acceleration, the pickup signal from the line needs to be integrated. This is achieved by converting the signal to a current in the Behavioural Controlled Source B1 and using that current to charge a capacitor.
The model is subjected to a transient analysis and the output is written to a .wav file so that the sound of the 'string' can be heard. Surprisingly, for such a simple model, the sound is reasonably realistic. The plucking and pickup positions are parameters and can be varied. The limitation of this configuration is that the pickup has to be further from the bridge than the pluck. A simple change in layout would be needed to alter this.
The pickup is not modelled at this stage and so presents a very wide bandwidth. It would be straight forward to cascade one of the standard pickup models with the output and also to include a second pickup coil. The audio link system doesn't seem to work, nor can I see how to upload the mp3 file derived from the .wav file, so I have linked to an external source Arthur
|
|
|
Post by antigua on Apr 28, 2020 14:24:03 GMT -5
Wow, that's wildly impressive. I'll be honest, at least half of this is over my head. It sounds more like a nylon guitar than an electric, which is surprising since this is based on an electric guitar model. I feel like this deserves more attention than it would get on this forum alone. It seems like this would be a good basis for creating a virtual guitar that has a physical basis. There are a bunch of guitar VST's on the market that promise to approximate real electric guitars, I don't know if they work based on this principle. Maybe this would be of interest to a maker of VST's. There are some SPICE implementations made specifically for audio that might streamline this, like this www.livespice.org/ . I bet that could be used to create guitar pedal circuits, like a virtual Tube Screamer. It would be pretty awesome to be able to virtually manipulate a stomp box while playing through it.
|
|
|
Post by aquin43 on Apr 29, 2020 3:30:55 GMT -5
Wow, that's wildly impressive. I'll be honest, at least half of this is over my head. It sounds more like a nylon guitar than an electric, which is surprising since this is based on an electric guitar model. I feel like this deserves more attention than it would get on this forum alone. It seems like this would be a good basis for creating a virtual guitar that has a physical basis. There are a bunch of guitar VST's on the market that promise to approximate real electric guitars, I don't know if they work based on this principle. Maybe this would be of interest to a maker of VST's. There are some SPICE implementations made specifically for audio that might streamline this, like this www.livespice.org/ . I bet that could be used to create guitar pedal circuits, like a virtual Tube Screamer. It would be pretty awesome to be able to virtually manipulate a stomp box while playing through it. Digital simulation of plucked strings is pretty advanced nowadays, well in advance of this simple model. The point of this exercise was to make a useful model available in Spice. It operates well below real time but easily allows the addition of pickup models and other circuitry. I thought that it might provide an alternative to the simple frequency response model of Tillman. The comb filter frequency responses are interesting to see but convey little idea, to me at least, of the possible sounds produced.
It is easy to change the string pitch and add a pickup. Here is an open D string through my Spice model of a DeArmond 1000 pickup with 200K 475pF load, placed at the fingerboard end (0.25) with the pluck at 0.22.
Arthur
|
|
|
Post by antigua on Apr 29, 2020 11:15:24 GMT -5
Another thing that is interesting to me is that it shows a convincing guitar sound can be produced by a relatively simple model. I would have thought the sound of a classical guitar owed a lot to the wood box and the sound hole and placement of the bridge, the particulars of the nylon strings, and while any model could be made complex up to a point that it describes every function of a physical system, I'm surprised how small of a model it took to create that sound so convincingly.
The only strange thing about the modeled sound is that the fundamental decay rate seems to be a lot longer than if it were a real guitar, I suppose because the damping aspect of a real guitar isn't accounted for. But I also wonder why the first sound sample sounds so much like a nylon stringed guitar's low E, and not so much like a steel string low E. Less harmonic amplitude maybe?
|
|
|
Post by aquin43 on Apr 29, 2020 11:52:27 GMT -5
The only strange thing about the modeled sound is that the fundamental decay rate seems to be a lot longer than if it were a real guitar, I suppose because the damping aspect of a real guitar isn't accounted for. But I also wonder why the first sound sample sounds so much like a nylon stringed guitar's low E, and not so much like a steel string low E. Less harmonic amplitude maybe? Here is the low E through a Creamery Strat pickup at the fingerboard end plucked at 0.2 from the bridge but with slightly increased overall damping and reduced high frequency damping
Arthur
|
|
|
Post by antigua on Apr 30, 2020 11:53:57 GMT -5
The only strange thing about the modeled sound is that the fundamental decay rate seems to be a lot longer than if it were a real guitar, I suppose because the damping aspect of a real guitar isn't accounted for. But I also wonder why the first sound sample sounds so much like a nylon stringed guitar's low E, and not so much like a steel string low E. Less harmonic amplitude maybe? Here is the low E through a Creamery Strat pickup at the fingerboard end plucked at 0.2 from the bridge but with slightly increased overall damping and reduced high frequency damping
Arthur
Would you mind making the SPICE file available? I'm interested in seeing how different values change the sound that is produced.
|
|
|
Post by perfboardpatcher on Apr 30, 2020 14:18:58 GMT -5
Following an earlier post, I have refined and simplified the string model with delay lines and found that it can be used to produce an audible output using the .wave file writing instruction in LTSpice. That's a cool project Arthur, I will clone it from scratch! I already have Vin and a resistor and am experimenting with the values for the parameters of Pulse to understand what it does. AC 1 is not strictly necessary?
|
|
|
Post by aquin43 on Apr 30, 2020 16:38:42 GMT -5
Here is the low E through a Creamery Strat pickup at the fingerboard end plucked at 0.2 from the bridge but with slightly increased overall damping and reduced high frequency damping
Arthur
Would you mind making the SPICE file available? I'm interested in seeing how different values change the sound that is produced. Here is a link to a zipfile with two versions. One has the pluck on the bridge side of the pickup and the other has it on the fingerboard side. I have arranged all of the variables as parameters so it is easy to set the frequency and the delays are set. The string hf damping and iteration interval are also set to reasonable levels. Also included is a pickup symbol and an include file with some pickup models. It should all be unzipped into a directory and the .asc file run from there. The pickup include file and the symbol should be picked up. You change the pickup by changing the spice model name in the pickup symbol. The .wav file is written back to the same directory.
Arthur
|
|
|
Post by antigua on Apr 30, 2020 17:07:52 GMT -5
Thanks a lot! I'll give this a try.
|
|
|
Post by aquin43 on May 1, 2020 6:02:53 GMT -5
Its not difficult to extend this to multiple pickups. The only problem is that all of the delays have to be positive so the layout depends on how the pluck position is related to the pickup positions.
Here is a Strat D string plucked at 0.24, first with just the fb pickup and then with fb and middle combined.
Arthur
|
|
|
Post by aquin43 on May 6, 2020 16:26:51 GMT -5
Thanks a lot! I'll give this a try. Did you get it to work?
I noticed later that the waveform generated is very sensitive to the minimum step size. It becomes consistent when the step size is set to 1u5 or less. This makes the calculation quite slow. It is also possible to play at different frets by changing
dely1 = dely*(1 - pu_pos) to
dely1 = dely*(pow(2,-(fretnum/12))-pu_pos)
where fretnum is the fret number starting at 0 for the nut.
If fretnum is a stepped parameter, e.g. .step param fretnum list 0 1 2 3 4 5 a series of files can be written by using
.wave "pluck_{fretnum}.wav" 16 44k1 v(pickup)
Arthur
|
|
|
Post by antigua on May 6, 2020 22:48:51 GMT -5
Thanks a lot! I'll give this a try. Did you get it to work?
I noticed later that the waveform generated is very sensitive to the minimum step size. It becomes consistent when the step size is set to 1u5 or less. This makes the calculation quite slow. It is also possible to play at different frets by changing
dely1 = dely*(1 - pu_pos) to
dely1 = dely*(pow(2,-(fretnum/12))-pu_pos)
where fretnum is the fret number starting at 0 for the nut.
If fretnum is a stepped parameter, e.g. .step param fretnum list 0 1 2 3 4 5 a series of files can be written by using
.wave "pluck_{fretnum}.wav" 16 44k1 v(pickup)
Arthur
Yeah it works right out of the box. It uses a few spice commands and components I'm not familiar with, so I'm still studying it and poking it. I set multiple cycles on the pulse generator, do you know if there's a way to change the stepped fret for a given pulse? That would be pretty nifty, a little song could be input by fret numbers. Thanks again for sharing this. It's a valuable proof of concept as well as a fun spice model to play with.
|
|
|
Post by perfboardpatcher on May 12, 2020 13:46:30 GMT -5
|
|
|
Post by aquin43 on May 13, 2020 4:35:47 GMT -5
The only thing I do different is the signal to simulate the pluck. ... Also, using a sine wave - SINE() in the comments - to drive the strings doesn't work very well. There is some sort of a tremolo effect when the string is triggered by a sine wave that matches the fundamental or harmonics of the string. When the sine wave is not in tune - e.g. .param driv_f = fx * 1.1 - then V(I_out) is lower. Interesting to see a different version of the same concept. Does the feedback make it oscillate continuously? A similar effect could be produced by making the damping ratio slightly greater than unity and adding a clipper in the path.
As to the sine wave stimulus: the string is a lightly damped oscillator. If you want to measure its frequency response by exciting it with a sine wave you will have to ramp the sine wave up very slowly to avoid exciting the string with the starting transient.
Arthur
|
|
|
Post by perfboardpatcher on May 14, 2020 14:09:44 GMT -5
Interesting to see a different version of the same concept. Does the feedback make it oscillate continuously? A similar effect could be produced by making the damping ratio slightly greater than unity and adding a clipper in the path. As to the sine wave stimulus: the string is a lightly damped oscillator. If you want to measure its frequency response by exciting it with a sine wave you will have to ramp the sine wave up very slowly to avoid exciting the string with the starting transient. Arthur Yes, feedback makes it oscillate. I'm still trying to solve a problem I'm experiencing, though. When parameter fret becomes 7 or higher I get an error message that parameters dely2 and dely3 have become negative. and only for T5
|
|
|
Post by perfboardpatcher on May 24, 2020 13:32:44 GMT -5
I did some experiment in gnu octave. I've created wave shapes that represent the string being plucked and released at different position across the string. 150 Herz, let's call it an open D string. The plots show 3 cycles but the moment of pluck and release itself is only half a cycle. String plucked and released exactly in the middle No even harmonics are generated, not much harmonics at all. String plucked and released close to the bridge All sorts of harmonics created
|
|