kyutai-labs / moshi

Apache License 2.0
6.74k stars 523 forks source link

Internal PortAudio error #95

Closed 13331112522 closed 1 month ago

13331112522 commented 1 month ago

Backend impacted

The MLX implementation

Operating system

Mac OS X

Hardware

Metal with MLX

Description

Info: [CLIENT] received 'start' from server, starting...


||PaMacCore (AUHAL)|| Error on line 2744: err=''what'', msg=Unspecified Audio Hardware Error Process Process-1: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/moshi_mlx/local.py", line 248, in client asyncio.run(go()) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/moshi_mlx/local.py", line 244, in go with in_stream, out_stream: ^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/sounddevice.py", line 1103, in enter self.start() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/sounddevice.py", line 1121, in start _check(err, 'Error starting stream') File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/sounddevice.py", line 2774, in _check raise PortAudioError(errormsg, err) sounddevice.PortAudioError: Error starting stream: Internal PortAudio error [PaErrorCode -9986]

Extra information

python -m moshi_mlx.local -q 4

Environment

Fill in the following information on your system.

If the backend impacted is PyTorch:

If the backend is MLX:

akshatvishu commented 1 month ago

It's possible that the app you're using to run these commands doesn't have permission to access the microphone. In which case, you can follow the instruction from this LINK to give it access or maybe try to un-install and re-install PortAudio as this is mostly looking like an issue with PortAudio then with Moshi.

brew uninstall portaudio
brew install portaudio --HEAD
13331112522 commented 1 month ago

Install portaudio, but can't work still.

Attached with screenshot when running local_web. No error without any audio output.

截屏2024-09-21 22 48 11

python -m moshi_mlx.local -q 4

截屏2024-09-21 22 54 45
akshatvishu commented 1 month ago

I noticed this might be a different issue from the original problem being discussed. As a general suggestion, it's often helpful to tackle one problem per issue to keep things organized. For this specific situation, you might want to try running the web UI instead of the local version to take advantage of echo cancellation and LAG frame skip, as mentioned in the README (line no. 44 to be exact).

13331112522 commented 1 month ago

Thanks for the suggestion. But I did run the web_ui with 'python -m moshi_mlx.local_web -q 4' and resulted in the screenshot as I uploaded first. I can't talk with it because it can not output any audio and soon close the connection.

LaurentMazare commented 1 month ago

I've tested the mlx q4 version on a m3 air 16G and it works fine there, it's quite possible that having only 8G of memory is the issue here. You can try closing as many apps as possible but I doubt it would be enough even with that.

LaurentMazare commented 1 month ago

Closing for now, feel free to reopen if you still have issues and see ways where we can help.