How to control the I2S interface using C++ as direct as possible?


I would like to use the I2S interface to connect multi channel audio (Nano Orin).
I want to generate the audio samples using C++ code and send these as directly as possible to the I2S interface.
Is this possible? Or do I need to use some Linux audio interface/driver?

What is the preferred way to output multiple audio channels using I2S?

Hi mechamania,
Jetpack Linux release already have linux drivers for Audio interfaces like I2S. I believe you can utilize the goodness of existing linux driver to test audio on I2S interface.

You can test either from Linux commands or with userspace app on ubuntu gui to playback audio on I2S which exposes userspace ALSA mixer controls for configuration.

The above method is useful when your audio samples are present already on a wavefile or other audio format files.

If you want to send C++ generated data immediately, then you might need to write your own userspace app to start the playback and send your audio data on I2S.

Yes that is what I want. Using C++. Is there an API I can use? Where can I find information about this?

Hi mechamania,
Audio driver uses the ALSA based API interfaces which is a standard audio API for Linux. You can refer the ALSA Kernel API Documentation — The Linux Kernel documentation for ALSA API info.

May be you can refer some open source community for the similar app as there are few music players based on C++ for Linux which is built on top of ALSA.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.