Difference between revisions of "ALSA"

From ArmadeusWiki
Jump to: navigation, search
m (Introduction)
m (class apf)
Line 22: Line 22:
 
==Usage==
 
==Usage==
 
* load the ALSA drivers:
 
* load the ALSA drivers:
 +
<pre class="apf">
 
  # modprobe spi_imx
 
  # modprobe spi_imx
 
  # modprobe snd-imx-alsa-tsc2102
 
  # modprobe snd-imx-alsa-tsc2102
Line 40: Line 41:
 
  hwmon                    948  1 tsc2102
 
  hwmon                    948  1 tsc2102
 
  spi_imx                9024  0
 
  spi_imx                9024  0
 
+
</pre>
 
* if you want OSS support:
 
* if you want OSS support:
 +
<pre class="apf">
 
  modprobe snd-pcm-oss
 
  modprobe snd-pcm-oss
 
  modprobe snd-mixer-oss
 
  modprobe snd-mixer-oss
 +
</pre>
 
* If you want MIDI sequencer support:
 
* If you want MIDI sequencer support:
 +
<pre class="apf">
 
  modprobe snd-seq
 
  modprobe snd-seq
 
  modprobe snd-seq-device
 
  modprobe snd-seq-device
 +
</pre>
  
 
===Loading script===
 
===Loading script===
 
If you want the drivers to be loaded automatically during each boot, you can add a script in ''/etc/init.d/''. For example:
 
If you want the drivers to be loaded automatically during each boot, you can add a script in ''/etc/init.d/''. For example:
 
+
<pre class="apf">
 
  # vi /etc/init.d/S60alsa
 
  # vi /etc/init.d/S60alsa
 +
</pre>
 
<source lang="bash">
 
<source lang="bash">
 
#!/bin/sh
 
#!/bin/sh
Line 58: Line 64:
 
modprobe snd-imx-alsa-tsc2102
 
modprobe snd-imx-alsa-tsc2102
 
</source>
 
</source>
 
+
<pre class="apf">
 
  # chmod a+x /etc/init.d/S60alsa
 
  # chmod a+x /etc/init.d/S60alsa
 +
</pre>
  
 
==Test==
 
==Test==
 
* Check if ALSA is running:
 
* Check if ALSA is running:
 +
<pre class="apf">
 
  # cat /proc/asound/version
 
  # cat /proc/asound/version
 
  Advanced Linux Sound Architecture Driver Version 1.0.17.
 
  Advanced Linux Sound Architecture Driver Version 1.0.17.
 +
</pre>
  
 
* To check if the [[TSC2102]] was detected as a sound chip:
 
* To check if the [[TSC2102]] was detected as a sound chip:
 +
<pre class="apf">
 
  # aplay -lL
 
  # aplay -lL
 
  default:CARD=IMX-ALSA
 
  default:CARD=IMX-ALSA
Line 81: Line 91:
 
   0 [IMX-ALSA      ]: IMXALSA - ARMADEUS IMX_ALSA
 
   0 [IMX-ALSA      ]: IMXALSA - ARMADEUS IMX_ALSA
 
                       ARMADEUS IMX_ALSA
 
                       ARMADEUS IMX_ALSA
 
+
</pre>
 
* To play a test sound:
 
* To play a test sound:
 +
<pre class="apf">
 
  # aplay /usr/share/sounds/alsa/Side_Left.wav
 
  # aplay /usr/share/sounds/alsa/Side_Left.wav
 
  Playing WAVE '/usr/share/sounds/alsa/Side_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
 
  Playing WAVE '/usr/share/sounds/alsa/Side_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
 +
</pre>
  
 
Note: the audio file Side_Left.wav can be copied from your Linux host (if not already on your rootfs)
 
Note: the audio file Side_Left.wav can be copied from your Linux host (if not already on your rootfs)

Revision as of 09:55, 6 February 2009

This page will summarize the informations to use ALSA on your Armadeus boards.

Introduction

ALSA stands for Advanced Linux Sound Architecture and provides audio and MIDI functionality to the Linux operating system. Everyone wanting to write portable & state of the art Linux applications dealing with sound should consider using ALSA.
ALSA is composed of a low level part (target specific Linux drivers) and a userspace library (libasound).

Hardware

On the i.MX family, used on the Armadeus boards, (good quality) sound can be produced that way: the i.MX takes PCM data (ALSA format) from memory and send them (through DMA) to its SSI interface. This one converts the data to a serial stream of bits in the I2S format. That stream is sent to a CODEC like the TSC2102 on the APF9328 or the TSC2101 on the APF27. The stream is then converted by the CODEC's DAC to an analog sound.

ALSA Soc

On the APF boards we are going to use Embedded version of ALSA: ALSA Soc ->

But for the moment only "standard" version is functionnal.

Installation

ALSA is now by default installed on the standard Armadeus rootfs. If you want to change default configuration, you can consult this wiki page: ALSA_Installation

Usage

  • load the ALSA drivers:
 # modprobe spi_imx
 # modprobe snd-imx-alsa-tsc2102
 TI TSC2102 driver initializing
 audio_dma_request done (8)
 audio_dma_request done (9)
 audio support initialized

 # lsmod
 Module                  Size  Used by    Not tainted
 snd_imx_alsa_tsc2102     7204  0
 snd_pcm                50760  1 snd_imx_alsa_tsc2102
 snd_timer              14084  1 snd_pcm
 snd_page_alloc          3208  1 snd_pcm
 snd                    28916  3 snd_imx_alsa_tsc2102,snd_pcm,snd_timer
 soundcore               3332  1 snd
 tsc2102                10256  1 snd_imx_alsa_tsc2102
 hwmon                    948  1 tsc2102
 spi_imx                 9024  0
  • if you want OSS support:
 modprobe snd-pcm-oss
 modprobe snd-mixer-oss
  • If you want MIDI sequencer support:
 modprobe snd-seq
 modprobe snd-seq-device

Loading script

If you want the drivers to be loaded automatically during each boot, you can add a script in /etc/init.d/. For example:

 # vi /etc/init.d/S60alsa
#!/bin/sh
  
modprobe spi_imx
modprobe snd-imx-alsa-tsc2102
 # chmod a+x /etc/init.d/S60alsa

Test

  • Check if ALSA is running:
 # cat /proc/asound/version
 Advanced Linux Sound Architecture Driver Version 1.0.17.
  • To check if the TSC2102 was detected as a sound chip:
 # aplay -lL
 default:CARD=IMX-ALSA
    ARMADEUS IMX_ALSA, imx alsa pcm
    Default Audio Device
 null
    Discard all samples (playback) or generate zero samples (capture)
 **** List of PLAYBACK Hardware Devices ****
 card 0: IMX-ALSA [ARMADEUS IMX_ALSA], device 0: IMX PCM [imx alsa pcm]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
or
 # cat /proc/asound/cards
  0 [IMX-ALSA       ]: IMXALSA - ARMADEUS IMX_ALSA
                       ARMADEUS IMX_ALSA
  • To play a test sound:
 # aplay /usr/share/sounds/alsa/Side_Left.wav
 Playing WAVE '/usr/share/sounds/alsa/Side_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

Note: the audio file Side_Left.wav can be copied from your Linux host (if not already on your rootfs)

Going further

Now that ALSA is working, you can switch to serious things ;-) ->

Links