-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to play audio from in the Docker #484
Comments
@bryanhughes Line 65 in 4c4d742
Strangely I have the same Anker PowerConf usb and it works through pyaudio both for mic and speaker inside docker.... Have you listed the audio devices inside container with a script like this? |
Oh how nice, I'm on the same stage as @bryanhughes right now with my Anker S330 and Home Assistant containers :D |
@dusty-nv I have which corroborates what
Unfortunately when trying to play an audio I get:
My current approach is to debug by getting |
@bryanhughes try |
@dusty-nv Thanks but sadly no love...
Googling the message looks like it leads down the path of modifying the |
Also, this works:
Grasping at straws, this DOES NOT work:
|
This is somewhat related with my issues with
On my Orin with same Anker I faced this:
did you tried |
@ms1design Thanks for you help! Unfortunately I still get:
When I do:
This is because The PowerConf is current the default device on the host set in Settings (I am on the desktop). When I switch the host default output to the HDMI speaker in the monitor, I get the following on the original and converted:
So the same as you... I tried adding EDITED: To note, I now get the same thing on the host:
|
More information trying out
It doesnt work on the host, so at least the host and the docker are failing in the same way when specifying the device. Also, when the PowerConf is set as the |
That's interesting, @bryanhughes 🤔 I've finished enabling |
@ms1design I did not modify the ALSA configuration. What I am doing is creating a custom container with just nano_llm, whisper, and piper-tts. I can confirm that
Fails on both the host and in the container. Using
Also, when I set the default output to the PowerConf S3 through the desktop settings,
Now, when I keep the default output through the desktop settings, and go back to the container and try
|
Just an Update: I added |
So I am deep down the rabbit hole. It is clear this issue is not related to Docker, but to my host system, which I just re-flashed. Here is the updated information I posted in the Jetson Developer Forum: |
@bryanhughes @ms1design given the problems you were having, just went through this and found aplay doesn't like it when the wav file is mono and output device is stereo, because hw devices won't do format conversion or resampling for you: Don't believe it is related to Jetson, or your device needing re-flashed. The alsa-utils are cryptic to use and if you are developing for Python I would just use PyAudio. |
@dusty-nv Thank you. I will let you know the progress. I know more about |
@dusty-nv Just an update. I decided to take a step back and just see if the llama speaks demo runs, which it sort of does. The TTS part works but the ASR didnt, which I realize is because the Riva server needs to be started first. I decided to switch to the
From the documentation, it looks like Riva is built into the container, but not super clear on how to start it, and then start llama speaks. |
@dusty-nv @bryanhughes Now I'm happy that I spent that weekend resting rather than deep diving into Testing compatibilityFirst thing I did was just test using
|
@ms1design I think this is because jetson-containers does not mount devices like
Same here and I believe expected behavior for the Anker device, based on other sound devices I have that you also need to specify the correct sample rate and number of channels for.
Historically I have not used docker-compose in jetson-containers much because it you need to hard-code the full container name/tag in it (which require users to specify the version that is compatible with their version of JetPack-L4T - this is what Last summer when I re-did jetson-containers from relatively few monolithic dockerfiles into the modular build system it is now, I did initially try using docker-compose for it, but it was wholly inadequate for handling such complex builds (but once the containers are built, it is still fine to use minus the tagging/mounting issues mentioned above) |
@dusty-nv and @ms1design - Just wanted to add what I learned this weekend diving down the So for ASR (using whisper) I downsample from 48000 to 16000, and then for TTS (using the Cori voice on Piper) I upsample from 22050 to 48000. Everything is working nicely now. Thanks again @dusty-nv for you help and patience. I will respond to my post on the dev forum with the final solution. |
This could be less hassle in some cases, but I think adds another layer of complexity with managing the
I have the same feeling (I think it's the right "word" when facing |
If you guys wanna see how I handle resampling from Python, I use torchaudio, which is faster than librosa and can use CUDA: (this would be for if/when you control or patch the code in question, as opposed to trying to get another existing 3rd-party project running without modification) |
I think that there's no need for that - according to the arecord -D plughw:CARD=S330,DEV=0 -r 16000 -c 1 -f S16_LE -t wav -d 5 test.wav
aplay -D plughw:CARD=S330,DEV=0 test.wav The above works when device is defined following the docs: |
@dusty-nv - Thanks for all the help. @ms1design - thank you that is good to know. In my case, I am working towards real-time streaming which requires me to use the |
I successfully built a custom docker which included me creating a custom package where I needed to install the dependencies for the application that I am writing. After much trials this works great and everything is good.
My problem is that I am mounting my code base into the docker to run and develop my application. It uses pyaudio to record and playback audio from the attached Anker PowerConf S3 mic/speaker. This all works perfectly on the host but doesnt in the docker.
I can record audio and do a speaker-test with no problems, just playing back the audio doesnt work. I get
I found this solution, but it didnt work for me:
https://forums.developer.nvidia.com/t/how-to-access-usb-speaker-from-within-a-docker-container/231737
Here is my custom run script:
The text was updated successfully, but these errors were encountered: