Skip to content
Permalink
Browse files

Get format and channels from PyAudioCodec in PyAudioDeviceInputStream

  • Loading branch information
romanroibu committed Nov 21, 2019
1 parent c939764 commit dbb23452e6fb4f39378ffe10a340b7b92c4d847b
Showing with 9 additions and 2 deletions.
  1. +9 −2 pupil_audio/pyaudio.py
@@ -15,6 +15,7 @@


class PyAudioCodec(Codec[str]):

# https://stackoverflow.com/a/22644499/1271958

def __init__(self, channels: int, format:int=None, dtype:np.dtype=None):
@@ -81,8 +82,6 @@ class PyAudioDeviceInputStream(InputStreamWithCodec[str]):

def __init__(self, name, channels, frame_rate, format=None, dtype=None, session=None):
self.name = name
self.format = format
self.channels = channels
self.frame_rate = frame_rate
self.session = session
self.stream = None
@@ -121,6 +120,14 @@ def close(self):
_destroy_pyaudio_session(self.session)
self.stream = None

@property
def format(self) -> int:
return self._codec.format

@property
def channels(self) -> int:
return self._codec.channels

@property
def sample_width(self):
with _pyaudio_session_context() as session:

0 comments on commit dbb2345

Please sign in to comment.
You can’t perform that action at this time.