Announcing laser2wav, a software-only audio CD decoder

Hi all,

As remarked elsethread, I have release a very preliminary version of laser2wav, a software-only, audio CD channel-data decoder here:

Don’t expect too much: it’s not quite polished. It does, however, demonstrate how to decode 588-bit channel frames, using EFM, how to decode & check P/Q/R/S/T/U/V/W subchannels (including an implementation of the Q-channel CRC that ought to make you smile), how to do C1/C2 checking for the audio data, and how to do audio de-interleaving.

This is not a finished piece of work by any standard. However, I hope it will prove useful to people trying to understand what goes on deep in the bowels of a CD player.

The code (written in Python) comes with a 5-sector fragment (490 frames, 0.15 seconds) of actual data as captured by my rigged CD player. This may be useful to some people.

Unfortunately, I still haven’t got a setup where I can stream raw data into my computer, but this will come. When all that works I shall write down a sort of bottom-up tutorial on CD decoding, and publish it on the web.

Much of the actual information is contained in the source code of laser2wav. However, at this point in time you will have to be a bit of an expert to understand what’s happening. All this will improve, I hope, with the next couple of releases.

Best regards,


I just can say you’re The Man. :bow:
It’s a beautiful day. :iagree:

Congrats Sidney! I know you’ve worked hard on this. :slight_smile:


It’s 5 sectors of 98 frames each = 490 frames, which yields 1/15 seconds of channel data (not 0.15 seconds). Doh.

This needs to go in the home made tools section.

Wow, good work - I like this kind of stuff. Looks like it’s the only source code of this kind on the net and it’s a good thing that you are sharing it with the world.

I can’t wait for the tutorial.

Awesomely cool, I looking forward to the possiblilty to stream the raw data.

Hi all,

Version 0.0.5 of laser2wav can now be downloaded from my website as The following changes were made compared to the previous 0.0.2 release:

[li] fixed silly “to_signed” bug
[/li][li] added HISTORY file
[/li][li] code cleanup: renamed source and data files; added lots of comments
[/li][li] cleaned up “galois field” code - syndrome calculation should now be much easier to follow.
[/li][li] emit a PCM-encoded WAV file instead of a text file
[/li][li] laser input is now assumed to be the raw signal (not the delta-signal as before).

In the mean time, I have started to write a couple of extensive web pages that describe the decoder and decoding process.

Future attractions that I am thinking of:

[li] implement encoder
[/li][li] implementation of merge bit algorithm
[/li][li] implement proper error correction algorithm
[/li][li] make a fast © implementation (partially done)
[/li][li] decoding of ToC info

Best regards, have fun,



and what a nice excuse to learn python… :smiley:

For download see [thread=191196]laser2wav v0.0.5 port to c[/thread] (includes original source).