ALSA in Torizon Container on Verdin

Hi

I’m trying to figure out how I could generate sound from a C++ program in a container, running in Torizon. What devices should be forwarded? What library should be used? I’m still very new to Linux and software development for Linux. Any help is greatly appreciated! The hardware I’m using is a Verdin iMX8MM DL 1GB with a Verdin Development Board.

Kind regards,
Merijn

Hi @mvandenabeele!

We have this How to play audio on TorizonCore using Alsa and C/C++ article that can help you with the development process and also understand the steps that you need to take.

Best regards,

Thanks Henrique

I read that article before posting, but somehow I got confused and missed the link with container applications. I’ll have a look at it again.

Merijn

I got audio working pretty fast, based on the sample you’ve written. Now, I’m using a library that provides audio samples, but I think the samples are coming in to slow. There’s a slight hickup. I see snd_pcm_writei is used to send the samples to alsa, but is this the function I need to use when I don’t know up front how much samples will be generated?

Hi @mvandenabeele !

Good to know that the article helped you :slight_smile:

About this

Unfortunately I do not have a deep knowledge about Alsa usage/use cases. Maybe the folloing Stack Overflow question can help you, as the answers list several links with Alsa tutorials and sample projects.

Best regards,