erdewit / HiFiScan

Optimize the audio quality of your loudspeakers
BSD 2-Clause "Simplified" License
977 stars 28 forks source link

M1 Air/Ventura - Invalid number of channels #15

Closed ianbashford closed 1 year ago

ianbashford commented 1 year ago

Hi,

I'm getting the following stack trace on the terminal (the GUI opens) but no sound output Would you be able to suggest anything I could try to diagnose further?

Error in task: Traceback (most recent call last): File "/Users/ian/miniconda3/envs/hifi/lib/python3.10/site-packages/hifiscan/app.py", line 638, in wrap_coro await coro File "/Users/ian/miniconda3/envs/hifi/lib/python3.10/site-packages/hifiscan/app.py", line 47, in analyze with hifi.Audio() as audio: File "/Users/ian/miniconda3/envs/hifi/lib/python3.10/site-packages/hifiscan/audio.py", line 24, in init self.stream = sd.Stream( File "/Users/ian/miniconda3/envs/hifi/lib/python3.10/site-packages/sounddevice.py", line 1800, in init _StreamBase.init(self, kind='duplex', wrap_callback='array', File "/Users/ian/miniconda3/envs/hifi/lib/python3.10/site-packages/sounddevice.py", line 898, in init _check(_lib.Pa_OpenStream(self._ptr, iparameters, oparameters, File "/Users/ian/miniconda3/envs/hifi/lib/python3.10/site-packages/sounddevice.py", line 2747, in _check raise PortAudioError(errormsg, err) sounddevice.PortAudioError: Error opening Stream: Invalid number of channels [PaErrorCode -9998] qt.pointer.dispatch: skipping QEventPoint(id=1 ts=0 pos=0,0 scn=953.95,724.344 gbl=953.95,724.344 Released ellipse=(1x1 ∡ 0) vel=0,0 press=-953.95,-724.344 last=-953.95,-724.344 Δ 953.95,724.344) : no target window

My environment is: MacBook Air M1 - default onboard input/output Ventura 13.1 Conda Python 3.10.9 Hifiscan installed using pip (pip install -U hifiscan)

thanks

Ian

erdewit commented 1 year ago

Can you show the output of running

python3 -m sounddevice

?

ianbashford commented 1 year ago

Sure

(hifi) ➜  ~ python3 -m sounddevice
  0 _ Microphone, Core Audio (1 in, 0 out)
> 1 MacBook Air Microphone, Core Audio (1 in, 0 out)
< 2 MacBook Air Speakers, Core Audio (0 in, 2 out)
  3 Microsoft Teams Audio, Core Audio (2 in, 2 out)
erdewit commented 1 year ago

Thanks. The problem is that the default device (the first listed) is expected to have two input/output channels.

Not sure how to fix this without getting into a device-dependent quagmire.

ianbashford commented 1 year ago

Oh I see - does that look like it was caused by MS Teams? I'll try removing some things - if you have any other ideas I'd be happy to try them...

thanks for the input

Ian

erdewit commented 1 year ago

The MS Teams should not be the issue. You can try a potential fix that was just applied:

pip install git+https://github.com/erdewit/HiFiScan
ianbashford commented 1 year ago

Thank you for the fast turnaround -- that works perfectly and is much appreciated.

Is there any more input you'd like now it's functioning?
If not I'll close as resolved

erdewit commented 1 year ago

Great to hear that it works, thx for letting me know. This is available in v1.4.3 now.