I'm using sounddevice
to record and play audio with python. I'm using a very simple code which is running well from the python interpreter:
import sounddevice as sd
from time import sleep
fs = 44100
myrec = sd.rec(int(fs*3), samplerate=fs, channels=2)
sleep(3)
sd.play(myrec, fs)
However, when I'm trying to run this code from a python file (or using PyCharm) it just won't play. What is wrong with the code that's making it happen?