3 or 4 octave up square wave ??

Started by markusw, November 04, 2005, 06:48:58 AM

Previous topic - Next topic

markusw

QuoteIf you run a square waave thru an integrator you get a triangle wave.
Then if you full-wave rectify the triangle, you get a triangle with double the frequency (if the biassing is right). Which if you then overamplify, gives you a square wave.. at twice the freq of the original one. Practical? maybe, maybe not.

Hi Paul,

I was thinking about using triangle waves too. My idea was to first integrate the square wave, then run the triangle wave through an inverting opamp, and then run both triangle waves into  the two inputs of an OR Gate (at least I believe it was an OR gate. have to check my Spice sims when I'm at home). Should give an octave up square which then could be integrated......to finally get the 3 or 4 octaves up. Don't know if there are any other problems associated with this approach. Also up to now I don't have any idea how to implement the gate gez has posted.

Did'nt think about simply rectifying the signal though. Thanks for the tip  :)

Markus

markusw

#41
Hi all,

the 4046 PLL seems to work. I've breadboarded it like this: input buffer (TL072) -> comparator (TL072) -> NAND gate (to make it squarer) -> 4046 using PC2 with bin counter in loop (set to divide by 16)

After a little tweaking it responds quite well, even to the signal of my bass guitar (with on board EQ set to give a ~6dB/octave LP filter). Sounds pretty weird, like some "chinese" guitar. Latency is not that dramatic, needs improvement though.

Some further tweaking will be necessary to narrow down the band width of the VCO to 5-string bass guitar specs. Also playing with the PLL filter will be necessary.

My currrent plan is to put a self-adaptive Schmidt trigger in front of the PLL (with a counter that divides by 32). Also I want to put a LM13700 based compressor in front of it.

Some more Qs  :)

for the compressing section: what ranges for attack/decay and what compression ratio would be appropriate?

for the PLL filter: it seems that not only first order filters but also higher order filters are used. Is it possible to reduce latency with higher order filters? What are the general advantages of using higher order filters in PLLs?


Also tried Paul's square wave -> integrator -> rectifier approach. It would be definitely cool to do it this way (no latency) but it seems to me that integrator-based approaches are too sensitive regarding their frequency range. Although it may be possible to get one octave up (over the whole bass/guitar freq range) I have my doubts that this will work for much more than one octave up (all just LTSpice knowledge.......so maybe I'm completely wrong).

Again, thanks for your help in advance.


Markus


A.S.P.

anybody tried a POG in a Par*llell Univ*rse loop?
Analogue Signal Processing

gez

#43
Quote from: markusw on December 07, 2005, 01:25:24 PM
Also tried Paul's square wave -> integrator -> rectifier approach. It would be definitely cool to do it this way (no latency) but it seems to me that integrator-based approaches are too sensitive regarding their frequency range

I've tried that approach, but I didn't square the triangle off by boosting (nice idea Paul), instead I used a frequency to voltage converter with an OTA to keep amplitude stable.  It works well but you need to get the rectification spot on.  Yeah, no latency but only one octave up.  I posted another way of doing octave up in this recent thread:

http://www.diystompboxes.com/smfforum/index.php?topic=39254.0

I've only ever used 1st order filters with PLLs so can't answer your question.  Also, there are people here better qualified than myself to answer your questions on compressors (I hate the damn things!  :icon_razz:) so forgive me if I duck out of this thread for a while.  :icon_smile:
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

MR COFFEE

Hi Markus,
Before you spend a lot more time on the PLL approach, consider this:
You said:

QuoteAlso tried Paul's square wave -> integrator -> rectifier approach. It would be definitely cool to do it this way (no latency) but it seems to me that integrator-based approaches are too sensitive regarding their frequency range. Although it may be possible to get one octave up (over the whole bass/guitar freq range) I have my doubts that this will work for much more than one octave up (all just LTSpice knowledge.......so maybe I'm completely wrong).


Let me suggest a slight variation on Paul's suggestion - swap the rectifier for a comparator and set the reference input level by using a one pole low-pass-filtered version of the triangle wave. Or just AC-couple the tri-wave into the comparator. That gives you two square waves in quadrature (the original and one shifted 90 degrees). Feed those into a CMOS ex-or gate and you have a doubled-frequency square wave. The Squarewave-to-Integrator-to-Comparator-to EX-OR works over the entire audio range (not just Bass and Guitar fundamentals) and can be cascaded as many times as you want for repeated frequency doubling to get higher frequency outputs. National Semiconductor did an application note on something like this back in the 70's IIRC. A compressor in front of the whole shebang and a low pass filter are highly recommended to give you close to perfect tracking (so you get a decent square wave to start multiplying up).

So yeah, it's do-able, and the tracking can be quite fast and musical-sounding. I doubt you really NEED to go up more than 4 octaves (double twice) for what you're after. That's 6 op amps, plus a few more for filtering and ALC (automatic level control on the input), and one CMOS IC for both stages.

Pretty involved, but not outrageously complex. But keep in mind that if you hit it with a chord, it won't sound pretty, so it's *ALL* that circuitry for a one-trick-pony pedal.

I could be wrong, but I really think you're not going to be satisfied with the PLL approach, no matter how much time you spend tweaking it. PLLs just aren't meant to acquire low frequencies quickly. If you've ever listened to a PLL hunting for a frequency, especially with a divider in the feedback loop (dividing down your 3-4 octave up VCO square wave to compare to the input waveform) you'll see why the Boss Distortion Feedbacker has a slow swell of the PLL output to give the loop 800-1500 ms to get a decent lock before you subject humans to the sound of it's output. And the DF isn't using a loop frequency divider greater than 2 (one octave up), so it can lock faster than what you're aiming for.

Of course that PLL hunting may appeal to some folks that are into producing "novel" sounds that are not harmonically-related to any tonal system known to our species :icon_rolleyes:, but don't expect it to sound musical.

Of course you can overdamp the h*ll out of the loop so it glides up or down to pitch in a moog-ish semi-glissando sound that doesn't arrive at pitch at a time which bears any relationship to a songs rhythmic meter, but that doesn't work out to sound all that musical either, IMHO.

The only musically useful thing I ever got out of a PLL was a tracking filter to get controllable feedback on any note, and that was long, long ago, in a universe far, far away. As soon as the PLL locked, it started swelling up the band-pass-filtered guitar signal if you were stepping on the button, and it drove a cab right in front of the guitar player with bass-boosted and treble and mids cut to zero. One button for the fundamental, One for up an octave. Sort of Carlos-Santana-goes-techie feedback. Pretty friggin' complicated gizmo for an effect you just use here and there, though. 'Course guitar feedback was more of a staple back in 1967-1972 :icon_lol:  Kinda like pick scrapes and dive-bombs in the 80s...  ;D
Bart

toneman

Hey Mr C, do U know that National App Note Number??
thanx
Tone
  • SUPPORTER
TONE to the BONE says:  If youTHINK you got a GOOD deal:  you DID!

MR COFFEE

Sorry, I can't give you a number or link. I remember the circuit, but not the AN number. That was 30+ years ago !

And that was in a book - I'm not sure it's even on the National site nowadays - I looked for it for you, but I didn't see it. Maybe one of the older guys around here still has them, but you don't need it to build the frequency doubler.

The circuit description above is all you really need, and IIRC, about all the AN gave was the schematic without values anyway. I don't think the AN even gave suggested RC valuess - but anything reasonable for audio will work. That's really all you need to build one.  :icon_mrgreen:

You can tweak the RCs from there by ear for a pleasant sounding transient. It's a pretty simple circuit. Pretty foolproof design - the significance of the values only really matters to the extent they're in the right general range for audio, and that's pretty broad.
Bart


MR COFFEE

Toneman and Markus,

Found it! The Frequency Doubler circuit I referred to above was first described to the best of my knowledge in NS ap note AN-41. At least that's where I first came across it.  :icon_eek:

The circuit and explanation is on page 4 and 5

http://www.national.com/an/AN/AN-41.pdf

The AN-41 circuit shows using LM-111 comparators, but you can use a modern quad comparator chip like the LM339 or just plain ol' op amps down at audio frequencies.

No hunting, almost no locking delays (just a few cycles), no VCO whine in the background like with the 4046 PLL approach. And if you output it directly, it can sound pretty good. Very synth-like, only more expressive for guitar players, anyway, because it's controlled by a guitar string which can have smooth finger vibrato, bends, slides, etc. and tracks perfectly.

The only other approach that actually works is to use a uP to measure the periodicity and get your frequency that way (average a few cycles and compute the inverse, i.e., frequency = 1/period) and then use software to output your 3 or 4 octave up signal by bit-banging. That's how most guitar synths determine pitch nowadays. Following the nuances of string-bending, vibrato, tends to be a bit less perfect with this method.

But keep in mind you will need to really ALC (compress\limit\automatic level control) and LPF your guitar signal well before trying to get a decent job of multiplication with any approach. If you breadboard it, you'll see what I mean fast.  :icon_sad:

By the time you've built enough circuitry to get a decent clean square wave to use, you'll want to add only one more chip to make it do an octave down or two (while you're at it), and then it's just one more chip to make it ..., and just a few more components to ...,  :icon_wink: and pretty soon, you end up with a single-note guitar synth  :icon_wink:



Bart

gez

#49
Quote from: MR COFFEE on December 08, 2005, 11:59:12 AM
No hunting, almost no locking delays (just a few cycles), no VCO whine in the background like with the 4046 PLL approach. And if you output it directly, it can sound pretty good. Very synth-like, only more expressive for guitar players, anyway, because it's controlled by a guitar string which can have smooth finger vibrato, bends, slides, etc. and tracks perfectly.


If you set the oscillator up with only one resistor so that it's off when there's no signal then there's no wine, no gliss etc etc.  I've built working circuits using PLLs and haven't had the problems you described.  Like I said in an earlier post, you need to work at it as PLLs aren't perfect...but they're not trash either (there's gold in thar them hills!...well, a decent octave up circuit at any rate). :icon_razz:

Incidentally, I used a variation of the approach you mentioned in a quad triangle LFO.  If you use half an LM13700 for the integrator in a typical triangle generator (use half a dual op-amp for the Schmidtt part) then the other half of the LM13700 can be wired up from the output of the comparator (other half of op-amp) to mimic the first integrator.  Both Iabc pins are controlled from the same pot and you get two triangles, of equal amplitude, 90 degrees out of phase.  Really simple circuit.
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

markusw

Thanks a lot for your replies guys!!!
Definitely some more great food for thought :)

Will first have to try to understand everything that was posted  ;)

Mr. Coffee: thanks for the AN! Sounds too good to be true (but also quite complex in the end  ;) ).

gez:
QuoteIncidentally, I used a variation of the approach you mentioned in a quad triangle LFO.  If you use half an LM13700 for the integrator in a typical triangle generator (use half a dual op-amp for the Schmidtt part) then the other half of the LM13700 can be wired up from the output of the comparator (other half of op-amp) to mimic the first integrator.  Both Iabc pins are controlled from the same pot and you get two triangles, of equal amplitude, 90 degrees out of phase.  Really simple circuit.

You don't happen to have a schem of this "simple" circuit? :)

Regards,

Markus


gez

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

A.S.P.

Analogue Signal Processing

MR COFFEE

Hi Gez,

QuoteIf you set the oscillator up with only one resistor so that it's off when there's no signal then there's no wine, no gliss etc etc.  I've built working circuits using PLLs and haven't had the problems you described.

That sounds pretty cool.  8)

Do you have any sound clips?

I'd love to see your working PLL circuit - particularly your loop filter design that can go from zero hz to 300 hz without a VCO ramp-up gliss OR VCO hunting noises... and that drops the VCO frequency to zero quickly when the note ends to eliminate VCO whine... that is no minor accomplishment !

Please share more about you PLL circuit setup. 
Bart

gez

Quote from: MR COFFEE on December 09, 2005, 02:07:07 PM
I'd love to see your working PLL circuit - particularly your loop filter design that can go from zero hz to 300 hz without a VCO ramp-up gliss OR VCO hunting noises... and that drops the VCO frequency to zero quickly when the note ends to eliminate VCO whine...

OK, I now understand what you meant when you described VCO whine, I thought you meant you'd set the thing up to oscillate when no signal is present...my appologies. 

In some of my previous posts in this thread I mentioned either gating the PLL or using an envelope controled VCA to eliminate all the crud when the note ends.  One problem solved.  How you sort out the other problems is your business, how I do it is mine...
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

MR COFFEE

Hi Markus,

QuoteMr. Coffee: thanks for the AN! Sounds too good to be true (but also quite complex in the end).

Glad to help out. I played with frequency doublers for a while. It's not "too good to be true"; it's really a pretty straightforward circuit.

The complexity only applies if you go for high-end preconditioning circuitry (where you are "busting humps" trying to get a clean symmetrical squarewave out of a guitar waveform to feed into the frequency-multiplication circuit).

The input circuitry complexity can be varied in inverse proportion to your tolerance for "grit" in your signal. If you don't precondition the signal much before you feed it to the PLL multiplier, it still works and you still get frequency multiplication, right?  If you don't precondition the signal much before you feed it to the frequency doubler circuit, it still works - and probably behaves better on note tails than a PLL losing lock. Filtering the output can make either approach sound sweeter.

Hi Gez,

Sounds like you're working on a commercial design. Good for you; don't mean to pry. :-X

Even if you don't want to share your circuit design, how about a clip so we can hear what your PLL approach sounds like during lock acquistion?






Bart

gez

Quote from: MR COFFEE on December 09, 2005, 06:32:55 PM

Even if you don't want to share your circuit design, how about a clip so we can hear what your PLL approach sounds like during lock acquistion?

As you well know, whatever you use to do this is going to involve a fair bit of circuitry but the method you mentioned is a good one (I've tried similar approaches).  I still like PLLs though as there are some things only they can do.

If you're prepared to wait (got a busy weekend) I can knock up a sample or two of an effect I'm working on, though it's just a module at the moment and is pretty crude. 

A lot of the problems with PLLs you mentioned I've experienced, especially if the VCO has a large range, but it is possible to overcome them.  In my recent design there was no rocket science involved.  If you use an op-amp with symmetrical swing for the sine to square converter, make sure there are no offsets, drive the hell out of it (and I do mean drive!) then send it to a Schmidtt input logic gate (555 timer will do if you don't have board space) then you'd be amazed at the difference.  In short, if you provide the input of the PLL with as clean/square a signal as possible then it will lock really quickly (it's not audible).  The downside is that the slightest bit of noise from you strings will set the thing off, so you need gating of some sort.
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

markusw

Hi Mr Coffee,

just simulated the AN 41 doubler in LTSpice. Works really nice. After increasing the caps to adjust them to 5-string bass freq range (~30-300Hz) it works really nice. 
Some more Qs: the sims "say" that the integrator needs some time (depending on the freq range you want to cover) to "lock in" (i.e. to produce a symmetric triangle wave) . Is this just a Spice artefact?
I also tried to cascade these doublers and it seems although the circuit works fine for one, maybe two octaves up it gets problematic with more octaves. It seems the problem is caused by the integrator which produces a not-perfect-90° phase shift (or at least it does'nt produce exactly 90° over a wider freq range). Thus, pulse width is'nt exactly 50/50. For one octave (and even two) it does not really matter but if you try to cascade the circuit 5 times (which would be necessary in order to get 4 octaves up plus to compensate for the 1 octave lost by the adaptive schmidt trigger I'm planning to put in front of it)  you only get a pulse wave with some kind of oscillating pw (sorry don't know how to explain it).
So at the moment my theory is, that in order to get a reasonable squarish wave after the 5th octave up stage over the whole bas/guitar fundamental freq range, the phase shift had to be as close as possible to 90° for each stage. So I did some googling and found that it's possible to get a nearly perfect 90° phase shift over a quite large freq range by using a Dome filter like in  http://home.att.net/~wa1sov/technical/allpass/allpass.html. Do Dome filters also work with square or triangle waves?? If the Dome filter would work on square waves the 4-stage circuit shown in the above link plus the XOR gate might be sufficient. I know it's a tad more complex than the circuit in the AN 41 note but if it works.......

Hi Gez,

thanks again for the schem you posted in the other thread. Did I understand you correctly in that the circuit will give a more or less exactly 90° phase shift (between the two outputs) over a wide freq range??

Regards,

Markus





markusw

Hi all,

think I answered one Q myself: 4-stage Dome filters only work on sine waves (if you believe LTSpice   ;) ). Triangle waves already get very distorted. Sorry if I distribute common knowledge. But maybe it's possible to run square waves through a Dome filter if it has more stages.

Markus


gez

Quote from: markusw on December 10, 2005, 06:32:52 AM
thanks again for the schem you posted in the other thread. Did I understand you correctly in that the circuit will give a more or less exactly 90° phase shift (between the two outputs) over a wide freq range??

It's an LFO so the wide frequency range doesn't really apply.  Yes, it offers two triangles 90 degrees out of phase and amplitudes are stable and matched (well, within a gnat's gonad of each other).
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter