String pluck detector??

Started by markusw, March 07, 2007, 06:15:54 AM

Previous topic - Next topic

ElectricDruid

I agree with some of your analysis of the 4015 connections. It definitely looks like the two Clock inputs and the two Reset inputs are tied together. There's quite a bit I don't understand though:

1) Those reset inputs. Stuff I can find online about the 4015 (and that pinout above) shows the Reset inputs as active-high, but this schematic suggests active-low. Tying the resets high like that would stop the chip from doing anything, according to National Semiconductor.

2) Is this set up as two four-bit shift registers in parallel or one eight-bit shift register?
The two data inputs tied together makes it look like dual 4-bit in parallel, but one 8-bit register makes more sense to me for what it's doing (generating a steppy "sine wave" approximation by outputing a different voltage level each time it's clocked).

Rob Strand

#141
Quote from: ElectricDruid on June 05, 2023, 06:11:29 AM
I agree with some of your analysis of the 4015 connections. It definitely looks like the two Clock inputs and the two Reset inputs are tied together. There's quite a bit I don't understand though:

It's a common trick to generate a low distortion sine-waves digitally.

The 4015 is wired as an 8-bit shift register, which you initialize to all zeros or all ones.  Each clock pulse shuffles the 8 bit pattern but the input feeding back into the start of the shift register is inverted.   If you look at any *bit* on the shift register it looks like a square wave with a period of *16* clock cycles. 

The resistors form the weightings of an *8-tap* FIR digital filter; it just happens one of the weights is zero.   This effectively filters the harmonics off the square-wave; the FIR filter notches are at the harmonics positions.   The first non-zero harmonic is the 15th harmonic - the level is quite low.   This way you get a clean sine-wave.  The upper harmonics can be removed with an analogue filter with a much higher cut-off than trying to filter the square-wave with an analog filter.

You might find some old magazine articles under "magic sine waves" but the formulas had errors.  Other terms are digital sine waves and quasi sine waves.


Ah, I see your problem now.

The two *clock* inputs should be tied together and there should be a link between Q3 and Din_B  (I'm calling A Q0 to Q3 and B Q4 to Q7. Some datasheets will start at Q1 and go to Q8.)

Here's the idea, except it uses a different output filter, one with 8 non-zero taps (the 7 resistor filter works perfectly well also)
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

ElectricDruid

#142
Thanks Rob, that diagram is much more like I was expecting to see!

I understand the gist of how it's supposed to work, although I wouldn't have thought of describing it as a FIR filter (I like that way of looking at it though) but I couldn't see how the schematic previously given was going to achieve that, since the two registers seemed to be paralleled up rather than in series.

I note also your 4015 diagram shows the Resets tied low. Which is what I expect.

Rob Strand

It makes you think did the schematic as drawn ever work.  I can't see how it can, not even in a weird way (you can never tell with these things).  Perhaps the error was from going hand drawn development notes to the computer.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

ElectricDruid

Quote from: Rob Strand on June 05, 2023, 06:05:55 PM
It makes you think did the schematic as drawn ever work.  I can't see how it can, not even in a weird way (you can never tell with these things).  Perhaps the error was from going hand drawn development notes to the computer.

Yeah, my thoughts too. I alluded to this in my first post back when this came alive again:

Quote from: ElectricDruid on June 04, 2023, 06:08:08 AM
Be aware that that schematic is from a simulation. So the circuit might be tested in the sim alone, and it doesn't look entirely complete to me - or at least assumes quite a lot of stuff.
https://www.diystompboxes.com/smfforum/index.php?topic=55075.msg1268177#msg1268177

Rob Strand

Quotehttps://www.diystompboxes.com/smfforum/index.php?topic=55075.msg1268177#msg1268177
Reading over the earlier posts I think the author had good intent entering the design into CAD so others can use it.  It's just that a few things went wrong.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

RGP

Many thanks to both of you for helping me understand this. I'm still working on a redraft of the schematic and when it's finished I'll have to learn how to post it here. You guys are great! I really appreciate your efforts. 

RGP

Rob thanks for posting your sine wave converter. Its much better than the one on the original schematic which uses some hard to get resistor values. Can I use one section of the 4093 on your circuit? Another question. Are the 4040 divider outputs square wave? If so can I use those outputs as square wave sends? On the original schematic a switch is used to select the octave. I'm thinking about feeding the output of each octave into a channel of a virtual ground mixer to level them out.  Can that work?
What I'm trying to do is use Marcus' E&MM Harmony Generator clone as a master tone generator for a guitar synthesizer I'm designing. The tone generator would have sawtooth, sine and square wave outputs to simulate other musical instruments.     

Rob Strand

#148
Quote from: RGP on June 07, 2023, 11:42:15 PM
Rob thanks for posting your sine wave converter. Its much better than the one on the original schematic which uses some hard to get resistor values.
Both the 7 resistor and 8 resistor circuits work fine but there's a whole lot of finer points to selecting those resistors.  When you find these circuit you do not know what the designer has allowed for.   It's pretty normal to have funny resistors values.   Basically have to decide what how far you are going to go with the resistors:
- only E12 values (10k, 12k, 15k etc)?
- allow E24 values (10k, 11k, 12k, 13k, 15k).
- allow series or parallel resistors? (and then E12 only, or E24
- other valued resistors which are available (like 22.1k)?
- what tolerance resistors 5%, 1%, better?

There's plenty of options and you need to pin things down.

A significant factor is the CMOS 4000 gates have quite a but of output resistance and that resistance needs to allowed for when selecting the resistor, ie. subtracted off, the exact resistor values.  The gate resistance isn't 100% precise so ideally you want to dilute its effect.   If you at the original circuit If you make the resistor largish then the gate resistance has less effect on the results.   Look at the original circuit the smallest resistor is 10k and the next is 10.8k.   If the gate impedance is 0.4k  then the resistances are really 10.4k and 11.2k.  So ratio has gone from 10.8/10 = 1.080 to 11.2/10.4 = 1.077.   Whereas if you used 100k resistors the 0.4k impedance has less effect.

If you look at the original design there is a 100k and a cap following the sine-generator resistors.  You would be better off removing the 100k and increasing the sine-generator resistors and connecting the cap to that.   The effective resistance of the filter is all the sine-generator resistors in parallel, and you use that resistance to calculate the filter cut-off.

When you consider resistors tolerance that will determine how accurate you need to go in choosing the resistors.   Also, the first two smallest resistor are more important to get right than the others.

A set of accurate values which:
- allows for 0.4k of gate resistance
- emphasizes accurate of the smaller valued resistors
- raise the impedance of the resistors so the 100k filter resistor can be removed.

7 resistor: 180k, 100k, 75k, 68k+1k2 in series, 75k, 100k, 180k
8 resistor: 300k, 100k, 68k, 56k+1k6, 56k+1k6, 68k, 100k, 300k

Unfortunately I can guarantee these are *the* best resistors possible.   In the past I wrote elaborate programs which searched all the resistor combinations to find the best ones.

QuoteCan I use one section of the 4093 on your circuit?
Yes, any inverter is fine.

QuoteAnother question. Are the 4040 divider outputs square wave? If so can I use those outputs as square wave sends? On the original schematic a switch is used to select the octave. I'm thinking about feeding the output of each octave into a channel of a virtual ground mixer to level them out.  Can that work?
Yes, they are square.

Remember that the sine generator section divides by 16 so the correct tap for octaves need to be 4 Q outputs higher in number to match the sine frequency.  When you switch the sine octave-switch technically that means you should shift-up all those taps to make them keep same relative pitch to the sine.    If you want to preserve the pitch of octave relative to the sine you would be better off having a second 4040 driven by the same clock going to the sine-generator and leave the*single* switch for the clock like it is now.

Another perhaps smaller point is the sine generator requires the shift register to be initialized to all zero's or all ones.  Then once that happens the initial pattern square pattern cycles around the registers (inverted each pass).   Since you have square-wave  generators available there is another form of the digital sinewave generator where a square-wave is fed into one end of the shift register (the Din) and allowed to fall off the end.   This method is more robust since the square wave on the input is replenished all the time.  In the existing method once the shift register bits are corrupted the junk pattern keeps cycling around.  If the registers don't reset cleanly at power-up the junk (non square-wave) cycles around from the start.

You can see the subtle difference here where the shift register and divider are separate,

https://www.eeweb.com/wp-content/uploads/articles-app-notes-files-create-sinusoid-1299214389.pdf

You would need to consider how to implement the switching of the sine octave and you octave outputs with this new scheme.    I'm just mentioning it in passing.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Ben N

Quote from: RGP on June 07, 2023, 11:42:15 PM
What I'm trying to do is use Marcus' E&MM Harmony Generator clone as a master tone generator for a guitar synthesizer I'm designing. The tone generator would have sawtooth, sine and square wave outputs to simulate other musical instruments.     
You should probably have a look at https://www.diystompboxes.com/smfforum/index.php?topic=122086.0, then.
  • SUPPORTER

RGP

Rob. Thanks for all that info.  :) I'm not even sure if what I want to do is possible at this point, but I'm determined to make it work. The square to sawtooth wave converter I'm hoping to use is from R.G. Keene's harmony generator he posted here quite a while back. He used a circuit from a console organ that I'm familiar with. Early on in life I worked part time repairing console organs and came to really admire what they were capable of producing using simple passive filters to emulate instrument voices. 
   Another option for converting the square to sine is a ramp to sine converter that uses resistors and diodes, but I'm not sure what the difference is between a square and ramp wave, but I'm guessing a ramp wave has a shorter time period. I think the 4015 based converter is the better option. I'll read that app note you posted a link to carefully to gain a better understanding of it.
   Ben. Thanks for the reference you provided. as well. I looked at it once before, a year or two back, I think, but couldn't quite grasp all the techincal aspects at the time. I'll take a closer look now.             

Rob Strand

QuoteRob. Thanks for all that info.  :) I'm not even sure if what I want to do is possible at this point, but I'm determined to make it work.
I kind of gathered that but I put it up FYI.

The 8-tap values schematic I posted earlier aren't too bad anyway.   Technically the 120k should be 130k but when you consider the gate resistance the difference is almost non existent.  The "better" resistors I posted later can shave off about 7 to 10 dB off the 3rd and 5th harmonic but they are already pretty low with the original circuit.   If you consider mixing in other "nastier" waveforms the purity isn't a big deal anyway.  (I didn't check the previous 7-tap versions although I know the values I posted won't be bad and would compete with the 8-tap.)

Quote
Early on in life I worked part time repairing console organs and came to really admire what they were capable of producing using simple passive filters to emulate instrument voices
I admire all those filters in the old organs too.  Someone did a lot of brain twisting to get those.    I always wonder what process they went through to get there.

QuoteAnother option for converting the square to sine is a ramp to sine converter that uses resistors and diodes, but I'm not sure what the difference is between a square and ramp wave, but I'm guessing a ramp wave has a shorter time period. I think the 4015 based converter is the better option. I'll read that app note you posted a link to carefully to gain a better understanding of it.
That would work.  Some of the decision points between one and the other are a fairly fine line, perhaps coming down to exactly what you want to do.   FYI with different resistor values you can actually create a nice triangle off that shift register (or other waveforms).   I'm not suggesting feeding that triangle waveform into a shaper.  I'm just saying you could create an alternate waveform off the sine-generator which you can select from a switch: then you have square, triangle, sine.

The app note is just a more robust way of doing the same thing.  You would only consider it if you have the extra divider at the input floating around for free.  (sort of FYI)
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

RGP

Rob. I'm sticking with the 8 tap and updating to the resistor values you posted.  ;) Thanks for letting me know the sawtooth conveter should work. Those old gents designing the console organs really had their act together in my opinion. You mention the 3rd and 5th harmonics being a bit weak. Are you refering to the 3rd & 5th intervals or the upper octaves? If its the intervals you are mentioning is there any way you can think of to boost their levesl? Oh, and that reminds me of a question I've had about the harmony generator. Can the 3rd and 5th be used together or only one at a time?
  On my harmony generator clone I'm only using the subocatve, unison,1 & 2 octaves above because few instruments are above that range. My next step is to develop circuits to emulate instruments and I'll need a trigger and gate for envelope generators. On Marcus' string pluck detector can I tap off between the diode and 555 timer trigger input for my trigger? Would I need some sort of buffer for said trigger tap? I'm thinking I'll need to add a guitar to gate circuit onto the AMS100, but not sure where to shoehorn it in. Any suggestions?
   I really appreciate how much help you've been giving to me on this project. I need to start posting schematics soon. How do I go about that?         

Rob Strand

Quote from: RGP on June 09, 2023, 01:50:07 AM
Rob. I'm sticking with the 8 tap and updating to the resistor values you posted.  ;) Thanks for letting me know the sawtooth conveter should work. Those old gents designing the console organs really had their act together in my opinion. You mention the 3rd and 5th harmonics being a bit weak. Are you refering to the 3rd & 5th intervals or the upper octaves? If its the intervals you are mentioning is there any way you can think of to boost their levesl? Oh, and that reminds me of a question I've had about the harmony generator. Can the 3rd and 5th be used together or only one at a time?
The resistor affect the purity of the sine wave.  The 3rd and 5th harmonics I was talking about are the harmonics in the sine wave.  You can think of these as small levels of distortion of the sine-wave. 

All the divider outputs are square and of equal level.   You can do what you like with those without any special considerations.


Quote
  On my harmony generator clone I'm only using the subocatve, unison,1 & 2 octaves above because few instruments are above that range. My next step is to develop circuits to emulate instruments and I'll need a trigger and gate for envelope generators. On Marcus' string pluck detector can I tap off between the diode and 555 timer trigger input for my trigger? Would I need some sort of buffer for said trigger tap? I'm thinking I'll need to add a guitar to gate circuit onto the AMS100, but not sure where to shoehorn it in. Any suggestions?
Yes, that point is a good place to tap off.   To get a clean trigger you can connect an inverter (or two inverters in cascade) to that point.   The trigger at the NE555 input is a negative going pulse, approx.  So one inverter will convert that to a positive pulse.   With the 10k and 10n parts the trigger pulse width is about 40us (0.4*R*C) as seen by the NE555.  A CMOS gate will see a little longer than that, say 70us (0.7*RC).

You might even be able to take the outputs off the existing 4093's.   Points along that part of the circuit have different timing but it might still be usable provided you get the pulse polarity correct.

Quote
   I really appreciate how much help you've been giving to me on this project. I need to start posting schematics soon. How do I go about that?       
No problem.   To be honest there's a lot of other people here that play with these types of pedals more than me.

Below the text box when you post is an "Add image to post" button.  You can use that to attach images - it actually automatically links to the real image and puts a thumbnail in the post.  The service has been a little unreliable lately if it doesn't work try again later.   (It might be wise to copy and paste your post text into a document and save it on your computer, just in case something goes bung.)

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

RGP

Rob. You may have seen Ray Marston's ramp to sine wave converter circuit that I mentioned before. This circuit seems too simplistic to actually converet to a sine wave, but if Ray based the circuit on old console organ circuits it may indeed work. What I'm wondering is can it convert more than one frequnecy being fed into it. I think I may have posted this, but I'm not sure if it worked.   


RGP

Ah, good the image is there. Maybe this simple approach may workm but I have my doubts that it will work for multiple frequencies. What about dupicating it for each octae I'm using?   

PRR

#156
There's no frequency-dependent parts in that (except the opamp will struggle above the audio band). In concept it works "to DC". (And is much older than Marston: I've seen it with vacuum diodes, maybe in Korn&Korn?)

The drawback is that the waveform has glitches, high harmonics, which are easy to hear. The classic analog synths used BJT diff-amps which are smooth to a point, but that point never goes away. The diode-thing is often used in function generators to make a perfectly good sine-like wave.
  • SUPPORTER

PRR

Ahhh.... and these techniques start from a TRIANGLE wave, not a RAMP.

PAIA-guy John had a 50 cent trick for making a ramp (the easiest wave) into a triangle, but it was fussy and glitchy. Basically a BJT "cathodyne" overdriven so half of the wave was inverted and the other half just bled-through raw.
  • SUPPORTER

RGP

Hello PRR. I've read many of your posts and really learned a lot from them. You have a talent for explaining things that makes it easy to understand. Thanks much for that. The Marston circuit is calling for a ramp wave at it's input. Could a square wave work for his circuit?

ElectricDruid

Quote from: RGP on June 10, 2023, 02:09:45 AM
The Marston circuit is calling for a ramp wave at it's input. Could a square wave work for his circuit?

No! Absolutely not!

It works by taking a linear shape and applying carefully calibrated distortion to it (what we'd call soft clipping) to turn the waveform into a sine. I *know* it say "Ramp" by the input, but I agree with PRR that what it *actually* wants is a triangle wave.
If you put a square wave into it, you'll get something very much like a squarewave out as well.
The circuit will convert any *frequency* you feed it, since it's just applying distortion, so it's not fussy about that. What it *is* fussy about is *amplitude*. If the input signal isn't exactly the right level, you'll either get not enough distortion or too much, and the output won't be a sine wave. That means that these kind of circuits are pretty good added to a basic VCO core to provide more waveforms where you have a fixed output level, but they don't work in all situations.

Turning a ramp into a triangle wave isn't hard - you just feed it through a full wave rectifier.

I've got some examples of this sort of stuff in a synth context over on my site, if you're interested:

https://electricdruid.net/a-study-of-sub-oscillators/