Sample code to open, config and send sound file using MX27PDK PMIC audio device

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sample code to open, config and send sound file using MX27PDK PMIC audio device

4,221 Views
Durian
Contributor I

Hi, can anyone post a simple sample app code to open and use the PMIC audio device so that I can emit some sound on the speakers? This is on the MX27PDK platform.

 

Thanks

0 Kudos
Reply
7 Replies

1,286 Views
fabio_estevam
NXP Employee
NXP Employee

A quick way to get audio out is to run aplay on the MX27PDK:

aplay file.wav

 

You need to select alsa-utils and alsa-libs in LTIB (under Package list).

 

Regards,

 

Fabio Estevam

0 Kudos
Reply

1,286 Views
Durian
Contributor I

Thanks for your reply.

 

I was hoping to just do something like open(/dev/snd/pcmc0d0p, O_RDWR) and then do ioctl and write on it to emit the sound. My app is really simple and I was hoping not to have to use aplay.

 

Does the PDK distro come with the source code for aplay so that maybe I can see how it in turn calls /dev/snd/pcmc0d0p?

 

Thanks again

0 Kudos
Reply

1,286 Views
fabio_estevam
NXP Employee
NXP Employee

You can also try to inspect the mxc_ssi_test source available under the unit tests.

 

Regards,

 

Fabio Estevam

0 Kudos
Reply

1,286 Views
Pats
Contributor I

I have been trying to get the mxc_ssi_tests going on my PDK and the compiler is unable to find a couple of header files pertaining to mc13783  . Missing files include  mc13783_legacy/core/mc13783_external.h, mc13783_legacy/module/mc13783_audio.h,  Of course the compilation fails, as references to declarations in this header file are missing.                                                                                                                     What I would like to know is how to solve this problem? I have selected all drivers pertaining to PMIC while compiling the kernel?

0 Kudos
Reply

1,286 Views
Durian
Contributor I

Fabio:

 

When you do aplay /dev/urandom, do you hear a sound on the MX27PDK?

0 Kudos
Reply

1,286 Views
fabio_estevam
NXP Employee
NXP Employee

No, you should use aplay as follows:

 

aplay file.wav

 

Why don't you just use aplay?

 

If you need aplay source code:

 

./ltib -p alsa-utils -m prep

 

then go to:

 

cd rpm/BUILD/alsa-utils-1.0.11rc2/aplay/aplay.c

 

Regards,

 

Fabio Estevam

0 Kudos
Reply

1,286 Views
Durian
Contributor I

Fabio, so playing /dev/urandom will not emit any sound?

 

Do I need to set up any config file in /etc for aplay to work?

 

Do you know where I can get a small wav file that emits a short click sound? This is played whenever we press a button on the keypad on our target board.

 

Thanks

0 Kudos
Reply