8 ms·
Show HN: I made a tool to communicate data using the PC speaker
- ggerganov 5y agoHi HN, 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.
- SwiftyBug 5y agoVery cool! What are some of the useful applications you thought for this concept?
- ggerganov 5y agoI imagine a use case where you have headless devices (servers, raspberry pis, etc.) that are not connected to the internet. These devices can be measuring something through a sensor and periodically reporting the measured value using sound through the speaker. When you go near the device of interest, you take your phone and "listen" to the emitted value to see what was the last measurement. The advantage of this is that it is a very cheap way of adding such communication channel to your device.
- jonah-archive 5y agoat one point the iPod bootloader was extracted by playing it aloud: http://www.ipodlinux.org/stories/piezo/ http://www.ipodlinux.org/stories/piezo/
- jhgb 5y agoReceive Resources Through Tones?
- TedDoesntTalk 5y agoAmazing work!
- fpopa 5y agoWell done, great demo!
- bityard 5y agoMy google-fu is failing me because all I'm getting is blogspam, but I could have swore that some higher-end washing machines had a feature where when they broke down, they would emit some kind of diagnostic noise. Not just the standard series of beeps, but complex digital data. When you called in for warranty support or repair, they would guide you though pushing some buttons on the machine, the machine makes the noise, it goes through the phone, and the call center person on the other end could decode it. Or a repair tech on-prem could presumably decode it with an app on their phone. 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.
- Madrigal 5y agoYou're probably thinking of LG Smart Diagnosis https://www.lg.com/us/support/help-library/smart-diagnosis-front-load-washer-CT00000305-1436379013843 https://www.lg.com/us/support/help-library/smart-diagnosis-f... Video on how it looks like https://youtu.be/Q_fTfGJFK2A?t=68 https://youtu.be/Q_fTfGJFK2A?t=68
- tdeck 5y agoWow it sounds like RTTY (radioteletype): https://m.youtube.com/watch?v=wzkAeopX7P0 https://m.youtube.com/watch?v=wzkAeopX7P0 I suppose there are only so many ways to modulate a data signal.
- nereye 5y agoThere are a few hundreds listed at https://www.sigidwiki.com/wiki/Signal_Identification_Guide https://www.sigidwiki.com/wiki/Signal_Identification_Guide.
- nicbou 5y agoIt's an interesting project. I couldn't think of a use case for it but the one in a readme was a good example.
- BaconJuice 5y agoThis is so cool! and I love the name! Thank you for sharing.
- cyberge99 5y agoWhat is the transfer rate?
- ggerganov 5y agoYou can add a command-line argument to change the Tx protocol between 3 types as explained in the README. Here are the transfer rates for the 3 protocols: - [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.
- helsinkiandrew 5y agoThis took me back to loading programs from cassette tape in the eighties. 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 https://www.youtube.com/watch?v=faEYry_MyZM
- pan69 5y agoI used to record programs of radio for my C64. We had a radio station that had a computer show and would broadcast software. :) Edit: The software that was broadcasted was usually made by listeners or shareware. I.e. it was not illegal software.
- JohnJamesRambo 5y agoThat is so awesome.
- p1mrx 5y agoI wonder what data rate is actually possible on a cassette tape, using modern modulation and error correction techniques? A blog commenter claimed to get 13.8 kbps per channel using Digital Radio Mondiale with OFDM+QAM, but I didn't see an obvious way to reproduce this: http://www.windytan.com/2012/08/vintage-bits-on-cassettes.html 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.
- jrockway 5y agoI am not sure of the magnitude of wow and flutter on tapes, but the amateur modes definitely account for some frequency shift -- for HF, the ionosphere can shift the frequency randomly (I kind of thought I was making this up, but found some papers on it: https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2009RS004210 https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/200...), and radio local oscillators are not perfect (usually temperature dependent). (For other modes like airplane scatter, meteor scatter, EME, satellite, etc. there is even more doppler shift.)
- dariusj18 5y agoIs this a full circle reimplementation of old telephone modems?
- ggerganov 5y agoThe data-over-sound library that I implemented (ggwave) and use in this example implements a modified DTMF protocol. Instead of only 2 tones, I use variable number of tones (usually 6) + error correction. In r2t2, I use a single-tone encoding, since the buzzer can emit just a single frequency.
- gugagore 5y ago> 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_modulation https://en.m.wikipedia.org/wiki/PC_speaker#Pulse-width_modul...
- deathanatos 5y agoFrom the Wikipedia article's citations: http://www.oldskool.org/sound/pc/#digitized http://www.oldskool.org/sound/pc/#digitized 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.
- a-dub 5y agothere was some name for it when it first started showing up in games, "puresound" or something.... yes, it would make jaws drop when the speaker stopped squeeping and started rendering digital audio. 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 https://en.wikipedia.org/wiki/RealSound
- dvt 5y agoThis is very cool! I briefly browsed the code, and didn't seem to see any error correction. Do you find that ambient noise might "garble" the data?
- ggerganov 5y agoI use Reed-Solomon error correction: https://github.com/ggerganov/ggwave/tree/master/examples/r2t2/ggwave-mod/src/reed-solomon 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.
- donclark 5y agoHave you ever heard of LISNR? https://www.youtube.com/watch?v=gvtrnpydHlU https://www.youtube.com/watch?v=gvtrnpydHlU
- ggerganov 5y agoI've seen the project, but I was disappointed to not be able to find any way to try it out easily.
- nikisweeting 5y agoThere was a whole wave of interest in this space in 2014. I believe @kategeek did the first easy-to-use library with Quietnet ;) https://github.com/Katee/quietnet https://github.com/Katee/quietnet Some other material on the subject: - http://www.whence.com/minimodem/ http://www.whence.com/minimodem/ - https://quiet.github.io/quiet-js/ https://quiet.github.io/quiet-js/ - https://courses.csail.mit.edu/6.857/2014/files/05-li-lynch-zhao-covert-acoustic-channels.pdf https://courses.csail.mit.edu/6.857/2014/files/05-li-lynch-z... - https://www.ghacks.net/2014/01/09/ultrasonic-communication-chat-client-using-sound/ https://www.ghacks.net/2014/01/09/ultrasonic-communication-c... - https://smus.com/ultrasonic-networking/ https://smus.com/ultrasonic-networking/ - https://arstechnica.com/tech-policy/2015/11/beware-of-ads-that-use-inaudible-sound-to-link-your-phone-tv-tablet-and-pc/ https://arstechnica.com/tech-policy/2015/11/beware-of-ads-th...
- Spooky23 5y agoReminds me of slow scan tv from the HAM radio days! Cool project.
- jamesdwilson 5y agowhy does it require sudo?
- wizzwizz4 5y agoSame reason you need `sudo` to change screen brightness with the /dev/ files; unless you have special group permissions set up, normal users can't directly access hardware devices. It's a Linux convention.
- d110af5ccf 5y ago> It's a Linux convention. It's just basic security. Direct access (ie no trusted intermediate software layer) to physical hardware is a minefield.
- wizzwizz4 5y agoWell, yeah, that's the reason for the convention – but it isn't quite that simple. Control of the PC speaker should really be available to all users in `audio` by default, because in most setups it has exactly the same attack surface; running software as `sudo` instead is worse from a basic security perspective. In this case, the driver is a trusted intermediary layer – at least, I think it is.
- mdorazio 5y agoI remember years ago reading about this being a black hat method for exfiltrating data from computers not connected to a network. Load the "data to sound" program from an infected USB drive onto the target, then use a separate device to collect the audio without ever having to touch the network directly. There was even a theory about using laser-based acoustic sensing to pull the audio from any window in the room so you wouldn't even have to be in the physically in the building. Interesting stuff.
- sigg3 5y agoTEMPEST has many iterations. Wiki: https://en.m.wikipedia.org/wiki/Tempest_(codename) https://en.m.wikipedia.org/wiki/Tempest_(codename)
- randomsearch 5y agoAs part of my undergraduate course we had to build an embedded system that did this, at a high baud rate, with a transmitter and receiver. It was the most ridiculously difficult project I have ever undertaken. Finished the transmitter but there was something wrong with part of our analogue circuit and it gave the signal an artefact. I wrote the assembly in a day (oh yeah we used assembler and burned an EPROM I think) but the hardware assignment was Walt Disney level fantasy. 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.
- osrec 5y agoLol, I had a similar experience as a teenager, however it only increased my desire to work in hardware!
- londons_explore 5y agoThis isn't too difficult if you can write the algorithm in software (ie. matlab). 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.
- wyldfire 5y ago> This isn't too difficult if you can write the algorithm in software (ie. matlab). 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?
- randomsearch 5y agoIIRC we had to put together a significant analogue circuit, without any real guidance as to how we'd achieve the high baudrate. The software was running on a minimal CPU that we wired up by hand, the address bus, the databus, the memory chips and everything else... hundreds of cables on breadboards, just for the digital part, and the analog electronics took up more boards. A loose connection caused by moving the boards could cost you hours when restarting. It was definitely too difficult _for me_.
- deleted 5y ago[deleted]
- heywire 5y agoReminds me of some of the ham radio digital modes. Here’s a fun link of examples: https://www.sigidwiki.com/wiki/Category:Amateur_Radio https://www.sigidwiki.com/wiki/Category:Amateur_Radio
- exabrial 5y agoI'm probably showing my age: https://en.wikipedia.org/wiki/Acoustic_coupler https://en.wikipedia.org/wiki/Acoustic_coupler
- fuball63 5y agoI also thought of this, but from the movie "WarGames".
- valbaca 5y agoNeat project! thanks for sharing 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-the-amazon-dash-button-works/ 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)
- ggerganov 5y agoHaha, I wasn't aware of Amazon's Dash buttons! 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 https://github.com/ggerganov/ggwave/discussions/27
- sys_64738 5y agocat /path/to/file >/dev/audio ?
- generalizations 5y agoI think the hard part is: cat /dev/audio > /path/to/file. :)
- sroussey 5y agoNext, one for using light via the screen. More ways to connect out from air-gapped computers!
- accrual 5y agoMaybe one could perform accesses on mechanical hard drives in such a way you could encode a signal with it. Maybe reading a couple bytes from the inner tracks of the disk for "0" and outer tracks for "1", assuming they produce different but consistent access sounds. 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.
- crtasm 5y agoHere's that being done and also with fan noise: https://www.securityweek.com/hard-drive-noise-allows-data-theft-air-gapped-computers https://www.securityweek.com/hard-drive-noise-allows-data-th... 180 bits per minute, not too shabby!
- tyingq 5y agoI haven't tried it, but DOSBox emulates the piezo speaker and can record to a .WAV file, you toggle it on/off with <ctrl><f6>. So, perhaps a way to try this without finding an old pc.
- coward76 5y agoNow do capslock,scroll lock, and numlock in excel.
- jhallenworld 5y agoWell you should try "fldigi"- this is a tool with many modulation and demodulation schemes used for amateur radio- they end up going to the transceiver via audio so it works just fine between PCs using PC speaker and microphone. You can have many simultaneous users on different channels within the audio bandwidth. https://sourceforge.net/projects/fldigi/files/fldigi/ https://sourceforge.net/projects/fldigi/files/fldigi/ One of the more entertaining modes is Hellschreiber: basically a radio fax: https://en.wikipedia.org/wiki/Hellschreiber https://en.wikipedia.org/wiki/Hellschreiber
- ggerganov 5y agoI've heard about fldigi, but I didn't know it can communicate through the motherboard's PC speaker. Cool!
- jhallenworld 5y agoWell I should say through the sound system (through your laptop's speaker and microphone). I don't think it would work with the old original IBM PC motherboard speaker.
- deleted 5y ago[deleted]
- graderjs 5y agoIt would be cool if their was an exploit on this protocol to give RCE over sound.
- mshockwave 5y agoI heard that (some of the) Japanese subway used to use ultra-sonic to broadcast train information
- pugworthy 5y agoPerhaps one could record this audio on something like some kind of audio device and then replay it later to a receiver. In the spirit of the old school idea, perhaps like an old cassette tape system.
- tsujp 5y agoI remember there being something called Chirp (I think) that had a neat demo where you have two phones download the app, put the phones into aeroplane mode, and then you can still make a box on the other phone move etc -- the implementation was ultrasonic sound I believe. I tried to find them again but it looks like they were bought out or equivalent by Sonos? [1] https://medium.com/chirp-io/data-over-sound-and-other-data-connectivity-technologies-41150139b3e4 https://medium.com/chirp-io/data-over-sound-and-other-data-c... [2] https://medium.com/chirp-io https://medium.com/chirp-io
- moreati 5y agoI made a send-only Python client, back in the day. https://github.com/moreati/chirppy https://github.com/moreati/chirppy
- rkagerer 5y agoReminds me of amodem https://github.com/romanz/amodem https://github.com/romanz/amodem