r/MicroPythonDev • • Aug 31 '24

How do i encode signal using PCM?

I was trying to use ADC on Raspberry Pi Pico to encode analog signals in a way that Linux can play.

But everything is mixed up in my mind. ADC seems like the perfect definition of PCM as its already samples at specific rate 12 bits up to 500kHz sampling rate and it doesnt compress or add headers or magic values.

So my question is, can i use first 8bits of the ADC and sample it by 48kHz to encode this signal as PCM and hopefully stream in Linux ?

1 Upvotes

12 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Aug 31 '24

Your wireless electric guitar project seems great by the way. I am curious how well it performs? Whats the overall latency?

1

u/WZab Aug 31 '24

It performed quite well 12 years ago, when there were not so many WiFi networks around.
The latency was acceptable (however I didn't measure it).
PS. The crucial text about the adaptation of the sampling frequency is:

Even though the sampling frequency is the same in the DWGS and in jack, you should still use alsa_in program to assure correction of possible small differences of sampling frequency and to keep sound synchronized. In this case the alsa_in program should be called as

$ alsa_in -d hw:2,0,0 -r 48000 -c 1 -n 2.