Thread: Modulating Data into CD Audio

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273

    Lightbulb Modulating Data into CD Audio

    Hello,

    The first computer I ever touched was an Atari 65XE (no sniggering from the Commodore crowd, please...). Given that I was around 4 years old at the time, I was always fascinated by the way games were loaded from standard audio casettes. When you pressed play on the recorder, you could hear a somewhat uncomforting scratching sound, which was rhythmic. The tape always began with a continuous tone, then broke into stanzas of frantic scratching roughly every two seconds. After doing that for around 20 seconds, the Atari would then execute what was loaded.

    Years later I read about the Kansas City Standard, a more general form of what the Ataris had used. The baud rate wasn't particularly impressive, but I suppose given the tech at the time (floppy disks were around, but prohibitively expensive in the European market) it+tapes were the most intuitive storage solution.

    But what if we were in a similar situation now? If we were to pretend that all digitally-encoded random access data storage media (hard drives, memory cards, etc.) were too expensive for the mainstream, but we could record and play CD audio (we'll also pretend that the Yellow Book that defined CD-ROMs hasn't come out yet ), what is the maximum baud rate that could be encoded?

    For reference, in the late 90s we were able to get ~33.6kbps from a simple copper phone line that had a bandwidth of 3.1 kHz. Some DSP acrobatics were required for this (QAM had to be invented first, I think). Some later trickery that relied on the local telephone exchange being digital pushed that further towards 56kbps (don't think anyone actually got that outside of a lab).

    CD Audio has a bandwidth of around 20 kHz. I don't think this is as much as most broadband standards, but I would guess that it should be possible to encode hundreds of kilobits per second.

    Now you might be thinking "Right, you're an idiot, CD Audio is already encoded as PCM! Just store the data as raw PCM!" The problem with that is although you will indeed have a precise audio representation of the data, you can't actually play that to an audio receiver (e.g. the analogue line in on a sound card) and expect to be able to reconstruct the data. There's all sorts of issues with that. Remember that the reason audio tapes were used to store data was cost. The commodity equipment being used for playback cannot render that audio perfectly. The commodity equipment receiving that audio cannot receive every possible waveform. The basic filters employed in most sound cards completely kill samples that are not close to the middle of the band. That data will be neither played back or received.

    So, to come up with something similar to KCS for CD Audio, we will need to define most likely a QAM-based scheme that produces a modulation that sits roughly in the centre of the 20 kHz available (working on the basis of perhaps 16 kHz). Like KCS we will also want to employ packetization of the input data, perhaps with a checksum to verify the integrity of what was received. As CD Audio has two channels, we could combine the samples from both of them to potentially double our baud rate.

    Does all of this sound doable to you?
    Last edited by SMurf; 10-24-2014 at 02:48 PM.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by SMurf View Post
    CD Audio has a bandwidth of around 20 kHz.
    CD audio is exactly 44100 samples per second, 16-bit, stereo, adding up to 176400 bytes per second, or 172.265KB/s, or 1378.125Kb/s.

    I read your post 3 times, and I don't understand exactly what you want to accomplish.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  3. #3
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    Yes, that is correct, but using that specification, I want to store a waveform that describes digital data, that can be played from the line out of a sound card into the line in of another sound card, and reconstructed without problems.
    (Preferably using the additional bandwidth available, not just recording the output of a phone line modem, that's cheating )

  4. #4
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    As CD Audio has two channels, we could combine the samples from both of them to potentially double our baud rate.
    O_o

    You talk about the limits of commodity hardware from the perspective of the early age of the compact disc yet assume that all players and receivers will have the capacity for stereo audio? What if someone is using a dumb coupler to join stereo out line to microphone in line?

    Furthermore, a checksum will do nothing other than say "Bad Data", and you seem to want to account for poor hardware so must account for errors in the production of the audio stream. The correction code in the disc itself is sufficient for the player, but the receiver has no way of correcting the consumed signal if any interference is present.

    Does all of this sound doable to you?
    I'd even say that it wouldn't be too difficult as a hobby project if you use external software for recording and ripping audio.

    [Edit]
    That is, produce an audio file for recording by your favorite disc recording software and rip that audio back to a file with your favorite ripping software allowing you to focus on the production and consumption of the signal not SCSI codes.
    [/Edit]

    Assuming you use a reasonably sophisticated correction scheme at the monaural signal level, I'd say you could do a stable 392kbps over such simple systems without any difficulty.

    That may seem a low, but I'm pretending you'd reuse existing correction schemes so that you could reuse existing hardware allowing for a cheaper product.

    CD audio is exactly 44100 samples per second, 16-bit, stereo, adding up to 176400 bytes per second, or 172.265KB/s, or 1378.125Kb/s.
    I kind of assume that SMurf is applying the old "double-rate samples" rule in a weird way.

    I read your post 3 times, and I don't understand exactly what you want to accomplish.
    I interpreted the post as a toy project to rediscover modem technology over sneaker net... which sounds like a lot of fun.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  5. #5
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    Quote Originally Posted by phantomotap View Post
    You talk about the limits of commodity hardware from the perspective of the early age of the compact disc yet assume that all players and receivers will have the capacity for stereo audio? What if someone is using a dumb coupler to join stereo out line to microphone in line?
    Conceded, although perhaps a separate "program" could be stored in the other channel, with manual selection between the two.
    Quote Originally Posted by phantomotap View Post
    Furthermore, a checksum will do nothing other than say "Bad Data", and you seem to want to account for poor hardware so must account for errors in the production of the audio stream. The correction code in the disc itself is sufficient for the player, but the receiver has no way of correcting the consumed signal if any interference is present.
    Yep, rather than attempting to execute something which is obviously faulty, tell the user to retry. Cue much fiddling with volume knobs, checking cables, etc.
    Quote Originally Posted by phantomotap View Post
    Assuming you use a reasonably sophisticated correction scheme at the monaural signal level, I'd say you could do a stable 392kbps over such simple systems without any difficulty.
    This confirms what I thought. Perhaps a bit more with tweaking
    Quote Originally Posted by phantomotap View Post
    I kind of assume that SMurf is applying the old "double-rate samples" rule in a weird way.
    Nyquist is important here, as we're trying to produce an approximate waveform that stands a chance of being received and quantized as close to the original sample as possible. I have read somewhere that dividing by 8 would be a better bet, to generate enough samples per wave to approximate its shape.

    But I'm glad you approve!

  6. #6
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    If you are dealing with only sine waves, you should be able to operate close to Nyquist so long as the D to A process has a good Nyquist filter (anti alias filter), and the A to D process limits the input frequency to below Nyquist. The 44.1 k sample rate provides enough margin between the 20 kHz signal maximum, and the 22.05 kHz Nyquist frquency.

    With sinusoidal signals, the only frequency present is that of the sine wave. There is a very short duration impulse at the beginning and end of the sine wave burst. The filter for the A to D process should handle this easily, I believe.

    A small number of samples per cycle for a sine wave should not be a problem. The Nyquist filter (if decent), should restore the original signal.

    Non sinusoidal waveforms have harmonic components that can easily exceed Nyquist. All the harmonic components need to be present to preserve this waveshape. So the fundamental (base) frequency of the wave would need to be much lower than 20 kHz to keep all the significant harmonic components below Nyquist.

    -
    Last edited by megafiddle; 10-25-2014 at 12:26 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to transfer audio data in real time?
    By leetow2003 in forum Networking/Device Communication
    Replies: 6
    Last Post: 02-21-2012, 03:10 PM
  2. Replies: 5
    Last Post: 12-05-2011, 10:02 PM
  3. Reading in 16 and 24-bit audio data into (32-bit) integer buffers
    By theblindwatchma in forum C Programming
    Replies: 2
    Last Post: 04-13-2008, 11:12 PM
  4. How To Generate Audio Data From A Wav File
    By mrchu in forum C++ Programming
    Replies: 10
    Last Post: 03-06-2008, 03:00 PM
  5. Modulating sound volumes
    By Azrei in forum Game Programming
    Replies: 2
    Last Post: 01-07-2005, 04:51 PM