Audio (i.MX31): Unterschied zwischen den Versionen
en>Peter K (1 Version importiert) |
Peter (Diskussion | Beiträge) K (1 Version importiert) |
(kein Unterschied)
|
Aktuelle Version vom 31. Oktober 2023, 09:03 Uhr
Kernel configuration
Audio is supported starting at BSP rel. 109. To enable Audio, perform the following changes in the kernel configuration:
Device Driver -> Sound Support -> Y Device Driver -> Sound Support -> Advanced Linux Sound Architecture -> Y Device Driver -> Sound Support -> Advanced Linux Sound Architecture -> OSS Mixer API -> Y Device Driver -> Sound Support -> Advanced Linux Sound Architecture -> OSS PCM (digital audio) API -> Y Device Driver -> Sound Support -> Advanced Linux Sound Architecture -> Alsa ARM Devices -> MXC PMIC sound System -> Y Device Driver -> Sound Support -> Advanced Linux Sound Architecture -> Alsa ARM Devices -> Playback stream mixing -> N (!!!)
Getting test soundfiles
Run the command
./ltib -m prep -p mxc-misc
This will unpack the misc package which you can find in ~/ltib5/rpm/BUILD/misc. If you search for *.wav files you will find a directory containing about 15 different wave files named audio%SampleFrequency%%BitsPerSample%%Mono/Stereo%.wav. Copy these to the directory ~/ltib5/rootfs/tmp so they will be available on the target.
Playing Audio
Two different sources for audio exist. You can either play audio on the stereo dsp, which can handle sample frequencies up to 96kHz, stereo. Or you can play audio on the voice codec, which can play audio files sampled at 8kHz or 16kHz, mono only. To play an audio file on the voice codec try the command:
aplay -N -M -D hw:0,1 audio16k16M.wav or aplay -N -M -D hw:0,1 audio8k16M.wav
Note that you cannot play files with a higher sample rate than 16kHz or with more than one channel.
To play an audio file on the stereo dsp, run the command:
aplay -N -M -D hw:0,0 audio44k16M.wav or aplay -N -M audio16k16S.wav
Note that you can play audio files up to 96kHz in stereo.
Recording Audio
Recording is only possible through the use of the voice codec. To record audio in maximum quality run the command
arecord -r 16000 -c 1 -f S16_LE -N -M -d 10 recording.wav // This will record 10 seconds of audio with 16bit/mono/16kHz on the voice codec
To play the recorded file use the command
aplay -N -M -D hw:0,1 recording.wav or aplay -N -M -D hw:0,0 recording.wav
depending on the device you want to use.
Playing an mp3 file
To play an mp3 file simply run the command
madplay file.mp3
Make sure the madplay package was selected in the system configuration.
Switch to Line - In
To switch to line in, start a recording and then run the following command:
atlas-regs -s 0x26=0x00422000
If you need this change to last, you might have to correct the part of the mxc sound driver which is called after a recording is started.