• Ready for review
  • Using Audio in Linux

    Play Sound

    To play a sound (i.e. test.wav) to the current audio output:

    $ aplay test.wav

    See options with 'aplay -h'

    Record Sound

    To record sound from the current audio-input source to test.wav:

    $ arecord test.wav

    Stop recording by pressing 'CTRL-C'.
    See options with 'arecord -h'.

    Configure Audio Device

    Before using audio you might need to do some configuration; i.e. un-mute audio-output or select the audio input source.
    In Linux, this can be done by the Advanced Linux Sound Architecture (ALSA): https://www.alsa-project.org

    AlsaMixer

    The AlsaMixer utility provides an easy way to modify audio-settings using a graphical interface.

    $ alsamixer

    Press 'F1' for details on how to use it.
    Usually, you will use:

    1. the left and right arrow keys to move between the controls

    2. up and down keys change the volume setting of a control

    3. 'm'-key to toggle 'mute' setting or enable/disable a switch setting.

    AMixer

    AMixer is a command-line utility to view and modify audio settings.
    Use

    to view available options.

    View Available Controls

    To have a look at available controls use:

    Get Value of Control

    I.e. to get the current headphone volume use:

    Set Value of Control

    Mute/Unmute Control

    Unmute Headphone output:

    Mute Headphone output:

    Setup ALSA

    ALSA can be configured through /etc/asound.conf.
    Below is an excerpt of the asound.conf of Trizeps VIII Yocto image:

    'pcm.!default' is the standard entry, which is used by all programs to route their audio-data – unless otherwise told.
    'slave.pcm' tells to route audio to pcm.asymed, which will use dmix_48000 configuration for playback and dsnoop_48000 for capture.