$ sudo apt update
$ sudo apt upgrade
$ sudo apt install python3
$ sudo apt install code
$ code .
Then:
- Install Python Extension
- Preferences: Configure Runtime Arguments --> Set "disable-hardware-acceleration": true
$ sudo apt install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev flac
$ python3 -m venv venv
$ . venv bin activate
$ pip install pyaudio requests websockets
$ lsusb
$ arecord -l
$ cat /proc/asound/cards
$ cat /proc/asound/modules
Set the default card in:
$ sudo nano /usr/share/alsa/alsa.conf
E.g. for card 2:
defaults.ctl.card 2
defaults.pcm.card 2
Save the file and reboot:
$ sudo reboot
$ arecord -d 5 -r 48000 test.wav
$ aplay test.wav
import pyaudio
p = pyaudio.PyAudio()
for i in range(p.get_device_count()):
print(p.get_device_info_by_index(i).get('name'))
Run sr.py:
$ python sr.py