Skip to content

PCM Extract

Harry Munday edited this page Nov 26, 2024 · 3 revisions

pcm_extract

A tool for extracting PCM encoded data from a bruteforce-sampled bitstream, primarily made for using the PCM1802 in combination with the MISRC.

Note

  • That the sample rate must be more than twice the bandwidth, so that both low and high states of the bit clock can be observed. This tool is not yet integrated into the main repository but can be obtained from here.

PCM1802 Example

PCM1802 PCB & Female DuPont Cable Ribbon

For Clock/Ground SMA Male to DuPont Female.

The PCM1802 basic ADC board outputs a 78125 Hz / 24-bit stream in PCM samples.

These are 3 data lines BCK / DOUT / LRCK which go to the FPGA directly.

There is also GND which is ground and SCK which is clock input, an 22pF cap in-line is required for the PCM1802 chip to have a stable clock signal due to higher load draw of the Tang Nano 20k.

Usage

pcm_extract <BCK> <DOUT> <LRCK>

Provide the input on stdin, and the decoded audio is provided on stdout as signed 32 bit. Example usage with a MISRC capture:

misrc_extract -i test.bin -x - | pcm_extract 2 3 4 | ffmpeg -y -f s32le -ar 78125 -ac 2 -i - aux.flac 

For a capture with current misrc_capture:

cat PCM1802-Audio.bin | pcm_extract 3 2 5 | ffmpeg -y -f s32le -ar 78125 -ac 2 -i - -ar 48000 MISRC_PCM1802_audio.wav

This assumes the following pin setup:

  • 0: BCK
  • 1: DOUT
  • 2: LRCK

misrc_extract pads the bottom by default, so each pin number has to be offset by 2.

Up to two PCM1802s can be connected to the aux bits, and you can extract their data individually by providing the correct pin numbers to pcm_extract.

Verifying setup

If there is no PCM data in your AUX stream the .bin file will look like the left, if there is valid it will look like on the right.

Tip

You can inspect your data files like this with any Hex editor tool (example above is just Hexedit on Linux)

Page End

Clone this wiki locally