romanz / amodem

Audio MODEM Communication Library in Python
Other
959 stars 121 forks source link

Specify Audio Device other than Default #35

Closed gurtajs4 closed 5 years ago

gurtajs4 commented 6 years ago

Hi,

I was trying to figure out the way to use this in Raspberry Pi. Since Raspberry PI does not have Default Microphone, we need to use USB Sound Card for Microphone

The USB Sound Card comes up as plughw:1,0 which is different from Default ALSA Playback and Capture Device.

can you point me to the changes in code, which can be done to change the default Audio Card to other card value?

Also, the procedure to modify the code and compile again.

Regards, Gurtaj

romanz commented 6 years ago

Sorry for the delayed response...

You can try running amodem send -cvv -l ALSA && amodem recv -cvv -l ALSA, when -l ALSA makes amodem to use aplay and arecord command-line tools (instead of PortAudio).

You can then tweak https://github.com/romanz/amodem/blob/master/amodem/alsa.py to make it work with your hardware. Please let me know if there is anything I can help with.

romanz commented 6 years ago

Regarding PortAudio configuration: I guess you can try setting input_device_index (following https://people.csail.mit.edu/hubert/pyaudio/docs/#pyaudio.Stream) but I never tried it by myself (since I have only one audio input on my machine).