ZX Spectrum: Experimenting with 1-Bit Sound

Posted by ibobev 7 hours ago

Counter87Comment26OpenOriginal

Comments

Comment by mdp2021 6 hours ago

I hope everybody knows Tim Follin - or will now come to know his genius.

> Agent X ( https://www.youtube.com/watch?v=T42WuUpBuHE ) or Agent X II ( https://www.youtube.com/watch?v=gNc_xczyGLc ) or Chronos ( https://www.youtube.com/watch?v=u-D24A_N4d4 ) or Raw Recruit ( https://www.youtube.com/watch?v=kl8dAVybwq8 ) or Future Games ( https://www.youtube.com/watch?v=orEXKOBIv_8 )... // A modern attempt, the ON and OFF album by Rich 'Tufty' Hollins ( https://www.youtube.com/watch?v=4nEfO4Yu7Mg )

(Repost originally for submission Furnace - the biggest multi-system chiptune tracker ever made https://news.ycombinator.com/item?id=41609254)

Comment by robviren 3 hours ago

It's just Pictionary Tim! He got even crazier when they gave him more than a single system beeper.

Silver Surfer (https://m.youtube.com/results?sp=mAEA&search_query=silver+su...) Pictionary (https://m.youtube.com/results?sp=mAEA&search_query=pictionar...)

Comment by thatmf 4 hours ago

Wow, that Chronos track is like early My Bloody Valentine!

Comment by asdefghyk 5 hours ago

I recall, One bit sound was detailed extensively in Byte Magazine starting in mid 70s. A square wave that has its frequency varied. A google of the words " Generating speech with a square wave wave , Byte magazine " picks up lots links about this technique. Fourier transform show a square wave consists of odd sine wave harmonics. [A more advanced technique (more than one bit) would use microprocessor interrups to generate several sqare waves, output them with more than one IO pin and combine them with a resister network]

This mention of one bit sound made me remember the Lis’ner 1000 project of Steve Ciarca , cira 1984 , WHICH WAS speech recognition system of about 30 words. It used a GI SP1000 chip

Comment by feintruled 6 hours ago

The article ends to a link to a video that shows off the technique and it blows my mind the Spectrum beeper could produce this: https://www.youtube.com/watch?v=7cOu32m3wvQ

Comment by Dwedit 8 minutes ago

Turns out that it's actually 2-bit and not 1-bit. It uses a combination of the EAR and MIC jacks, and when you output through the MIC jack, it slightly boosts the EAR jack. That gives you 4 possible levels, but they are not evenly balanced.

Comment by gxd 6 hours ago

I created a program like that back in the day. In my case, I recorded my voice through the "MIC" input and played it back through the TV. A few seconds of sampled audio required the entire available memory. While I fully understood what was going on, I thought it was magical that the Spectrum could "speak with my voice".

Comment by MichaelRo 2 hours ago

On ZX-Spectrum? There was no "MIC" input on ZX-Spectrum, not that I know of. I was in high school at the time with only a rough understanding of the hardware but it was kinda obvious to me that whatever I plugged into the casette input port was only read as "0" or "1" by the IN <port> (forgot which) instruction. So not really possible to record voice at the time (didn't even know of PCM anyway), but I tried to decode Morse transmissions from radio. Never got anywhere with the software but my ear got good enough at some point that I could decode them myself by hearing :)

Comment by louprado 6 hours ago

More mind blowing, that entry took _second_ place! First place would probably break my brain for the day so I won't look it up.

Release party: DiHalt 2026 summer Compo: Demo Platform: zx spectrum Ranked: 2nd

Comment by codazoda 6 hours ago

Sounds pretty good. Reminds me of the Demo Scene and the types of music they were able to create.

Comment by MichaelRo 3 hours ago

I gotta try this on real hardware, reading the original article it seems it's barely audible without an amplifier, unlike on an emulator.

Will post an update after I get back to my parent's home, where I have these beauties that launched me into computer science: https://imgur.com/a/GKrA0vX

Comment by khedoros1 3 hours ago

> My previous work with PWM relied on being able to set a hardware timer to control when the speaker turns on and off.

I've got an Arduino project where I did that. The output is on a single digital pin, audio encoded as PWM. It turns the output off at the beginning of an audio frame, and sets a timer to trigger an interrupt when it's time to turn the output on.

I've got a memory block of event structs, each event representing a write to NES sound hardware. I emulate enough of the features to support everything that the Legend of Zelda title theme uses. 16MHz is more than enough to decide on the sample for 2 square channels, 1 triangle, and 1 noise, outputting a 6-bit output sample at a 31250Hz sample rate. The output is only slightly scratchy; the polyphony is actually surprisingly smooth.

Comment by sehugg 2 hours ago

I did a PWM demo on the Apple II using a format similar to the DPCM samples on the NES. Those samples have a pretty simple format: a 1 bit raises the amplitude, a 0 bit lowers it. So you're kinda approximating the waveform with a bunch of triangles.

The NES has a 7-bit DAC, but since we're bit-banging with the CPU we only have enough time between samples for about 13 levels. Each level has its own toggle-wait-toggle-wait routine, and then we shift another bit and decide whether to branch to the next (level+1) routine or the previous (level-1) routine.

https://8bitworkshop.com/v3.12.1/?platform=apple2&file=delta...

Comment by gwbas1c 4 hours ago

> multichannel sound through the 1-bit speaker—basically, playing chords.

Ahem, that's polyphonic sound, not multichannel sound. Multichannel sound is playback through multiple speakers.

Comment by ssl-3 2 hours ago

Perhaps. I think these words have somewhat flexible definitions, and that thought process leads me to some rhetorical questions.

Questions like: How many channels can a mod file[1] have? Does that number of channels this file has change depending on whether it is being played back with monophonic or stereophonic (or some other arrangement of) speakers? What happens to the count when one or more individual samples within that mod file contain polyphonic data (chords!), themselves?

It also leads to rhetorical statements, such as: When I play a film that has a soundtrack with 8 (ie 7.1) discrete audio channels on a stereophonic pair of speakers with a sane playback chain, I'm definitely still hearing all 8 of those channels. The same happens if I extend that stereophonic system to greater number of output channels, by adding surround speakers (quadraphonic!) or whatever.

Or maybe I take one earbud out and put it back in its charging case, and through the magic of active electronics, good software, and wireless comms, the output deliberately collapses to being monophonic.

However it happens, I've still got an 8 channel of film soundtrack in my ear(s).

And of course, it also works the other way: If the electronic musical keyboard in front of me is said to support 10-voice polyphony, then that's a hard limit on the number of notes it can produce at once regardless of the number of audio output channels.

Multichannel and polyphonic are pretty bendy terms, I think. Maybe that flexibility was wrong at some point, but they've been flexible in this way for so many decades that it definitely seems right to accept the overlapping uses as being correct.

[1]: https://en.wikipedia.org/wiki/MOD_(file_format)

Comment by geori 6 hours ago

Reminds me of an experiment that we did with TI calculators in the late 90s. Someone found that you can put an AM radio next to the calculator and it would beep based on what instructions were run on the Z80. There were some demos that played songs via 1 bit beeps like this, but since games actually have to run instructions, you couldnt reliably play background music during gameplay.

Comment by Dwedit 1 minute ago

I was one of the people who added sound into a TI83 game. It ended up in my IceClimb game. Not particularly well done or anything, it's just there. I also didn't properly adjust the timing as the notes got higher, so it plays faster when you get higher in the level.

Comment by fallat 6 hours ago

People may enjoy this too https://www.youtube.com/watch?v=_6f8PURcPEE

End result of it playing 1-bit music: https://www.youtube.com/watch?v=IjTihhFG03o

Comment by bezko 6 hours ago

Turns out 1-Bit encoding is the most efficient solution, even for the highest end of audio quality: https://en.wikipedia.org/wiki/Delta-sigma_modulation

Comment by adrian_b 4 hours ago

Depends on what you mean by "efficient".

Delta-sigma modulation generates an inefficient encoding of the audio signal, with much more bits than necessary.

Converting a delta-sigma encoded bit stream to a PCM (pulse-code modulation) stream (e.g. with 24-bit or 16-bit samples at a sampling frequency of 48 kHz or 44.1 kHz) is a method of data compression.

On the other hand, delta-sigma modulation is more efficient for both analog-to-digital and digital-to-analog conversions, in the sense that for a given quality of the conversion it is much easier and much cheaper to make ADCs and DACs with delta-sigma modulation than with pulse-code modulation.

Because of this, for audio signals, normally delta-sigma ADCs and DACs are used at the analog inputs and outputs, but the delta-sigma bit stream is converted by digital filtering to PCM for data storage or for audio processing.

Comment by dreamcompiler 1 hour ago

Delta-sigma is not a compression technique. A good delta-sigma encoder will use roughly the same number of bits as a PCM encoder. Delta-sigma uses more samples per second but fewer bits per sample to capture the same information. The reason delta-sigma is desirable is noise shaping, not compression.

An ADC that merely samples much faster than Nyquist but with the same number of bits per sample as PCM is not a delta-sigma converter; it's an oversampler. Delta-sigma converters always sample faster and use fewer bits per sample (usually just one bit per sample).

Comment by _def 6 hours ago

Comment by alienbaby 6 hours ago

Some apparent links don't appear to work at the start of the page, and I couldn't see any links to listen to the output?

Comment by elpepo 4 hours ago

Another incredible 1-bit sound demo for ZX Spectrum in just 9KB from Dmitry Milk:

https://www.youtube.com/watch?v=98PJFIIJDiA

https://speccy.pl/archive/prod.php?id=833

Comment by virgil_disgr4ce 5 hours ago

A friend of mine built his entire career as a composer around 1-bit music (famously in the form of an album that is physically a circuit inside a jewel case) https://www.youtube.com/watch?v=dBUVKNqdsEo

Comment by Zardoz84 6 hours ago

It would be interesting if someone could implement or adapt Roman Black's BTC algorithm to model the Speccy beeper. https://www.romanblack.com/BTc_alg.htm