Shaping Guitar Tone to Narrow Pulses??

Started by Jaicen_solo, June 27, 2007, 11:45:34 AM

Previous topic - Next topic

Jaicen_solo

Anybody have any ideas on how to modify the signal from a guitar into a series of narrow pulses (preferably of around a few milliseconds). I've considered using something like Tim's PWM (40106 based), but i've found that has problems with the hyseresis voltages, and doesn't track very well once the notes start to decay. Could that be improved by adding an op-amp comparator to square things up, then a diode clamp for some rough and ready compression? The thing is, I need this to be really simple to build, because i'm planning to use this with a Hex pickup, so I don't want to be building six complex circuits!

Actually, while we're on the subject, is it possible to have an oscillator that will lock into the fundamental frequency of a guitar note? Say for example, it will track a note above a certain threshold, and continue oscillating at that frequency once the note decays below the threshold?
I'm sure by now a lot of you will have an idea of where this is going ;)

Mark Hammer

Maybe you should look at JC Maillet's Nyquist Aliaser.  It's original intent is to "downsample" a signal,  but it might easily be co-opted into sampling at a decent rate with an altered mark/space ratio.

gez

I'm not sure that would work Mark, as (IIR) all that circuit does is chop at high frequency, it's not going to shorten squared off pulses (how would it know the duration of each pulse?).

Having experimented for a few years with all this stuff, I've come to the conclusion that if you want to do this accurately/well the word 'simple' doesn't enter the equation, though it is possible.  The method I used was to divide down your squared-up signal then use it to discharge caps fed from a constant current source: one cap discharges when the output of your divider is high, the other when it's low (use the outputs of a flip-flop).  Buffer the caps and mix the signals so that you get a sawtooth, then use a peak detector followed by a sample and hold circuit to act as a reference voltage.  You need to reset the whole shebang every other cycle.  Divide down this reference voltage and feed it to the input of a comparator, the other input being fed by the sawtooth.  How much you divide down the reference (you can use a pot) determines the duty cycle.

9V supply doesn't cut it.  You need at lest 12V to get a decent range.  This idea can be used to do all sorts of things: zero latency octave up (with consistent duty cycle over entire range)/sawtooth converter/stepped pulse width modulator/normal PWM etc.

Simple?   :icon_razz:
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

gez

#3
PS  The above method assumes you want to create a set duty cycle, but if all you want is to reduce your signal to a slither for some other purpose other than being able to hear it, use a monostable?

Edit: whoops, just remembered that a monostable wouldn't work, but there are simple pulse shorteners that can be used, but they need to be set up so that they shorten the highest frequency you'll be using in order to use them over a wide range of frequencies.  In other words, you end up with an inaudible slither.
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

Jaicen_solo

That actually sounds a lot like what I was planning to do actually. I'm thinking that if I could get a stable pulse with a consistent duty cycle, independant of frequency, i'll be able to feed the pulses to a waveshaper like the CEM3396, and have the beginnings of a poly-synth.
I can handle all the other stuff, but getting consistent tracking is the foundations I need to build on.
The CEM will handle all the charging/discharging of caps, as long as it's fed a nice pulse from which the pitch is derived.
FWIW, i'm planning on using a +/- 15v supply for the op-amp rails. That should give plenty of range.

gez

#5
I've posted this before:



I think I used LM334s for the adjustable current source.

If you buffer the cap that's being charged/discharged you end up with a signal that goes tooth-space-tooth-space etc.  Set up another current source feeding another cap - or perhaps switch one LM334 between two caps and a buffer (I think I avoided doing this because another LM334 took up less space than yet another switch chip: they soon stack up!) - so that it's anti-phase to the first one (swap the switch enable pins around) and you end up with a signal that goes space-tooth-space-tooth etc.  Mix the two and you end up with a saw tooth (it's like doing a zipper up, the two halves interlock) that diminishes in amplitude with frequency.  This doesn't matter though, as the f-to-v converter always outputs a voltage equal to the max amplitude of the sawtooth, so if you divide it down (resistor divider) and use that division to reference a comparator, the sawtooth (fed to the other input of the comparator) always triggers at half its max amplitude (if the divider uses equal resistors) giving perfect 50:50 duty cycle.  Different value resistors (or a pot for one of them) give different duty cycle.

IIR you need to use a little logic to get the signal back in phase.  I used a 12V reg for the LM334s and 15V for the op-amps; that way, the inputs of the amps don't get pulled all the way to the +ve rail.  You'll need to use amps that are happy with their inputs being pulled to ground. 
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

Jaicen_solo

Ok, I must admit you've lost me a little there!
From what I can tell, the F-V converter charges a cap via the current source, which is alternately charged and discharged by the application of the AC signal? A constant current source is needed to track the frequencies, so could I apply a voltage offset for to allow for different intervals? I'm guessing this would give me the pulse waveform output i'm looking for, but how well would it track at lower amplitudes?
I'm not really all that knowledgeable when it comes to electronics, so if i'm way off I wouldn't be surprised!

Sir H C

One technique is to gain up the signal to a square wave then run it through an AND gate with one path delayed by some inverters with extra RC timing cap.  This will give pulses of fixed width on the rising edges only, so fixed width pulses for each zero crossing going up of the signal.  If you want up and down, do it with an XOR gate, but then your pulse rate will be double the frequency.

Jaicen_solo

Sounds perfect, have you got an example schem?

slacker

I think the input stage of Ken Stone's Subharmonic Oscillator is the XOR version of what Sir H C just mentioned.

gez

#10
Quote from: Jaicen_solo on June 27, 2007, 04:10:28 PM
Ok, I must admit you've lost me a little there!
From what I can tell, the F-V converter charges a cap via the current source, which is alternately charged and discharged by the application of the AC signal? A constant current source is needed to track the frequencies, so could I apply a voltage offset for to allow for different intervals? I'm guessing this would give me the pulse waveform output i'm looking for, but how well would it track at lower amplitudes?
I'm not really all that knowledgeable when it comes to electronics, so if i'm way off I wouldn't be surprised!


The circuit I posted is a frequency to voltage converter and can be used as part of a larger circuit to alter (and keep consistent) the mark space ratio over a wide range of frequencies...if set up properly.  If all you want to do is reduce stuff to a slither, however, then look up pulse shortener, though duty cycle varies across frequency.

The circuit I posted works as follows:

Guitar signal is squared up using a comparator/whatever and fed to the flip flop which divides it down. The outputs of the flip flop are antiphase and are used to trigger switches.

When S1 is closed, the cap fed by the constant current source ramps up.  The opamp which buffers the cap acts as a follower (there's a tiny delay before it starts following due to the 100n cap charging up at its output, but not enough to cause a problem).  S2 is open, so there's a 3k load. 

When the flip flop changes, S1 discharges the cap to ground potential, pulling down the op-amp's + input with it.  At the same time, S2 snaps shut preventing the 100n from discharging.  The 100n keeps the -input held at whatever the peak voltage of the ramp was (it decreases with increasing frequency) and the op-amp's output goes low, reverse biasing the diode, thereby preventing the 100n from discharging thru the 1st opamp's output.  S3 is also opened at the same time and samples the peak voltage, presenting it at its output.  When the flip flop changes over, S3 snaps shut and that voltage is held.  S2 opens and discharges the cap via the 3k and the whole process starts again.

Use the flip flop to discharge another constant current source (not shown) antiphase to the first, buffer it's cap and mix it with the buffered ramp from the 1st charging/discharging cap.  You now have a sawtooth of the same frequency as the original signal but one whose amplitude reduces with increasing frequency. If you feed this saw to one input of a comparator, then use the output of the f-to-v converter as a reference voltage for the other input (stick a divider to ground at the output of the f-to-v converter) then the comparator triggers halfway through each rising ramp, resulting in a 50:50 duty cycle.  The signal is out of phase to the original, but it can be corrected if need be.  Alter the values of the divider used for reference, and you alter the duty cycle (though it remains consistent across the frequency range).

Remove the flip-flop and feed it with antiphase squarewaves and you have an octave up pedal.  This also reduces latency (not that this is a problem, the circuit is practically 'instant') 

"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

A.S.P.

why not differentiate the guitar signal per se
to derive frequency information at zerocrossings (=smallest amplitude)
for further processing,
instead of pimping it up and have it starving out nevertheless when falling
below comparator threshold values?
Analogue Signal Processing

Jaicen_solo

A.S.P, if you can show me how that's done, i'd be happy to do it!!

Thanks for the explanation Gez, i'm pretty sure I get how that works now. When you talk about removing the flip-flop, do you mean the second flip flop used to get generate the saw wave?? Why do you suggest the use of flip-flops to divide down the signal? I'm assuming it's because it gives the high/low change states to charge and discharge caps, but would a comparator not achieve the same function?
Maybe I should sleep on this, it's still confusing me!

gez

Quote from: Jaicen_solo on June 27, 2007, 06:43:48 PM
A.S.P, if you can show me how that's done, i'd be happy to do it!!

Thanks for the explanation Gez, i'm pretty sure I get how that works now. When you talk about removing the flip-flop, do you mean the second flip flop used to get generate the saw wave?? Why do you suggest the use of flip-flops to divide down the signal? I'm assuming it's because it gives the high/low change states to charge and discharge caps, but would a comparator not achieve the same function?
Maybe I should sleep on this, it's still confusing me!

The flip flop is the very first thing shown in the chain.  As well as giving 50:50 duty cycle and, as you point out, the antiphase outputs, it ensures that the frequency of the signal resulting from the circuit I described is the same as that of the input signal.  Without it, you end up with an octave up circuit. 

Forget about the flip-flop for a moment and think of it like this.  When the (squared off) input signal goes high, you get a ramp from one of the current sources charging up the cap.  When it goes low, you get a ramp from the other current source.  So, if mixed together, you get two ramps in the space of a single cycle.  In other words, frequency has been doubled.  That's great if you want an octave up circuit (it works beautifully by the way), but not if you want the output to be the same as the input frequency.

It's not clear what you're after (not to me at any rate).  If you want fixed ratios for your duty cycle (whatever it may be) over a large frequency range, then what I've outlined works.  If, however, you just want to shorten pulses, then there are very simple ways to do this, but duty cycle will vary with frequency.
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

SISKO

See the Boss Feedbacker schem at M. Hammer`s page. It has a fundamental extractor and its an oscillator that actually tracks the input frequency and keep on playing it till you unpress the pedal. IT has also en envelope generator.
The downside is that it produces an octave up of the actual note, but it wouldnt be hard to modify to do what you want.
--Is there any body out there??--

Jaicen_solo

Wow, seems like there are all manner of options available for something like this!

My original intention was to find a way of interfacing a guitar to a CEM3396, to allow me to build a polyphonic analogue guitar synth.
It looks like I should have not trouble at all getting that working following the advice i've received so far. I haven't actually had time to  breadboard anything yet, so it may be that I don't actually need constant duty cycles, in which case I quite like the look of the p-v circuit as the waveform source itself.  Coupled with a VCA and VCF, it would make a great psuedo synth.
My inspiration of course is the GR-300, which produces a unique squared-off ramp waveform, but is somewhat limited in terms of functions, so I started looking around for alternatives, and since I have a set of 6 CEM3396's, it was the obvious choice. It's obvious drawback as far as I can tell, are that the pitch reference will not be stable if it's fed from a guitar signal, so it may not be usable. To get around this, I had a look for the Feedbacker schem, but it appears it's on holiday, as often happens with Mark's page. I did find an interesting pitch to voltage converter that could be the start of an interesting alternative design too.



Jaicen_solo

Hey guys, I don't suppose anybody would like to cast a quick look over the layout i've knocked up below. It's for a single CEM3396 chip, working from the schem in the datasheet(http://www.synthtech.com/cem/c3396pdf.pdf). Input and output are buffered by a TL072 type op-amp, and all CV and power connections are routed offboard.
I'm pretty sure its correct, but i'd appreciate it if someone else could check it for any obvious errors I may have missed (as does happen!). I'm going to try and get one of these etched at the weekend to test out ideas for controlling it. I'm making it modular, so that I can make one PSU and one control PCB for multiple modules (since I have 6 chips ;) ). The offboard wiring will be tidied up to use headers and ribbon cables if it works, this is just a quickie test.

EDIT: The PCB layout is reversed, for use with PnP. I forgot to reverse the lettering though  :-[ It should measure 2.7 inches square when printed, so it's pretty small!





Dan N

#17
Probably too late? Pins 8 and 9 look switched. The caps in the filter are misnamed.

Good luck with your project! I have 6 3394's from a dead six trak I'm going to use in a similar fashion.

Jaicen_solo

Pins 8 & 9 on which IC? The op-amp is running a bipolar supply, +/- 12v.

Dan N

The 3396. On the pdf, pin 9 goes 20K to ground. Pin 8 goes to the transistor. You have then reversed.