Dear Pd-List,
I was hoping to get some advice on the following problem.
I have a Raspberry Pi sending stereo audio into a 2nd Raspberry Pi which takes stereo input using a USB sound card. I would like for the first device to be able to encode some basic control data on top of the audio stream such that it is not audible but can be read by the 2nd device. The control data is very basic (a timing sync pulse, maybe BPM or tick mod 16, but that's not essential).
I could set up a WiFi connection or Bluetooth etc. it seems like overkill for a simple sync pulse. It would be great if I can get this working so it would be "plug and play" without fiddling around with network stuff. Features that would be nice:
source volume was not at max it can still be read). 2. Make the signal robust o quite a saturated spectrum (e.g. if the source is playing high bandwidth music the signal is still recoverable). 3. Make the signal inaudible such that if it goes into a regular mixing desk it doesn't make it sound bad.
Does anybody know of an existing protocol or method I could use to encode basic timing data into the audio stream like that?
My first thought was to use a frequency above or below the range of human hearing and put a low volume square wave carrier in there, then filter for it with band pass. I am not sure the best Pd objects to use to do that. Suggestions most welcome.
I also saw this, but it seems to require access to the signal before it hits the CPU:
https://electronics.stackexchange.com/questions/242883/how-do-media-buttons-...
Cheers,
Chris.
Hi all,
On 7/3/22 7:34 pm, Chris McCormick wrote:
- Make the signal was somewhat robust to volume changes (e.g. if the
source volume was not at max it can still be read). 2. Make the signal robust o quite a saturated spectrum (e.g. if the source is playing high bandwidth music the signal is still recoverable). 3. Make the signal inaudible such that if it goes into a regular mixing desk it doesn't make it sound bad.
Sorry to reply to my own thread but it seems like a "lock-in amplifier" might be what I want:
https://en.wikipedia.org/wiki/Lock-in_amplifier
https://cushychicken.github.io/lock-in-amplifier-simulation/
I could put in a low-volume carrier signal up at 18kHz and use a "lock-in amplifier" to extract the signal. Can then just gate the signal on and off for a few ms for the sync pulse. Will experiment. Any tips on implementing this in vanilla Pd are most welcome!
Cheers,
Chris.
Hi all,
Replying to my own thread again.
On 7/3/22 8:43 pm, Chris McCormick wrote:
On 7/3/22 7:34 pm, Chris McCormick wrote:
- Make the signal was somewhat robust to volume changes (e.g. if the
source volume was not at max it can still be read). 2. Make the signal robust o quite a saturated spectrum (e.g. if the source is playing high bandwidth music the signal is still recoverable). 3. Make the signal inaudible such that if it goes into a regular mixing desk it doesn't make it sound bad.
Sorry to reply to my own thread but it seems like a "lock-in amplifier" might be what I want:
I've attached a basic implementation of this. The toggle state is transmitted over a noisy audio channel using an 18kHz carrier at 10% volume (inaudible to me but my 11 year old might find it irritating - will test). At the moment there is both lag (10s of ms) and jitter (10s of ms).
I think this can be improved by adding a second detector 90 degrees out of phase:
These two quantities represent the signal as a vector relative to the
lock-in reference oscillator. By computing the magnitude (R) of the signal vector, the phase dependency is removed.
So I'll try that next and see if I can reduce the jitter. If I can get reasonably constant lag it will be good enough for a sync pulse as that can be compensated for on the receiving end.
After building this test I'm optimistic this silly in-band sync messaging can be achieved without interfering with the music itself. \o/
Cheers,
Chris.
On 8/3/22 12:12 pm, Matt Davey wrote:
Dogs everywhere will be going mental 😂
Yes but at a very specific BPM and in time to some to some great music.
Who let the dogs out,
Chris.