Skip to content

Commit

Permalink
Use process_buffer from backend instance
Browse files Browse the repository at this point in the history
  • Loading branch information
dreinsch committed Aug 21, 2023
1 parent 411802f commit 96c3362
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions pya/arecorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@
_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())

PYAUDIO_PACONTINUE = 0
try:
import pyaudio
except ImportError:
pass
else:
assert PYAUDIO_PACONTINUE == pyaudio.paContinue


class Arecorder(Aserver):
"""pya audio recorder Based on pyaudio, uses callbacks to save audio data
for pyaudio signals into ASigs
Expand Down Expand Up @@ -115,7 +106,7 @@ def _recorder_callback(self, in_data, frame_count, time_info, flag):
self.record_buffer.append(data_float)
# E = 10 * np.log10(np.mean(data_float ** 2)) # energy in dB
# os.write(1, f"\r{E} | {self.block_cnt}".encode())
return None, PYAUDIO_PACONTINUE
return self.backend.process_buffer(None)

def record(self):
"""Activate recording"""
Expand Down

0 comments on commit 96c3362

Please sign in to comment.