Show HN: I made a tool to communicate data using the PC speaker (github.com)
r2t2 is a command-line tool for transmitting data through sound using the PC speaker on the motherboard. The name of the tool is a reference to the R2-D2 robot from Star Wars :)
In short, you type some message and it gets FSK modulated and transmitted via sound through the PC speaker. Note that this is the speaker/buzzer that you connect to the motherboard and not the regular speakers that you connect to the sound card.
I also made a simple web page that listens to the sound emitted by r2t2 and decodes the received messages. The page can be used by simply opening it on your phone and placing the phone near a computer/device that emits data with r2t2.
I made this tool mostly for fun, but I think it might have some useful applications too. The advantage of this type of communication is that the hardware is very cheap (~$1/speaker), does not require a sound card and the software is very simple and does not use any 3rd-party audio libraries.
74 comments
[ 2.8 ms ] story [ 130 ms ] threadThe advantage of this is that it is a very cheap way of adding such communication channel to your device.
- [R2T2] Normal : 16 bytes/8.5 sec
- [R2T2] Fast : 16 bytes/5.7 sec
- [R2T2] Fastest : 16 bytes/2.9 sec
The faster the communication - the less reliable it is. Currently, data is transferred in 16-byte batches.
What bit rate do you get? In those days about 1300 a second was possible (on a good cassette with Dolby)
https://www.youtube.com/watch?v=faEYry_MyZM
Edit: The software that was broadcasted was usually made by listeners or shareware. I.e. it was not illegal software.
http://www.windytan.com/2012/08/vintage-bits-on-cassettes.ht...
There are various data modes for ham radio (e.g. JT65), but tapes are better in some ways (bandwidth) and worse in others (wow and flutter), so those codecs seem ill-suited.
(For other modes like airplane scatter, meteor scatter, EME, satellite, etc. there is even more doppler shift.)
In r2t2, I use a single-tone encoding, since the buzzer can emit just a single frequency.
That's not wrong, but also not the whole truth.
https://en.m.wikipedia.org/wiki/PC_speaker#Pulse-width_modul...
I lived through the PC speaker, and never heard anything like this ever emitted from one. It's crazy how good those waveforms sound, if they're representative of the hardware…
I remember how amazing it was when we got our first soundcard installed and working, too. Games were much more interesting with real sound-effects.
i think eventually windows added an sound driver that did pwm on the speaker.
it was one of those really cool hacks that blew your mind when you first saw them. (like people playing music with disk drive stepper motors, i guess exactly like that heh)
edit: found it: https://en.wikipedia.org/wiki/RealSound
It was still semi-useful, you got the little Windows sounds playing, and if I recall correctly, there was a Windows Zeppelin game which was more fun with sporadic sound samples playing.
I upgraded my mothers 80286 PC clone with a separate ISA 8-bit MFM harddisk interface. I put in an 80486 (SX?) motherboard, which of course had IDE disk connectors. But, partly because I didn't have any spare IDE disk, and partly to make it a plug-in upgrade, I just moved over the ISA card to the 80486 motherboard and called it a day.
It was actually a very productive setup, Word 6 was really fast on that machine and the little sounds from the PC speaker driver as a nice novelty.
https://github.com/ggerganov/ggwave/tree/master/examples/r2t...
The communication should be robust towards noise, but I still haven't investigated thoroughly how noise affects the performance.
https://www.youtube.com/watch?v=gvtrnpydHlU
Some other material on the subject:
- http://www.whence.com/minimodem/
- https://quiet.github.io/quiet-js/
- https://courses.csail.mit.edu/6.857/2014/files/05-li-lynch-z...
- https://www.ghacks.net/2014/01/09/ultrasonic-communication-c...
- https://smus.com/ultrasonic-networking/
- https://arstechnica.com/tech-policy/2015/11/beware-of-ads-th...
It's just basic security. Direct access (ie no trusted intermediate software layer) to physical hardware is a minefield.
In this case, the driver is a trusted intermediary layer – at least, I think it is.
Wiki: https://en.m.wikipedia.org/wiki/Tempest_(codename)
I believe zero people on the course got it fully working.
I spent almost every spare hour I had in that lab for ten weeks. And despite it being insanely difficult, I learnt something that semester. I learnt that I would never, ever, work in hardware.
Do a basic OFDM with bins say 5Hz wide, with QAM data. Align timing, phase shift and amplitude by brute force looking for known marker bins. Choose such narrow bins and such long symbols to try to hide the effects of echo, reverb etc.
Deal with noise and channel deficiencies with lots of erasure coding.
Back in the day, I don't think matlab had any 'export' logic like I think modern copies do. IIRC matlab can emit C code + matlab library calls maybe?
It was definitely too difficult _for me_.
I am currently working on one such projects. One of the modules will be manufactured at an initial rate of about 5K units per month and is predicted to eventually reach as high as 50K per month. With software --and particularly with web-based products-- you can literally have millions of customers, make mistakes and fix things overnight.
Imagine shipping hundreds of thousands of physical products and discovering a problem with the design. Not the same world at all. Heck, in most cases you can't even update the software after shipping. Which means you have to get all of it right before it goes to manufacturing.
Among other things, I think this is one of the reasons for which VC's aren't all that interested in hardware. It's difficult, capital intensive and the risk vs. reward simply isn't on the same scale.
That said, I enjoy hardware development. Yes, I do software just as much and, believe me, its a walk in the park compared to hardware, but I would not trade one for the other. No pun intended, either you are wired to like hardware or you are not. That's the way I see it.
Hardware, it seems, is about to become a winner takes all market. And at that point you can't be a successful software producer unless you control the hardware as well.
Back in the 70s you probably had a shot at starting a computer company or silicon manufacturer with a small team and good amount of funding. Today that is wildly impossible.
Software, on the other hand, is the opposite. A billion+ dollar research project from 20 years ago is an npm import away today. Two people with a laptop are more and more equipped to take on the goliaths of the industry (or get acquired by them) than they were in the past.
This is how it works now. But if hardware manufacturers start working more like gatekeepers (see app stores) then the two-person-disruptive-startup becomes less of a possibility.
https://www.sigidwiki.com/wiki/Category:Amateur_Radio
Also, ham radio operators are doing some amazing things with audio-encoded data. You can send a message halfway around the world with just a few watts and a person with a computer on the other end can received and decode it, even if the signal itself is _below the noise floor_. Of course, the tradeoff is time: it takes a few minutes to transmit the small amount of data required to make a contact.
Video on how it looks like https://youtu.be/Q_fTfGJFK2A?t=68
https://m.youtube.com/watch?v=wzkAeopX7P0
I suppose there are only so many ways to modulate a data signal.
An example of when sonic communication is useful is to bootstrap other communication.
During setup, Amazon Dash buttons would listen for data sent over ultrasonic to get network information.
https://www.cnet.com/home/smart-home/appliance-science-how-t...
I think that's just super cool.
(Disclaimer: I work at A->n but not on this in particular, I have only public, consumer knowledge about how this works)
The funny part is I already did a similar application using ggwave and talking buttons. I mean, it does not order stuff, but you can easily create a button that triggers any kind of action via audio:
https://github.com/ggerganov/ggwave/discussions/27
Reading certain areas of a floppy disk would probably be even louder and more consistent.
There could be a "setup program" that listens to the computers microphone and performs various accesses, choosing two that meet the criteria for being distinguishable enough for another system to tell apart. Lower frequencies for 0, higher for 1.
180 bits per minute, not too shabby!
So, perhaps a way to try this without finding an old pc.
Once upon a time transferring digital data over analog channels brought us fax machines and dial-up internet.