Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3556

Beginners • Re: Switch on the Microphone while the speaker is in playback

$
0
0
Simon,

I have a long term Pi project listening for caller ID data and using a USB dongle for audio I/O.

In my case I open the audio device and read data continuously, process it looking for and decoding the FSK and outputting any results. If the results output cycle takes too long I get over-run errors for the microphone data stream and loose samples. Basically once a real time stream input is started you have to keep up with it.

In your case, once you've got the input stream management going you only need to open an close the input stream when you need it then gulp the data blocks as they are delivered to the input stream/file. Maybe consider purging anything you don't need.

If you go for a threaded input handler just set it going and poll it from other processes drawing content when you need it thus staying in control.

One issue for me early on was my audio dongle, while having stereo output, it only supported mono input. This meant I had to deal with blocks of single stream byte/word data not the alternate Left/Right audio samples I was expecting.

Statistics: Posted by RaspISteve — Thu Feb 22, 2024 12:24 pm



Viewing all articles
Browse latest Browse all 3556

Trending Articles