Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So I am basically clueless on how to transfer bits via audio without data loss (doesn't noise corrupt the bits?)

Does anyone have any links or resources on how to do a 'hello world' of audio-based data transfer?



Yes, noise corrupts the bits.

"the most common cause of error is external sounds being piped into the download stream (e.g. mail alerts) and low volume" -- http://asciiexpress.net/gameserver/readme.html

There are many ways to transfer info via audio (e.g. google for modem or frequency-shift keying). The Apple Game (and Disk) Server does not use FSK however. It relies on the Apple II cassette port which is nothing more than a 1-bit digital-analog-converter. IOW, it can detect the shift from positive to negative (zero crossing). The game server WAV files encode the game @ 48K samples/second using a single 12kHz wave for the zeros and a single 8kHz wave for the ones. IOW, 4 pulses for 12kHz (2 +, 2-) and 6 pulses for the 8kHz. The Apple II has a 1023000 cycles/second clock. So I have to detect the zero crossing, chksum and write the data in 1023000/12000 ~= 85 clock cycles. As long as the audio stream is clean and perfect (something only a computer or CD player can do), then it works every time.

If you load up any of the games in Audacity (freeware waveform editor), you can actually "see" the 0's and 1's. The 0's will be thinner.

Lastly, I will be publishing an article on my blog (http://jerkwerks.com) this month with how it works and all the source code.


We think of bit's as vary precise things, but at the hardware level they are better described as ranges of values. So you could use a say X +/- 30% = 0 and Y +/- 30% = 1. Thus, if X = 100 and Y = 200, then 128 or 78 both stand for 0 and a computer would litterally not care if you sent it 98 or 115 etc.

You can also add a little redundancy in longer messages so you can tell if it's corrupted or if only a few bit's are flipped you may be able to recover. Also, devices can downgrade their bandwidth to handle some noise. Think of it like someone saying Tango when they mean T, if you hear T or ango you know they both stand for T.

You may want to check out this video. http://hackaday.com/2011/07/10/sound-card-microcontrollerpc-...


Back in the old days, my young friend, we had these awesome devices called modems. They translated digital data to sounds (and back) for transmission across telephone lines. I'm sure you can find a picture and complete technical details somewhere.


facepalm I sure left myself wide open to that one. fwiw your comment led me to find minimodem is exactly what I was looking for!

http://www.whence.com/minimodem/





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

Search: