I kinda understand how relatively low voltage could mean lower pitch or slower speed, but I don’t get how some videos of low battery toys show them getting loud and/or crunchy and distorted.
When you look at an audio signal in the time domain (plotting amplitude vs. time), it goes up and down around your ground state – generally in fairly smooth motions. For example, if you had a pure single frequency, it would look like a sine wave.
However, you can also look at an audio signal in the frequency domain (plotting amplitude vs. frequency vs. time). Think of an equalizer, with those bars representing how loud the signal is in each frequency band.
These are just two representations of the same data, so they can be transformed back and forth from one another depending on how you want to look at the audio signal.
The way the math works out, the smoother the curves in the time domain the lower the frequencies are. Conversely, the sharper the curses in the time domain, the higher the frequencies.
For example, if you limit your audio signal to chop off all of the high amplitudes (such as would occur with a powerful amplifier driving a weak speaker) you get distortion because instead of those smooth curves at the top you get a sharp discontinuity where you limited the amplitude. This distortion of the wave form is what causes audible distortion in what you hear.
Likewise, if you don’t have sufficient voltage to drive the waveform to the limits of what is intended by the audio signal, the wave will distort in the same fashion to introduce unintended frequencies.
Note that voltage on the microcontroller or the clock will (normally) have nothing to do with what you’re observing. Microcontrollers are fed by voltage regulators which maintain a constant voltage until they cannot – at which point the microcontroller simply shuts down. Clock crystals will change their timing under different voltage conditions, but the clock timing isn’t particularly relevant when your digital electronics are shut down.
So what you’re undoubtably observing is a situation where there is sufficient voltage to operate the electronics properly but insufficient voltage to power the amplification for the audio output. You can observe the same phenomenon even with purely analog devices that produce sound.
The [running dooooownnn] sound is back from when toys used tiny records and record players in the voice/sound box. As the batteries dies, the motor turning the record slows making the slower lower pitched sound.
In movies it’s just sound added with that effect in post production. Because [skibbrodulph screeek beee shhhhhhh] doesn’t tell the audience “battery is low”
In real life with electronics, you will indeed get goofy behavior as power dies but it’s usually distortion, odd random sounds, etc. but not the [slooooooowwwwwwrrrr] movie trope sound.
The microcontrollers that run those toys are controlled by oscillators (clocks) that need to be ran within a fairly strict battery voltage range or else they perform erratically. Similar to if you were jogging and the ground started getting softer until you started missing steps and stumbling. Some of those ‘steps’ involve playing digital sound files so the sound distorts, like a digital version of a record skipping.