News for hackers. Stuff that matters.
Re:Using the Web Audio API to Make a Modem by ravenstine on Saturday October 14, 2017 @02:36PM (#15473506)
Having worked on a similar project, my experience is that signal-to-noise is a very challenging problem when you have an air gap. Inevitably, it opens up room for minute errors caused by accoustics. The only "reliable" workarounds I devised were to increase broadcast duration and rebroadcasting the same data with simple checksums.

This was what I came up with: https://github.com/Ravenstine/airsocket

Note it's extreme crappiness is due to a combination of my inexperience and also my desire to build as many parts from scratch as possible. The Web Audio API is only used to play audio, but the oscillator and decoding functions were written by me. It barely works. It's probably better to go full Web Audio all the way since I'm sure there's hardware acceleration(particularly with AnalyserNode). The author's method of encoding bytes is also far superior to what I came up with.

I wish such an article was published when I was trying to devise my own audio modem. He does an excellent job going over every step and explaining what's going on. Documentation and tutorials around Web Audio used to be too convoluted, with basic examples too few and far between.

Re:Using the Web Audio API to Make a Modem by vvanders on Saturday October 14, 2017 @05:58PM (#15474562)
Even better than rebroadcasting is Forward Error Correction[1].

It's the basis of pretty much all modern radio based telecommuncation protocols(WiFi/3G/LTE/etc).

Basic FEC can go a long way, esp if your packet sizes are large, latency is high or you have a lot of channel congestion.

[edit]

To give you an idea how awesome FEC can be quite a few ham operators do EME(Earth->Moon->Earth) contacts via JT65 with FEC[2].

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

[2] https://en.wikipedia.org/wiki/Earth%E2%80%93Moon%E2%80%93Ear...

Re:Using the Web Audio API to Make a Modem by brian-armstrong on Saturday October 14, 2017 @03:07PM (#15473676)
I have a WebAudio modem that works reasonably well, and I went a different direction with it. Mine uses a C DSP/SDR library with good error correction, run through emscripten to generate the samples.

You can try it here https://quiet.github.io/quiet-js

Re:Using the Web Audio API to Make a Modem by ravenstine on Saturday October 14, 2017 @07:52PM (#15474992)
Actually, I think it was your project that gave me the idea to attempt near-ultrasonic transmission. I could only get to ~15000hz before it would just not work and I never figured out why that was. Maybe there's a flaw in how I used the Goertzel algorithm. (reason I went with Goertzel is because I built it for a previous project and wanted to see how far I could take it)

Is that example page new? That's brilliant. Your ultrasonic transmission seems to work pretty consistently.

Re:Using the Web Audio API to Make a Modem by tonmoy on Saturday October 14, 2017 @09:30PM (#15475362)
A lot of microphones and speakers have built in hardware low pass filters that kill anything above 15kHz
Re:Using the Web Audio API to Make a Modem by Arve on Monday October 16, 2017 @06:12AM (#15482115)
Someone pointed out low-pass filters to you, but that's not the entire story. Built-in speakers in phones and laptops generally don't have a naturally extended frequency response.

A while ago, I made audio measurements of the built-in speakers on the iPhone 7 Plus - https://imgur.com/gallery/DRbu5

The iPhone's extension is not entirely atypical of such devices, and leaves you with a reliable passband of 500 Hz to 10 kHz - above and below those frequencies, you're getting too much noise.

If you're airgapping with audio cables, you'll have a reliable passband of 20 - 20 000 Hz or thereabouts, with some caveats for built-in audio on devices such as a Raspberry Pi that fizzle out at 15 kHz.

As noted by brian-armstrong's comment, you'll only get reliable near-ultrasonic airgapping over a wired connection.

Re:Using the Web Audio API to Make a Modem by brian-armstrong on Monday October 16, 2017 @05:22PM (#15486734)
This isn't correct, by the way. Quiet's near-ultrasonic mode (~19kHz) works fine from several feet away using phone hardware. As long as you're using relatively narrowband communication, it works fine.