I'm very new to Python,so I have small projet to get use to know more about Python, my project is simple, just recording audio use sounddevice
but problem is , in documentary, it only record if have static seconds like code sample code below,and i have no idea how to stop or pause recording,in my case is press a key, like "enter to stop, shift to pause"
import sounddevice as sd
import soundfile as sf
import time
def sync_record(filename, duration, fs, channels):
print('recording')
myrecording = sd.rec(int(duration * fs), samplerate=fs, channels=channels)
sd.wait()
sf.write(filename, myrecording, fs)
print('done recording')
# playback file
sync_record('sync_record.wav', 10, 16000, 1)
so my question is, how can i pause and record audio with no duration required, and how to stop and pause that use sounddevice
, thank you guys a lot