Skip to content

Commit

Permalink
pyaudio fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-jam committed Jun 2, 2022
1 parent 847fc71 commit 7aa6f51
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ def play_file(self, stream, wav_file, chunk, delay):

if self.module == self.experiment.sounddevice_module_name:
stream.start()
elif self.module == self.experiment.pyaudio_module_name:
stream.start_stream()

start_time = self.set_stimulus_onset()

Expand Down Expand Up @@ -279,8 +277,6 @@ def play_file(self, stream, wav_file, chunk, delay):

if self.module == self.experiment.sounddevice_module_name:
stream.stop()
elif self.module == self.experiment.pyaudio_module_name:
stream.stop_stream()

self.set_stimulus_offset()

Expand All @@ -299,8 +295,6 @@ def play_data(self, stream, wav_data, chunk, delay):

if self.module == self.experiment.sounddevice_module_name:
stream.start()
elif self.module == self.experiment.pyaudio_module_name:
stream.start_stream()

start_time = self.set_stimulus_onset()

Expand Down Expand Up @@ -334,8 +328,6 @@ def play_data(self, stream, wav_data, chunk, delay):

if self.module == self.experiment.sounddevice_module_name:
stream.stop()
elif self.module == self.experiment.pyaudio_module_name:
stream.stop_stream()

self.set_stimulus_offset()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ def close(self):
self.show_message(u"Closing audio device")
self.device.close()
if self.module == self.pyaudio_module_name:
self.device.stop_stream()
self.device.close()
self.device_init.terminate()
self.device = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,6 @@ def play_file(self, stream, wav_file, chunk, delay):

if self.module == self.experiment.sounddevice_module_name:
stream.start()
elif self.module == self.experiment.pyaudio_module_name:
stream.start_stream()

start_time = self.set_stimulus_onset()

Expand Down Expand Up @@ -285,8 +283,6 @@ def play_file(self, stream, wav_file, chunk, delay):

if self.module == self.experiment.sounddevice_module_name:
stream.stop()
elif self.module == self.experiment.pyaudio_module_name:
stream.stop_stream()

self.set_stimulus_offset()

Expand All @@ -308,8 +304,6 @@ def play_data(self, stream, wav_data, chunk, delay):

if self.module == self.experiment.sounddevice_module_name:
stream.start()
elif self.module == self.experiment.pyaudio_module_name:
stream.start_stream()

start_time = self.set_stimulus_onset()

Expand Down Expand Up @@ -337,8 +331,6 @@ def play_data(self, stream, wav_data, chunk, delay):

if self.module == self.experiment.sounddevice_module_name:
stream.stop()
elif self.module == self.experiment.pyaudio_module_name:
stream.stop_stream()

self.set_stimulus_offset()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ def record(self, stream, wav_file, chunk, delay_start, delay_stop):

if self.module == self.experiment.sounddevice_module_name:
stream.start()
elif self.module == self.experiment.pyaudio_module_name:
stream.start_stream()

start_time = self.set_stimulus_onset()

Expand Down Expand Up @@ -271,8 +269,6 @@ def record(self, stream, wav_file, chunk, delay_start, delay_stop):

if self.module == self.experiment.sounddevice_module_name:
stream.stop()
elif self.module == self.experiment.pyaudio_module_name:
stream.stop_stream()

wav_file.close()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ def close(self):
self.show_message(u"Closing audio device")
self.device.close()
if self.module == self.pyaudio_module_name:
self.device.stop_stream()
self.device.close()
self.device_init.terminate()
self.device = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ def record(self, stream, wav_file, chunk, delay_start, delay_stop):

if self.module == self.experiment.sounddevice_module_name:
stream.start()
elif self.module == self.experiment.pyaudio_module_name:
stream.start_stream()

start_time = self.set_stimulus_onset()

Expand Down Expand Up @@ -279,8 +277,6 @@ def record(self, stream, wav_file, chunk, delay_start, delay_stop):

if self.module == self.experiment.sounddevice_module_name:
stream.stop()
elif self.module == self.experiment.pyaudio_module_name:
stream.stop_stream()

wav_file.close()

Expand Down

0 comments on commit 7aa6f51

Please sign in to comment.