Project

General

Profile

Using Audio jacks

The 335x provides an ALSA driver in the kernel for recording and playing audio files.

To learn more about ALSA you can read up on it here: http://www.alsa-project.org/main/index.php/Main_Page

Using ALSA tools to record/play wav files

Recording:

# Unmute the microphone
amixer set PCM 100 on || echo "Unable to set mixer control for PCM" 
# Record in dat file format for 3 seconds.
arecord -f dat -d 3 > test.wav || echo "Unable to run arecord" 

Playback:

# Unmute the speaker
amixer set PCM 100 on || echo "Unable to set mixer control for PCM" 
# Playback wav file
aplay test.wav || echo "aplay failed" 

Integrating with Application

Gstreamer is one possibility for integrating sound into your application.

Source: https://developer.ridgerun.com/wiki/index.php/LeopardBoard_GStreamer_Pipelines#Audio_Input

Recording:

# Record into mp4 format until canceled
gst-launch -e alsasrc ! 'audio/x-raw-int,rate=(int)44100,channels=(int)2' ! queue ! ffenc_aac bitrate=128000 ! qtmux ! filesink location=audio_aac.mp4

Playback:

gst-launch filesrc location=audio_aac.mp4 ! qtdemux ! ffdec_aac ! alsasink

If there are issues setting mixer levels with the ALSA tools, you can set the volume directly in the gst-launch command with the 'volume' element. The volume is set on a scale from '0' to '1' with '1' being 100% of the input level. Here's the same gst-launch playback command with the volume set to 50% of the original level.

gst-launch filesrc location=audio_aac.mp4 ! qtdemux ! ffdec_aac ! volume volume='0.5' ! alsasink

Note: gst-inspect can be used to identify what pipelines are available.

Read up on the following for more info on gstreamer: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/

Audo playback linux applications

The following programs should be available to install via opkg.

  • vlc - 1.1.4.1-r0.6 - Video player and streamer - davinci edition
  • mplayer - 0.0+1.0rc3+svnr32735-r27.6 - Open Source multimedia player.
  • madplay - 0.15.2b-r0.6 - Madplay is a command-line MPEG audio decoder and player
  • ffmpeg - 2:0.6.1+r17.1+gitr0+0b32da90f893b3e04ead18a546252e241a6a0988-r17.1.6 - FFmpeg is a complete solution to record, convert and stream audio and video

Go to top
Add picture from clipboard (Maximum size: 1 GB)