
Show HN: TCP/UDP over sound - brian-armstrong
https://github.com/quiet/quiet-lwip
======
alanh
With this headline, I cannot hear anything in my head except “the dial-up
noise.” TCP over sound was how I used to connect to the Internet…

~~~
aylons
Good catch, but it was actually over audio signals. Sound was just for
monitoring.

~~~
vacri
Some ye olde modems had a socket that you plugged your regular handset into:
[https://en.wikipedia.org/wiki/Acoustic_coupler](https://en.wikipedia.org/wiki/Acoustic_coupler)

I think one was used in the film _War Games_ , but can't recall clearly.

~~~
larholm
War Games used a Dataphon s21d, iirc.

[https://de.wikipedia.org/wiki/Akustikkoppler#/media/File:Acu...](https://de.wikipedia.org/wiki/Akustikkoppler#/media/File:Acustic_copler_with_serial_interface_dataphon_s_21_d.jpg)

I had one for my C-64.

------
piannucci
I've been working on something similar[1] for a few years. Don't forget that
you can use tun/tap devices to avoid re-implementing TCP/IP, and to gain
interoperability with OS services!

[1]
[https://github.com/piannucci/blurt/tree/master/blurt_py_8021...](https://github.com/piannucci/blurt/tree/master/blurt_py_80211/streaming)

~~~
brian-armstrong
Interesting, I had looked around for similar libraries when I started but
didn't find many. It looks like ours differ in terms of FEC and
configurability.

What throughput does your modem get?

~~~
piannucci
Baseline (most robust, up to 10 m range) configuration is 562.5 bps. Tops out
at 3 Kbps under ideal conditions (maybe 30 cm range).

------
flashman
I look forward to the inevitable HN 'What is this thing?' post in ten years
when somebody implements this in a one-off system then leaves the company.
"Here is a recording of the two devices talking, one in the left channel and
the other in the right. Can we figure out what they're saying?"

------
jacquesm
Clever, an audio soft-modem. Was there a reason to not implement this as an
actual modem with a frequency band assigned to either channel and then to run
SLIP or PPP over it?

~~~
voltagex_
Difficulty level, probably. I'd love to see both and also one that can survive
over GSM audio (is that even possible?)

~~~
noselasd
There's dialup over GSM. Though those modems does this by piping data through
a software modem and then onto the GSM channel, however it requests a clear
channel, so no transcoding is done by the network or the phone (the lossy GSM
codecs arn't suitable for this)

GPRS made that pretty much obsolete though.

~~~
kalleboo
The feature for getting a pure data channel was called CSD
[https://en.wikipedia.org/wiki/Circuit_Switched_Data](https://en.wikipedia.org/wiki/Circuit_Switched_Data)

------
ytjohn
This is exceedingly cool.

If someone wants to play with lower bandwidth data (text, basic file transfer)
over sound, it's a pretty active area in the world of amateur radio. You can
download the open-source program fldigi
([http://www.w1hkj.com/modes/index.htm](http://www.w1hkj.com/modes/index.htm))
on 2 computers, point speakers and microphones at each other, and try sending
text (or files/images). The "flmsg" program will send pre-formatted stanzas
which get converted into standard forms.

That being said, doing things like TCP/IP and other data is rather difficult
on radio, mainly due to the duplex requirements and frequency spacing. But in
pure audio, much more possible.

~~~
brian-armstrong
This is an interesting point. And in fact, the mechanisms that libquiet uses
to encode/decode come from liquid dsp, which is in fact intended for use over
RF.

------
jbert
The setup process for our Cocoon home security device
([https://cocoon.life](https://cocoon.life)) uses an audio transfer from the
phone to pass wifi details and a token to bootstrap setup and a trust
relationship.

After some time spent tuning and with some forward error correction, the
reliability is good and it's not too harsh on the ears. Response from beta
testers has been pretty positive.

------
nathancahill
I've been prototyping a dail-up concept (like CSD) over 2G networks. Combined
with heavy server-side compressing, the goal is to achieve speeds faster than
GPRS in areas that have no data coverage to speak of. TCP over sound was the
first part. I'll have to study this implementation.

~~~
pjc50
Note that your audio will get fed through the AMR codec and then limited by
the bandwidth available to that. For best results reverse-engineer the codec
so your symbols are maximally distinguished by it.

It should not be possible to exceed the carrier's CSD rate over the link, but
it's an interesting way of circumventing their billing.

------
ComodoHacker
More interesting IMO would be to embed data stream into normal audio stream
within human-audible range. Something like MP3 steganography, but decodable
after air transfer. Had anyone tried that?

I can imagine some interesting potential applications, including weird ones.

~~~
JorgeGT
You may be interested in [https://github.com/quiet/quiet-
js](https://github.com/quiet/quiet-js) and
[https://danielrapp.github.io/spectroface/](https://danielrapp.github.io/spectroface/),
both encode text / images over audible frequencies, but of course they sound
weird.

However it is technically trivial to encode "hidden" data at inaudible
frequencies (>25 kHz) along with a song/whatever in the audible range and
recover the data with a high pass filter. You would have to explain, however,
the need for >48kHz sample rate.

Another, stealthier option would be to encode information in the background
noise of a recording, but this would require more complex encoding/filtering
techniques.

------
ham
I wonder would it be possible - like in steganography - to hide the waveform
in ambient noise or music so that it's not perceptible if used with speakers
and microphone within audible ranges?

------
wyldfire
GMSK [1] among others. Pretty cool!

[1] [https://en.wikipedia.org/wiki/Minimum-
shift_keying#Gaussian_...](https://en.wikipedia.org/wiki/Minimum-
shift_keying#Gaussian_minimum-shift_keying)

~~~
brian-armstrong
If anyone is curious about the modulation and error correction techniques
supported by this modem, you can try out [https://quiet.github.io/quiet-
profile-lab/](https://quiet.github.io/quiet-profile-lab/) in your browser,
which uses Web Audio to interact with your sound card. This runs at a frame
level, about one layer below the UDP/TCP provided by quiet-lwip, but all of
the modem characteristics are the same.

------
NamTaf
Was there not a PoC recently (~months ago) of someone who did similar over a
speaker/microphone but outside the audible range of ears? It was a PoC of the
Flame malware capability to jump airgapped PCs

~~~
niftich
Not sure if this is what you meant, but Chromecast's guest mode will pair
using ultrasound. The guy who worked on it has some code using the WebAudio
API on github and his linked blog:

[https://github.com/borismus/sonicnet.js](https://github.com/borismus/sonicnet.js)

~~~
NamTaf
No there was an article on here several months ago that I couldn't find when
searching where someone wrote a PoC for the transmission of data via near-
ultrasonic sounds from a computer speaker and microphone. I don't think it was
this [1] one, but it shows the concept being used.

Maybe I'm misintepreting the OP's work and not realising how it differs in
some subtle way? I get that they've put TCP/UDP over it, but is there
something else I'm oblivious to?

Also, I meant BadBIOS [2], not Flame.

[1]: [https://www.anfractuosity.com/projects/ultrasound-via-a-
lapt...](https://www.anfractuosity.com/projects/ultrasound-via-a-laptop/) [2]:
[https://en.wikipedia.org/wiki/BadBIOS](https://en.wikipedia.org/wiki/BadBIOS)

~~~
niftich
Oh, I think you mean this from Fraunhofer FKIE in 2013:

[1] Ars Coverage: [http://arstechnica.com/security/2013/12/scientist-
developed-...](http://arstechnica.com/security/2013/12/scientist-developed-
malware-covertly-jumps-air-gaps-using-inaudible-sound/)

[2] Paper:
[http://www.jocm.us/uploadfile/2013/1125/20131125103803901.pd...](http://www.jocm.us/uploadfile/2013/1125/20131125103803901.pdf)

------
Neil44
A software defined modem?

------
Razengan
Slightly unrelated but curious; have there been any attempts to transfer data
as sound? I don't mean sound converted to electricity, or to represent 0s and
1s, but using a specific frequency range to represent 1, another range to
represent 2, another for 3... I don't know the terms for these things.

Using vibrations instead of electrons to transmit data over a wire?

Do creatures like dolphins do this?

~~~
userbinator
Some of the very first remote controls used ultrasound.

[http://www.pushclicktouch.com/blog/?p=107](http://www.pushclicktouch.com/blog/?p=107)

They didn't even need batteries, since they were purely mechanical.

~~~
bcook
My father always referred to TV remotes as "ker-chunkers" because of his
experience with an early TV remote that would make a noise like a tuning fork
when pressed then the TV knob would make an audible "ker-chunk" as the channel
changed.

------
0x0
I wish there was a youtube link that demo'ed this here :)

~~~
brian-armstrong
If you'd like to play with the base modem, sans TCP stack, have a look at the
emscriptened version here [https://quiet.github.io/quiet-profile-
lab/](https://quiet.github.io/quiet-profile-lab/)

~~~
0x0
That is super cool! Is there a receiver too, that one can run on a 2nd
computer, and transmit text/files?

Edit: wow, the ultrasonic thing is really cool. Imagine putting that in mobile
apps and having them communicate "silently" over the air!

~~~
brian-armstrong
If you want to try 2 devices, here's another demo, again sans TCP
[https://quiet.github.io/quiet-js/](https://quiet.github.io/quiet-js/)

I recommend running the receiver on a non-mobile device if you try this.
Unfortunately running a receiver smoothly from a mobile browser is fairly
difficult.

~~~
0x0
That link is worthy of a HN post in itself! :D

Wow, what about ad networks abusing this for cross-domain cross-tab
communications?!?

~~~
brian-armstrong
I posted that link a few months ago and it was pretty well-received. Today's
submission is more iterating -- the one in the link offers a basic frame-only
interface but today's submission is a full network stack

I considered the cross-tab case but couldn't think of an obvious way to
implement that. They'd have to get mic permissions, at any rate

~~~
0x0
Oops, I guess I forgot I approved the mic on that domain already. That's a
fair point and it would keep user privacy intact. Excellent demonstrations
either way. It's like an audio QR code. Very inspiring!

------
return0
This will be great for retro robots (i am certain they will be popular with
the hipsters of the future one day).

------
SoulMan
It reminds me a app called chirp which allowed data transfer via sound from
phone to phone.

~~~
beardog
I know which app you're talking about. I've played with it a little, it seems
to just transfer a link/identifier by sound to then download the file via the
internet.

~~~
SoulMan
Oh yeah, somehow I cant find that app any more. Guess complete data transfer
would be prone to error given the medium is sound waves. hence they stuck to
link.

