Hacker News new | past | comments | ask | show | jobs | submit login
PC Speaker To Eleven (habr.com)
162 points by atomlib 40 days ago | hide | past | web | favorite | 52 comments

The most amazing thing I've heard done with a PC speaker is in the last part of this equally amazing demo (starts at 6:37 --- the parts before have more "normal" beeper music): https://www.youtube.com/watch?v=yHXx3orN35Y

Explanation here: https://www.reenigne.org/blog/8088-pc-speaker-mod-player-how...

To be fair, that whole demo is a technical tour de force. Some more information about it: https://trixter.oldskool.org/2015/04/07/8088-mph-we-break-al...

Holy shit. I've never heard anything even remotely like that from a pc speaker. How the hell did they accomplish that on a 1981 pc?!?!

Disabling interrupts and eating all available CPU in handcoded assembly.

386 can do it with no tricks. And you even have some spare horsepower to dither for improved quality.

I completely agree with you! The tune at 6:30 is the best I heard on PC Speaker!

Although the engineering behind getting a good sound out of the PC speaker is fascinating. Still wishing the PC standard from the get go had included sound as a first class citizen.

I think this decision back then still ripples through the machines today and sound never truly feels like an integral part of the machine on Windows (Realtek audio driver) and you'll never have the feeling of a built in boot sound on your machine which felt so good on Macs till it was disabled recently.

It's not like computers didn't have good sound back then either compare the Lotus III example [0] from the article with the same on the Amiga hardware from around the same time [1]

[0]: https://www.youtube.com/watch?v=72vZ1asBIXQ

[1]: https://www.youtube.com/watch?v=CgGSBoivBIY

"[...]a built in boot sound on your machine which felt so good on Macs[...]"

Ever since I got my first iBook in college I've had mainly negative associations with that sound. Too frequently you'd open the thing in the middle of a lecture with 100+ people in the room and the sound starts blasting. The only solution I found was plugging in headphones so that the sound would go there instead.

As I recall, if you muted the sound before shutting down it would stay muted and not play the startup sound. My Mac experience starts at the white iBook G3 running OSX 10.2 though, so it could be that this behaviour is a new thing.

I now have a 13" TouchBar MacBook Pro and it makes a sound when I plug the charger in no matter what I do to the volume settings. When I have it muted and open I can actually see it unmute the sound so that it can make the charger sound then mute it again when it's done.

Just fyi: I believe (but haven't gotten to try it myself) that this command will turn off the power chime when you plug in a USB-C charger.

  defaults write com.apple.PowerChime ChimeOnAllHardware -bool false;killall PowerChime

I haven't tried this yet, but based on some quick searching it might need some tweaks[0]. This is a pretty easy change to make, so I'll try it out later.

[0] https://apple.stackexchange.com/questions/282752/turning-pow...

You could also press a certain button on the keyboard (I don't remember which) to ensure no boot sound is played. I'm not sure if this feature is still there.

I believe you could hold the mute button to do this. I don't think the feature is there on mine, the TouchBar probably comes on way too late in the boot process.

Yep the muting already worked back then. So it always came down to crossing your fingers and hoping you muted before you left the house.

CoreAudio on the Mac is so good. I've never had to install any drivers for USB or Firewire interfaces and the latency is incredible compared to the same setup on a PC.

There is a niche of 1-bit music using such creative techniques. See also:

1. Mister Beep, from Poland. http://freemusicarchive.org/music/Mister_Beep/

2. Tristan Perich, from NYC. https://www.1bitsymphony.com/

3. Noah Vawter, 1-bit Groovebox: https://web.archive.org/web/20090212172253/http://web.media....

Just like with hit points, one is all you need. Just enough lives. ;) Or in this case, high enough and stable enough frequency.

I remember playing a Golf game called World Class Leaderboard on my 386 and being absolutely amazed by the sound coming out of my PC speaker. It used RealSound to play the sounds of birds on the title screen and realistic golf sound effects and voices during gameplay:


And the original Links (https://www.youtube.com/watch?v=G5TPAxMfpbQ) from the same company. Really nice use of the PC speaker in the intro, as well as the game.

I was about to comment exactly the same thing.

The commentary that still resonates with me even now, is 'He can't be happy with that one!' and the crowd 'ooohs' and 'ahhhs'

Ahh the good old days. I remember writing a program in 6502 assembler that could record and playback a digital sample, all using the speaker on the Apple ][+. I'm not sure if I also connected a microphone or if I just yelled at the speaker.

I believe the max I could record was about 7 seconds before I ran out of memory. But it worked and I was happy and proud. :)

I remember being amazed how i'd spent so many hours coding something that executed in such a short amount of time.

There was an Apple ][ program in an issue of Nibble Magazine that could sample audio from the cassette port, save to disk and play.

Awesome he made his own VSTi available which we can use to make chip tunes plus impulse responses of tiny speakers to give it a realistic sound, and released it all for free!

to learn assembly I wrote a "PC speaker clicker" that just strobed the click register and had a small timing loop to play A440.

A person in the room spoke up when I played it- "that's not A440, it's off slightly. Oh, and I have perfect pitch- it's about 439".

I had a small bug in my timing routine that made the pitch slightly lower, which I fixed.

I sang in a children’s choir growing up. There were several kids with perfect pitch over the years. It’s an incredible skill; they really do get the pitch exactly right - even better than the piano.

Makes you wonder what the difference is, genetically speaking. The one set of genes codes for a crystal oscillator and the other for resistors and capacitors or the biological equivalent.

This is a really interesting area of research. I've been following roughly since the time I wrote the code I described above (at UCSF, a medical research institution). At the time, my genetics professor (Nelson Friemer) theorized it was primarily genetic (https://www.sciencedaily.com/releases/2009/07/090702170209.h...) and even found some genetic associations.

I don't think that's really super-important. For example, when he heard that perfect pitch was frequently found in children of musicians, his conclusion is that it was inherited genetically. I think, instead, children of musicians are exposed to pitches and their labels (notes) very early, during neural plasticity, and develop the mental associations, probably with some assist from genetics.

The biophysics of audition are pretty interesting; see http://dailynexus.com/2017-08-24/hearing-a-biophysical-and-n...


One could imagine any number of genetic changes that could affect the ability of the physical system (these parts) as well as the neural parts to do this, but personally I think this is much more learned behavior, not genetically dominated.

The big question is: what is the reference?

reference to what? There is a collect of hair cells that vibrate in response to various pitches. When presented with enough training examples, the brain makes the association between those vibrations, and labels provided by others (that's where the pitch/note mapping comes from). For individual frequencies, I think most people with perfect pitch spend some time with pianos and tuning fork and eventually get a "feel" for what delta 1hz around 440 sounds like.

Explain my four-year-old hearing chords played on a piano by the teacher, and able to tell the notes that made up the chord. First 3-notes, 4, 5, 6 and he was still able to do it.

Sure the labels are learned. But the ability to hear all that is spread out over a bell-curve. The whole class could tell 1 note, 1/3 could tell 2, then 2 kids could tell 3, then just 1.

yes, and? I don't have perfect pitch, but with extensive training I have limited relative pitch. It's an acquired skill like anything else, and young kids exposed to music pick it up faster- with a distribution, like everything else.

Oh, and he has perfect pitch. Can tune stringed instruments without a reference, was employed to do so for some summers.

It was something he could do, from a very young age. Not apparently learned. Not learned by most of his cohort at music school, so I'm guessing most likely something born with.

If there is a distribution, then we have to task to explain that. Reasonable to call it genetic? Why not?

I don't know what you mean by "not apparently learned". Even with genetically inherited perfect pitch, the skill has to be "learned" (IE, presented with note labels). Nobody has the ability- without training- to tell you the frequency of a note. Genetic (in this case) doesn't mean "born with the ability", it means "predisposed towards greater ability after training").

Personally, I'd start with the strong observations like "People whose first language is tonal are more likely to have perfect pitch", while people whose ancestors spoke tonal languages, but were raised with a first language that isn't tonal, are less likely (and vice versa). That says to me "environmental differences" are as strong as genetic.

All of this is covered in extensive (and relatively accurate) detail on the wikipedia page. if you want to argue with me further, I suggest getting a PhD in the field, or at least extensive experience with molecular biology, genetics, biophysics, experimental design, and scientific philosophy, as all those are necessary prerequisites for discussing complex traits that have both genetic and environmental components.

That is really not an OK answer.

The idea that there is an 'absolute' involved indicates a reference of sorts, that is what makes it absolute. Labelling notes will distribute them along a bell curve and the dead center of that bell curve may or may not be the exact note. People with absolute pitch are able to do this exactly and that is what makes it interesting, that implies a reference to some standard, presumably one that they have internally. A tuning fork is such a standard, as are other mechanical oscillators with a high degree of repeatability.

There are numerous problems with your response; I suggest reading up on the actual biophysical experiments done with people with absolute pitch to get a better idea on the details of what absolute pitch means.

It's not exactly; most people with AP can do, at best, note labelling. A much smaller group can identify pitches (frequencies) but then only with 1hz resolution around 440.

I don't mean to imply in these discussions that I'm an expert on absolute pitch- but I have a PhD in biophysics and we covered signal transduction in our classes.

I think sitting around speculating that there's some absolute pitch reference in people's head that works better because of genetic mutations is probably not the right path to go down. Because (almost) everybody has those pitch references (hair cells) and they're almost all equally functional (some mutations probably lead to slightly better or worse response).

I don't really follow all the parts about the bell curve other than to say most physical phenomena like this exhibit distributions that resemble gaussians, but that isn't really an indicator of the mechanism.

I guess I'm not making myself clear. The ability to learn this accurately is not the same for everyone. Those that can, are said to have 'perfect pitch'. What makes them different?

Not just the learning - as suggested, maybe that's teachable (but probably not, look at all the advanced music students that never learn). But the speed and facility are not teachable - that came with the person.

Which is about the same as said above I guess.

And Really? Appeal to authority?

I wish I could answer your question with some level of authority, but nobody knows the answer. The general problem of how people transduce signals into information, why it's efficient for some people, and to what level people can escape genetic determinism is one of the prevailing questions in biological science.

As for appeal to authority: completely appropriate in this case since it's a highly technical issue with a ton of prior knowledge that is both subtle and non-obvious. I don't really understand the idea that appeal to authority in this context is fallacious- as we are not having a formal logic argument, but arguing about extremely complex, messy, wet systems with complex feedback loops that lead to high non-intuitive behavior.

The trouble with appeal-to-authority is when its used to shut down discussion, e.g. 'before you say any more you have to be as smart as me' which isn't educational, helpful or honest.

I understand why some people don't like it. I don't mean it to shut down discussion but once I reach the pooint where hackers are presupposing a mechanism that isn't consistent with the modern understanding, I'm going to encourage people to learn to do the research on their own.

I'm surprised that he did actually have perfect pitch.

me too. I can't even hear any difference between 1hz intervals around 440.

This is cool, but doesent even seem to mention the ScreamTracker pc speaker hack. Maybe it was done the same way, but it was able to output about 8khz bandwidth, 1 bit rendered and anti-aliased from 8 or 16 bit sound samples to the pc speaker. It worked so well I still have tape recordings I made with a hacked up rca plug attached. The paralell port adapters sounded better, but had their own neat lofi sound. About the best you could do without a sound card, which were stupid expensive back then. It was a far cry from the 'musical' beeping I was used to.

The article does clearly mention it (and has links to videos of games that used it)

> PC Speaker can be turned in a DAC either by disabling timer count then enabling/disabling sound output, which makes it a very basic 1-bit DAC, or by using sound channel of the PIT to generate short pulses of variable width (PWM) at carrier frequency set by the timer interrupt, which effectively gives a much better 6-bit DAC.

Is this the same used in the 8088 mph demo productions end credits?


IIRC 8088 mph has to go to great lengths for the timings to line up, using cycle counting instead of interrupts for timing, among other hacks/shortcuts. I'm guessing that typical 386/486 CPUs were powerful enough to not need this level of optimization.

Reminded me of Mean Streets, with it's RealSound[1] voices https://youtu.be/WJ4rYt8v--4?t=153

Was amazed when I heard it for the first time.

[1]: https://en.wikipedia.org/wiki/RealSound

I agree, even as a young kid with no idea how make the speaker even go beep (I was young, ok?) hearing the music/speech coming from Mean Streets was amazing. Everything else up to that point was just beeping and blipping... IIRC the volume was very low though.

And having now read the article I see it mentions RealSound, albeit not Mean Streets. The digitized speech was something else when I heard it. Game too, for that matter.

What always amazes me is this could have been done back in the day if someone had had the vision and belief that it was possible. Understandable that they didn’t because it’s so far beyond the then current level of expectation.

So that makes me wonder what could be done with what we have now if we only had the vision and belief that it was possible? What will someone demo if 50 years on an “ancient” Windows 10 PC or iPad?

I'm not 100% sure that's true - for example, today we have hugely improved development environments, IDEs, source control, collaboration tools, simulators, debuggers, documentation (particularly in terms of easily available and instant access to low level details and also searchability) and so on, which (probably?) make it easier to produce code, and perform tasks that would have been impossible or intractable back then...

Yes, the environment definitely makes it easier and more feasible.

Still, what if we have Star Trek-like transporter building blocks today but just can’t see it yet?

Damn this takes me back. I'm 10 years old and my 'gaming setup' is my mom's 386 work computer. No sound card, so I played and completed games like Doom I, Chip's Challenge (built-in w/ Win 3.1 I believe) and Allan Border's Cricket with those beeps and boops.

I had a cracked game on my Apple IIe which included a side program (included by the cracker) that played 3-channel beethoven sonata.

Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact