Skip to content

antonjan/python_audio

Repository files navigation

python_audio

This repository will have my python audio coded

Python modules you need

sudo -H pip3 install sounddevice
sudo -H pip3 install soundfile

Find out what audio interface is avalabale

sudo python3 -m sounddevice
0 HDA Intel PCH: ALC3246 Analog (hw:0,0), ALSA (2 in, 0 out)
< 1 HDA Intel PCH: HDMI 0 (hw:0,3), ALSA (0 in, 8 out)
2 HDA Intel PCH: HDMI 1 (hw:0,7), ALSA (0 in, 8 out)
3 HDA Intel PCH: HDMI 2 (hw:0,8), ALSA (0 in, 8 out)
4 HDA Intel PCH: HDMI 3 (hw:0,9), ALSA (0 in, 8 out)
5 HDA Intel PCH: HDMI 4 (hw:0,10), ALSA (0 in, 8 out)
6 sysdefault, ALSA (128 in, 0 out)
7 hdmi, ALSA (0 in, 8 out)
8 samplerate, ALSA (128 in, 0 out)
9 speexrate, ALSA (128 in, 0 out)
10 upmix, ALSA (8 in, 0 out)
11 vdownmix, ALSA (6 in, 0 out)

12 default, ALSA (128 in, 0 out)

0 HDA Intel PCH: ALC3246 Analog (hw:0,0), ALSA (2 in, 0 out)

Playing 1khz tone to specker devce (0 and 6 should work as seen above)

sudo python3 play_sound_file.py 1kHz_44100Hz_16bit_05sec.wav -d 0

Testing sending mic input to soundcard

sudo python3 ./wire.py -i 0 -o 0 -s48000 -c1
or try
sudo python3 ./wire.py -i 6 -o 6 -s44000 -c1
You should here feedback on specker from microphone change -i and -o to your interface
optional arguments:
-h, --help show this help message and exit
-i INPUT_DEVICE, --input-device INPUT_DEVICE
input device ID or substring
-o OUTPUT_DEVICE, --output-device OUTPUT_DEVICE
output device ID or substring
-c CHANNELS, --channels CHANNELS
number of channels
-t DTYPE, --dtype DTYPE
audio data type
-s SAMPLERATE, --samplerate SAMPLERATE
sampling rate
-b BLOCKSIZE, --blocksize BLOCKSIZE
block size
-l LATENCY, --latency LATENCY
latency in seconds

Releases

No releases published

Packages

No packages published