I am trying to use a USB microphone with python sound device and raspberry pi3B+. When I execute the script in the console typing $ python3 sound.py it runs and records all ok. But when I try to execute
sudo python3 sound.py it returns the error:
Error opening InputStream: Invalid sample rate [PaErrorCode -9997] Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
I need to use sudo to run my script. What can I do to solve it?