-
Notifications
You must be signed in to change notification settings - Fork 90
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
AudioCapture throws DllNotFoundException "asound" in Moby Container running on Raspbian GNU/Linux 10 (buster) #50
Comments
Hi Nicolas, The Linux versions of the An approach might be to test your audio hardware and
You can list available capture ( Once in \psi, the Hopefully this is helpful. Please let us know how this goes! |
Hi Ashley, Thanks a lot for your feedback! I've tried to run the Also the microphone is listed under the available capture hardware list. I could imagine that there's a package missing in my Container. I've added a few more and now I've installed the following:
Could you think of any other package I could try? Or do you have any other idea what could go wrong? |
I'm at a loss, honestly. I don't see how Is the
Or, if not, is its location listed in |
It looks like
I guess that indicates that
In my understanding the default DeviceName should be correct: Do you see any other reason why the |
Seems like I didn't set the Container Options correctly that's why Alsa probably wasn't able to find the Device. However after fixing that I still get the following not very detailed Exception:
|
We're down to a configuration problem I believe. What name and other parameters work when using The failure to open could be due to the name, mode, rate, channels, format, ... I'd try to get it working with BTW, I believe that
|
The following works to record a Wave file: I don't get the names with
However I guess if arecord with 1,0 works I have to use plughw:1,0 as DeviceName.
|
To summarize, the following works on your hardware:
And the following throws with "Read recovery failed." in \psi:
I'm curious, did Also does Assuming none of this works, the next thing I can think of is to clone and build \psi locally and debug to see what the actual |
The following works with arecord:
Yes exactly I get the warning regarding the 16000Hz that's why I'm using 44100.
I'll try to clone the library and check the error number. |
I cloned the library and added Logs in the LinuxAudioInterop class. |
Humm... I'm not able to make sense of those. I wish I could repro on my end. My next step would be to try to get a simple C program to run using just the ALSA APIs and then figure out what is wrong with the \psi wrapper. This could very well be a bug in \psi and I feel like I'm having you do my job for me at this point :) If possible, could you try building and running this sample app? |
I'm able to run your sample app without any error:
To make sure the problem is not due to an incorrect Device mapping in my container I've built a little sample Net Core Console App to run it on the host directly.
However I get the same output (added some more logs):
|
Just tested on a different Linux Device (Debian, arm7 32bit).
|
Can I see the code producing this "Read error number" message? It seems like some fixednum conversion or sign extending or some such problem with reporting the error code. In fact, a positive error number from None of these error codes are making any sense (e.g. Also, does the sample C app work on this new hardware? |
It's the same code I posted 2 comments ago. I did all my tests with that one. |
I just added a .NET project to the Linux Audio test repo. This is not using \psi, but is using the same p/invokes directly to the ALSA APIs. There must be a difference between the calls being made by the working C app and either this .NET sample (if it fails) or \psi. Examining the code though, I'm failing to see it... |
I tested the .NET sample and this one returns the following output and error code:
We even tested with different microphones/soundcards but always the same result.. It works with arecord and the c app but not with the C# apps. |
Looking closely at the C (working) vs. C# (broken) samples, the only difference I see is that the C version is actually not freeing the Perhaps, could you try uncommenting this line in the C code. If that fails, then perhaps you could try commenting out this line in the C# sample and/or this line in the \psi component. I'd be interested to hear the result! I guess the theory would be that something under the covers may be holding a reference? |
Yes, I noticed that as the only difference between the C# and the C sample. And I tried to comment that line out in C# but sadly that didn't change anything. I even checked if all the parameters match, which is the case. |
I'm glad you have somewhat of a workaround; capturing outside of \psi with Thanks so much for pushing on this. We've added ALSA error output to our component (next release) and will hopefully figure this bug out at well. |
Thank's for putting in so much of effort to try to help me!
And the following hardware:
I will keep myself updated regarding this and I'm looking forward to use the psi library in future projects. If you need further information or if I can help in any way you can reach out to me. |
Okay I got a Raspberry Pi and I think I've figured it out. It's that the P/Invokes of the ALSA APIs are assuming 64-bit while Raspbian is 32-bit ARM. We'll get the fix into the next release. I updated the little sample test app here. To patch this in \psi you could change these two P/Invokes to take Thanks again for bringing this bug to our attention! |
This is now fixed in the latest release. We're closing this issue now. Thanks once again for bringing this to our attention. |
I'm trying to do an AudioCapture in a Moby Container (Azure IoT Edge) running on Raspbian GNU/Linux 10 (buster).
The following packages are installed (in the Container and on the host):
Below is the Exception I get:
Here's the code I'm using:
I've tested the solution on a Windows machine, there it works without any problem.
The text was updated successfully, but these errors were encountered: