Why does music synthesizer built from chain of astable multivibrator circuits get "out-of-tune" after a few hours?
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:
- Changes to the voltage level of the power supply to oscillator.
- Changes of the Vbe level of the transistors with temperature.
- Changes of the values of resistors over time and temperature.
- Changes of the values of the capacitors over time and temperature.
- Changes in capacitor dielectric characteristics in astable oscillator configuration.
- Stray circuit behavior changes due to things nearby the prototype.
- 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.
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
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.