Commit 114392ce authored by Paul Bethge's avatar Paul Bethge
Browse files

clean-up

parent 95cd8b80
......@@ -9,6 +9,10 @@ from queue import Queue
def processAudio(config, q):
'''
Thread function that waits for tasks and solves them asynchronously. The queue
is used for communicating data to the thread.
'''
i = 0
while True:
try:
......@@ -24,35 +28,23 @@ def processAudio(config, q):
if __name__ == '__main__':
# parser = argparse.ArgumentParser()
# parser.add_argument('--input_file', type=str,
# required=True,
# help="path to the unbalanced_train_segments.csv")
# parser.add_argument('--num_threads', type=int,
# default=8,
# help="amount of worker threads")
# args = parser.parse_args()
# worker queue
queue = Queue()
someConfig = ''
worker = threading.Thread(target=processAudio, args=(someConfig, queue), daemon=True)
worker.start()
# Create an interface to PortAudio
p = pyaudio.PyAudio()
# define sampling parameters
chunk = 1024 # Record in chunks of 1024 samples
sample_format = pyaudio.paInt16 # 16 bits per sample
channels = 2
fs = 44100 # Record at 44100 samples per second
seconds = 1
filename = "output.wav"
p = pyaudio.PyAudio() # Create an interface to PortAudio
# open a stream to the input device
stream = p.open(format=sample_format,
channels=channels,
rate=fs,
......@@ -71,9 +63,4 @@ if __name__ == '__main__':
# Stop and close the stream
stream.stop_stream()
stream.close()
# Terminate the PortAudio interface
p.terminate()
# Close and terminate the stream
stream.close()
p.terminate()
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment