50
\$\begingroup\$

I built a prototype keyboard/sound synthesizer using a chain of 13 astable multivibrator circuits whose outputs are connected to an audio amplifier chip (LM386) and speaker, all powered off a 9V DC battery.

Each individual circuit gets tuned to one of the 13 frequencies in a musical octave (C5, C#, D, etc. up to C6) by varying a fine-tune trimpot that is in series with specific resistor values and which get the oscillation into the ballpark frequency.

The oscillation is the classic BJT astable multivibrator you can see in Figure 1 here and which is explained in this article.

The prototype stays correctly in tune for a short period (up to a day).

You can hear what it sounds like here. (Safe to start at 0:49s -- Wadsworth's constant ;) )

What I can't figure out is why the circuit appears to get spontaneously detuned, i.e. one or more of the individual circuits end up with frequencies that are different from what they were tuned to (checked against an o'scope and a reference piano).

The frequency deviation of the detuning is typically 2-5%, which is audibly noticeable (e.g. C5 at 523Hz might wander to 540Hz or 510Hz). Interestingly, the detuning never occurs while playing. But several hours afterwards, the keys no longer sound the same.

I had originally thought maybe the trimmer pots were mechanically relaxing by themselves. To eliminate this I replaced the trimmer pots to try to "lock in" the specific frequencies based on resistor values alone so that no variability was left in the design.

But the de-tuning problem persists even after replacing the trimpots with fixed resistor values.

Before: 13-key analog synthesizer with fixed resistor values Before: 13-key analog synthesizer with fixed resistor values


Resolution: Thanks all for the useful feedback, digital design ideas, and historical context to better understand the challenges of a pure analog design. All the answers were excellent. I've accepted ToddWilcox's answer as I get from it that (a) detuning is an expected part of pure analog designs, (b) the artistry lies in how to establish a slick way of tuning the instrument quickly.

To solve the immediate problem, I've put trimmer pots (1-2K ohms) back in the design to give 2-5% tuneability to each key. It takes a couple of minutes at the start of playing to tune up the 13 oscillators, after which they stay in tune for several hours at a time. See new image below.

Will post the results of the experiments using wall-wart, fresh batteries. The digital designs (using digital divider and/or 555 timer chips) are interesting, and would potentially compress the size significantly. Future updates can be found at the project page here.

After: 13-key analog synthesizer with trimmer pots (1-2k ohm) for tune-ability After: with Trimmer Pots added in for tuneability

\$\endgroup\$
  • 3
    \$\begingroup\$ Please show your circuit schematic. \$\endgroup\$ – Michael Karas Feb 7 at 9:13
  • 12
    \$\begingroup\$ What dielectric are your capacitors and what's the temperature coefficient of your resistors? \$\endgroup\$ – Colin Feb 7 at 9:26
  • 25
    \$\begingroup\$ Now you know why the music industry went digital! But even before then, frequency was determined by crystal oscillators which provide much more stability that CR time constants \$\endgroup\$ – Dirk Bruere Feb 7 at 10:54
  • 32
    \$\begingroup\$ I do like how the wires (blue) makes the breadboards look like sheets of quarter notes. \$\endgroup\$ – Stian Yttervik Feb 7 at 14:26
  • 2
    \$\begingroup\$ What happens when you change the battery after the system went out of tune? What happens if you put it away for a couple of hours? \$\endgroup\$ – Mast Feb 8 at 18:31
33
\$\begingroup\$

What I can't figure out is why the circuit appears to get spontaneously detuned, i.e. one or more of the individual circuits end up with frequencies that are different from what they were tuned to (used an oscope, and then a reference piano).

Temperature changes, as mentioned in the other answer.

I'm adding an answer here because, as a musician, I prefer the sound of oscillators that are 100% analog over a design based on:

a circuit that uses as single higher frequency oscillator based upon a close tolerance crystal. Then the use of digital counters are used to divide this frequency down to the desired frequency for each note in the scale.

EEs on this Stack might comment endlessly that I scientifically couldn't be able to hear the difference. Believe me when I say my wallet dearly wishes that I couldn't hear the difference, but I can, and it's not subtle.

Anyway, major 100% analog synth manufacturers such as Moog Music and Sequential Circuits (formerly DSI) have solved this problem in different ways over the years. The old-school solution requires user intervention and frequent tuning. The original Moog Minimoog (AKA "Model D" after its most popular variant) had a crystal oscillator circuit built in that was not part of the signal path, but would create a stable 440 Hz tone. You turn on the 440Hz crystal tone, then play an A on the keyboard, and then turn the Master Tuning knob to re-tune the synth by ear. This was practical because the Minimoog was/is (it's been reissued with some technological improvements) a monosynth. Once you've tuned the bank of three oscillators all together, you're done. The Minimoog also has several adjustment trim pots to calibrate it to the various control voltages, which includes the ability to make sure the different oscillators are in tune and track with each other.

The Sequential Circuits Prophet 5 is a different thing. All of the audio generation and signal path are analog and prone to drift, and in a way, a similar process is used as to the Minimoog for tuning, but instead of the user listening to a crystal oscillator tone and manually tuning the analog oscillators, the Prophet 5 featured microprocessor controlled automatic tuning calibration. According to one source, tuning took about 15 seconds after the Tune button was pressed.

One reason why an automatic tuning system was necessary for the Prophet 5 was that instead of being a monophonic 3 oscillator synth, it was polyphonic with 5 voices of 2 oscillators each, for a total of ten oscillators. As drift could happen in the middle of a show, a fairly quick way to re-tune the synth was required to make it useful to musicians.

So, what I'm suggesting is if you are building your own oscillators in order to get that 100% analog tone, you'll want to come up with some tuning mechanism. You also might have to play with oscillator designs to try to make them as thermally stable as possible.

If I were heading down this road, I would start with the Moog method and make sure I know how to design a master tune knob that I can use to quickly re-tune the synth and work to get a design that is stable for at least an hour in a typical home room. Then I might look at "graduating" to tacking on a microprocessor that can electrically compare the oscillators to the reference crystal and automatically adjust the tuning knob.

Today, both Sequential Circuits and Moog Music have real-time microprocessor-controlled tuning adjustment in the Prophet 6 and Model D Reissue products, and Sequential even offers an additional control which lets you control how well the microprocessor maintains the tuning, to get some vintage-style oscillator drift in the sound.

More about the Prophet 5 design

One way the oscillators for the Prophet 5 were made more stable was by using analog integrated circuits that had as much of a complete oscillator as possible on one chip. That meant that all the components on the chip changed temperature together (at least closer together than discrete components).

There was also "on-chip temperature compensation circuitry". I'm not sure exactly what that involves, but my guess is that it's circuit design that uses on-chip components to make actual voltage drifts due to chip temperature "cancel out", as much as possible.

Page 2-19 of the Prophet 5 Service Manual is very interesting on this topic: https://medias.audiofanzine.com/files/sequentialcircuitsprophet-5servicemanual-text-470674.pdf

And I found an interesting paper on analog temperature compensation circuit designs for crystal oscillators: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.11.2410&rep=rep1&type=pdf

\$\endgroup\$
  • 3
    \$\begingroup\$ @EdgarBrown If you can make a digital system that sounds as good as the analog ones, people will pay through the nose for it. So far the best digital recreation of analog I've heard is the Kemper Profiler amplifier products. To be fair, there are many live situations where digital modeling is used extensively or exclusively. In a live show, it's hard to hear the top 5% - 10% of quality, so reliability and flexibility wins out. But when you really want to have the sound, there's almost always only one way to get it. \$\endgroup\$ – Todd Wilcox Feb 7 at 16:54
  • 3
    \$\begingroup\$ @EdgarBrown Also interesting how people are often less surprised that we can't recreate Stradivarius violins or vintage Martin guitars with modern technology, but are more surprised that we can't recreate a 1974 Minimoog or a CS-80. I don't really know why there's a difference in perception there. DSP isn't analog in the same way that modern American maple trees are not 17th century Italian maple trees. \$\endgroup\$ – Todd Wilcox Feb 7 at 16:57
  • 3
    \$\begingroup\$ Not a synth exactly, but the Mellotron is another interesting example of this. It operated by playing back long spools of tape, each one note recorded from an instrument (such as a flute), and pressing multiple keys could create enough of a load on the motor to slow it down and detune the notes. Attempts to tune it were often difficult, and Robert Fripp even said "Tuning a mellotron doesn't." \$\endgroup\$ – esilk Feb 7 at 17:07
  • 3
    \$\begingroup\$ @ToddWilcox in the end, it comes down to "which exact serial number of Minimoog do you want to recreate accurately." Analog instruments like these all sound different from each other, if your ears are good enough and you care about such things. But then, you can recognize individual Strad violins from their different sounds, as well! \$\endgroup\$ – alephzero Feb 7 at 17:30
  • 2
    \$\begingroup\$ @ToddWilcox - fascinating about the pure analog designs and how each approached the need for tuning. Ok, so I will put the tuning pots back in for now, and think about how to make that slicker (tuning the 13 oscillators individually takes a few minutes, but requires multiple passes, and is not a great user experience). Thanks for sharing the details! \$\endgroup\$ – Assad Ebrahim Feb 7 at 20:33
40
\$\begingroup\$

You have clearly built a circuit that is fully analog in nature and produces a frequency in each oscillator that is dependent upon various factors such as:

  1. Changes to the voltage level of the power supply to oscillator.
  2. Changes of the Vbe level of the transistors with temperature.
  3. Changes of the values of resistors over time and temperature.
  4. Changes of the values of the capacitors over time and temperature.
  5. Changes in capacitor dielectric characteristics in astable oscillator configuration.
  6. Stray circuit behavior changes due to things nearby the prototype.
  7. Position of the moon relative to the sun as viewed from earth.

There are ways to build circuits that do not have as much drift in operational frequency. They are designed to eliminate or cancel out the various effects enumerated above. One conventional way is to design a circuit that uses as single higher frequency oscillator based upon a close tolerance crystal. Then the use of digital counters are used to divide this frequency down to the desired frequency for each note in the scale.

To show the value of a digital circuit approach I created a small spreadsheet that shows the octave of musical notes from C5 through C6. (The nominal frequencies are values taken from a chart found on Google and not computed in the spreadsheet with scale formulas from the A[440] reference).

Using a crystal frequency of 22.1184 MHz (which is a common MCU frequency used in the 8-bit embedded business) you can see that with an integer digital divide factor for each note that the generated frequency is very close to the desired nominal.

enter image description here

\$\endgroup\$
  • 35
    \$\begingroup\$ Feel free to post your own answer. \$\endgroup\$ – Michael Karas Feb 7 at 11:35
  • 5
    \$\begingroup\$ Just love point 7 ! \$\endgroup\$ – kebs Feb 7 at 12:21
  • 4
    \$\begingroup\$ @MichaelKaras -- I recommend making the second significant digit show in purple ;-) \$\endgroup\$ – Scott Seidman Feb 7 at 14:13
  • 13
    \$\begingroup\$ @kebs If you think point 7 is a joke, I guess you never used a fully analogue synth, back in the day - not even a professionally designed one. \$\endgroup\$ – alephzero Feb 7 at 17:17
  • 4
    \$\begingroup\$ @MichaelKaras your "correct" frequencies are only correct to two decimal places. Of course that is more than good enough for tuning the notes, but it has a big effect on your percentage error calculations. It doesn't change the overall story you are telling in the post, though. \$\endgroup\$ – alephzero Feb 7 at 17:20
10
\$\begingroup\$

Yet another factor which has not been mentioned is the fact that the circuit is battery-powered.

Since you are driving a speaker, power consumption will be significant (as evidenced by your use of an LM386), and a 9-volt battery will experience significant voltage drop over a period of several hours. Supply voltage is another factor in determining the operating frequency of your oscillator.

Try replacing your battery with a 9-volt wall-wart and see what happens.

\$\endgroup\$
7
\$\begingroup\$

Answer: detuning occurs due to parts characteristics changing due to heating, temperature change, etc. You can minimize that by putting them in a temperature controlled chamber, and letting it stabilize before using it.

I did the same thing here using a microcontroller to create the 13 tones.

https://www.youtube.com/watch?v=4c8idXN4Pg0

I only had 8 buttons when I did the demo. I used a PC self powered speaker to play them back.

The tones are created at the microsecond level of accuracy. And since they are based on a 16 MHz crystal clock source, they don't drift.

The uC, Atmega1284P, has 32 IO, so 13 buttons and 13 outputs are directly supported.

Want more notes? Add another processor and change the array containing the half-periods of the tones.

Don't like the basically square-wave tone? Add filtering to the outputs.

\$\endgroup\$
  • 2
    \$\begingroup\$ This doesn't really address the question. While it is in fact correct that a 16 MHz clock source with minimal drift, combined with a digital system, prevents this issue, it does not discuss why this detuning occurs in the analog system detailed in the question. \$\endgroup\$ – Andrey Akhmetov Feb 7 at 15:04
  • 1
    \$\begingroup\$ Updated the answer. \$\endgroup\$ – CrossRoads Feb 7 at 15:43
  • \$\begingroup\$ Very cool demo! The polyphonic capability is neat. And the tones sound very nice compared to the basic square waves in the above. What kind of filtering did you use? \$\endgroup\$ – Assad Ebrahim Feb 8 at 9:16
  • 1
    \$\begingroup\$ Basically none. Outputs go thru 1uF cap to make them +/- 2.5V, then thru a resistor for the analog mixing. If you search "piano tones micros" in the Arduino forum, the topic will pop up, and there is a schematic there. I cannot access the site from where I'm at, or I'd post it here. \$\endgroup\$ – CrossRoads Feb 8 at 13:00
  • \$\begingroup\$ Schematic of my design is here forum.arduino.cc/index.php?topic=179761.0 Here's the picture forum.arduino.cc/… \$\endgroup\$ – CrossRoads Feb 10 at 15:03
5
\$\begingroup\$

The frequency of a typical RC oscillator is controlled by the RC time constant and the amount of "RC decay" required for each cycle. One of the reasons the 555 circuit is more stable than many other kinds of relaxation oscillators is that the ratio of voltages it swings between is relatively unaffected by the characteristics of the transistors involved. By contrast, the astable monovibrator you're using is very sensitive to the turn-on characteristics of the transistors, which are in turn sensitive to temperature.

I would guess that the instrument takes awhile to tune up, and that by the time it is in tune, all of the transistors will have reached equilibrium operating temperature. If one turns the instrument off, the transistors will cool down. If one turns on power and immediately starts to play, they will be colder than they were when the instrument was tuned, but if one waits for the transistors to reach the temperature at which they were tuned, the tuning should get close to what it should be.

Incidentally, the vacuum-tube electronic organ I had growing up used tuned LC circuits rather than RC circuits. The frequency of a tuned LC circuit will be controlled primarily by the values of the capacitor and tunable inductor. If one wants to minimize the number of amplifying components (the organ used 1/2 of dual-triac tube for each oscillator), using LC circuits may be a practical approach, though tunable inductors of suitable size would probably cost more than most chips.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.