Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python sounddevice stop recording

paused = False

def record():
    self.recording = ? # create numpy.ndarray of the correct size 
                       # (not sure the best way to do this without 
                       # knowing the recording duration)
    with sd.InputStream(samplerate=44100, device=mic, channels=1, 
        callback=self.callback):

            while self.paused:
            sd.stop()
        sd.rec(out=recording) # but what happens if 
                              # recording is very long
                              # or numpy array fills up?

def stop_and_save():
    sd.stop()
    scipy.io.wavfile.write("recording.wav", 44100, self.recording)
Comment

PREVIOUS NEXT
Code Example
Python :: python matplotlib pyplot set axis equals 
Python :: fillna with index 
Python :: 4D Array To DF 
Python :: how to count number from 1 to 10 in python 
Python :: geopandas with postgis 
Python :: Fastest way to Convert Integers to Strings in Pandas DataFrame 
Python :: how to convert a matrix string back to a matrix python 
Python :: python while variable is not 
Python :: set comprehension 
Python :: generate a list with random length and with random numbers python 
Python :: Django - Knox auth setup 
Python :: generate barcode using python 
Python :: fraction to float 
Python :: split a pd dataframe 
Python :: controlling the mouse with pynput 
Python :: what is modulus in python 
Python :: python program to demonstrate scoping 
Python :: create list of dictionaries from list of list python 
Python :: backend in python 
Python :: shape 
Python :: slicing in python list 
Python :: python create unreadable save file 
Python :: pandas assign multiple columns at once 
Python :: python range() float 
Python :: with torch.no_grad() if condition 
Python :: #index operator in python 
Python :: application automation python library 
Python :: time zone 
Python :: iterrows pandas 
Python :: python read hex file 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =