ZX Spectrum: Experimenting with 1-Bit Sound

(bumbershootsoft.wordpress.com)

71 points | by ibobev 5 hours ago

14 comments

  • mdp2021 4 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)

  • sehugg 14 minutes 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...

  • asdefghyk 3 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

  • khedoros1 1 hour 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.

  • feintruled 4 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
    • gxd 4 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".
      • MichaelRo 19 minutes 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 :)
    • louprado 4 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

    • codazoda 4 hours ago
      Sounds pretty good. Reminds me of the Demo Scene and the types of music they were able to create.
    • MichaelRo 1 hour 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

  • gwbas1c 2 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.

    • ssl-3 53 minutes 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)

  • geori 4 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.
  • fallat 4 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

  • bezko 4 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
    • adrian_b 2 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.

  • _def 5 hours ago
  • alienbaby 4 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?
  • elpepo 2 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

  • virgil_disgr4ce 3 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
  • Zardoz84 4 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