Skip to content

SWHear: input_device_index not used in stream_start #5

Open
@TimeTravel-0

Description

@TimeTravel-0

In SWHear.py, there is possibility to set the device by id in constructor/init. This id is verified (valid_input_devices function). Actually half of this class deals with selecting the right audio source. Finally, in stream_start, the following parameter to self.p.open() is missing:

input_device_index=self.device

...leading to opening the default (?) audio device, not the one specified.

So I suggest the following change in swhear.py:

replace self.stream=self.p.open(format=pyaudio.paInt16,channels=1, rate=self.rate,input=True,frames_per_buffer=self.chunk)
with self.stream=self.p.open(format=pyaudio.paInt16,channels=1, rate=self.rate,input=True,frames_per_buffer=self.chunk, input_device_index=self.device)
in line 146ff.

Btw. thanks for providing the audio/fft/graph sample. It is a nice starting point for visualizing the data captured by my "analog accelerometer connected to usb sound card" setup

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions