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
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