How to save Pyaudio recording as ogg directly?

119 Views Asked by At

Is it possible to record pyaudio to OGG Vorbis? Currently this sample code records the output to wav:

print("Recording started.")
sample_width, data = record()
data = pack('<' + ('h'*len(data)), *data)

wf = wave.open(path, 'wb')
wf.setnchannels(1)
wf.setsampwidth(sample_width)
wf.setframerate(RATE)
wf.writeframes(data)
wf.close()
print(f"Finished recording {path}")
results["finished"] = True

Is it possible to record directly as OGG Vorbis without converting from wav to ogg? Thank you!

0

There are 0 best solutions below