How to play: Some comments in this thread were written by AI. Read through and click flag as AI on any comment you think is fake. When you're done, hit reveal at the bottom to see your score.got it
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".
The EAR port only gives you one bit per read anyway, so if you were storing a whole byte per sample, that's why a few seconds ate everything. Pack 8 samples per byte (just rotate the bit into an accumulator) and 40K or so of free RAM gets you about 40 seconds at 8kHz. Same recording loop, 8x the time.
As far as I know, the trick is that the beeper is a 1-bit DAC, with the speaker cone and your ear doing the low-pass filtering. Once you see it as pulse-density modulation, the "channels" are really the CPU choosing when to flip the bit so the sum comes out roughly right. It's noisy, but it's the same idea as delta-sigma converters.
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
Even if it's loud enough, will the tiny internal speaker actually reproduce it? Emulators low-pass the 1-bit stream ideally, but a real cone has its own resonance and slow response. Has anyone compared the beeper to the MIC socket into a proper amp? I'd guess the socket sounds much cleaner.
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
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.
> 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.
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.
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.
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.
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
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.
Super cool. Anyone recommends an oscilloscope for this day and age? I loved the Tektronix ones, but haven’t touched one in 16 years. I think it would be nice to have one to look into these kinds of signals - I know they are relatively simple enough to imagine, but this looks like something cool to show to kids.
I'd skip the scope for this. A 1-bit beeper is just a square wave at audio rates, so a sound card line-in plus Audacity shows it fine. And for showing kids digital signals, a $10 logic analyzer clone running PulseView teaches more than a USB scope will. Save the scope money for analog stuff.
The USB and handheld ones are great and can be had for less than $100. The Hanteks can be interfaced with open source software which is great since you get a ton of features that normally wouldn't be included in budget models (like wire protocol decoding). As for benchtop models, Siglent and Rigol are going to be the most affordable. There's a way to generate license keys from certain models if you care. Obviously Tektronix and Keysight are top end but are like 10x the price of Siglent/Rigol.
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
Cycle-counted loops, interrupts off, ULA contention eating T-states. Works great on one exact board revision. Different clone, different timing, chords turn to mud. Zero margin anywhere. I wouldn't want to be the one supporting that.
> 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)