This commit is contained in:
Frank DeMarco 2019-01-04 00:58:12 -05:00
parent 498755ef0e
commit 91fcfbc6bf
1 changed files with 3 additions and 2 deletions

View File

@ -61,7 +61,8 @@ class VideoRecorder(GameChild):
def audio_callback(in_data, frame_count, time_info, status):
self.audio_frames.append(in_data)
return (in_data, pyaudio.paContinue)
self.audio_stream = self.audio_recorder.open(format=pyaudio.paInt16, channels=2, rate=44100,
self.audio_stream = self.audio_recorder.open(format=pyaudio.paInt32, channels=2, rate=44100,
frames_per_buffer=1024,
input=True, stream_callback=audio_callback)
else:
self.write_frames()
@ -90,7 +91,7 @@ class VideoRecorder(GameChild):
self.audio_recorder.terminate()
wf = wave.open(join(root, "audio.wav"), "wb")
wf.setnchannels(2)
wf.setsampwidth(self.audio_recorder.get_sample_size(pyaudio.paInt16))
wf.setsampwidth(self.audio_recorder.get_sample_size(pyaudio.paInt32))
wf.setframerate(44100)
wf.writeframes(b"".join(self.audio_frames))
wf.close()