| 1 | [[PageOutline]] |
| 2 | |
| 3 | = Ventana Audio = |
| 4 | The Advanced Linux Sound Architecture (ALSA) system is the current audio driver subsystem in Linux. |
| 5 | |
| 6 | The hardware that is used: |
| 7 | * [http://cache.freescale.com/files/analog/doc/data_sheet/SGTL5000.pdf?pspll=1 Freescale SGTL5000] with line level input and output (standard board configuration) or (custom board configuration) |
| 8 | headphone level output (custom board configuration) - 45mW max into 16ohme@3.3V load, and mic input |
| 9 | * tda1997x (HDMI Audio in)(i.MX6) |
| 10 | * imxhdmisoc (HDMI Audio out)(i.MX6) |
| 11 | |
| 12 | For information regarding Audio / Video breakout adapters for Ventana see: |
| 13 | * [wiki:ventana/breakoutadapters Audio / Video breakout Adapters] |
| 14 | |
| 15 | Note that by default, Ventana family boards that have analog audio have a default strapping of [http://en.wikipedia.org/wiki/Line_level line level] audio (both input and output). However, there is an option to load Headphone level output/Mic level input on request. Please contact sales@gateworks.com if you would like a special built with these loadings. |
| 16 | |
| 17 | |
| 18 | == Devices == |
| 19 | The following commands are useful when dealing with multiple audio devices (These commands are done on a GW5400 which has multiple sources of audio in/out - different boards will have different devices at varied locations): |
| 20 | * see a list of all audio cards: |
| 21 | {{{ |
| 22 | $ cat /proc/asound/cards |
| 23 | 0 [sgtl5000audio ]: sgtl5000-audio - sgtl5000-audio |
| 24 | sgtl5000-audio |
| 25 | 1 [tda1997xaudio ]: tda1997x-audio - tda1997x-audio |
| 26 | tda1997x-audio |
| 27 | 2 [imxhdmisoc ]: imx-hdmi-soc - imx-hdmi-soc |
| 28 | imx-hdmi-soc |
| 29 | }}} |
| 30 | * There are 3 audio cards in the system: |
| 31 | * 0: sgtl5000audio (Analog Audio in/out) |
| 32 | * 1: tda1997xaudio (HDMI Audio in) |
| 33 | * 2: imxhdmisoc (HDMI Audio out) |
| 34 | * Note that this is only available for playback if the framebuffer is not blanked |
| 35 | * see a list of all playback devices: |
| 36 | {{{ |
| 37 | $ aplay -l |
| 38 | **** List of PLAYBACK Hardware Devices **** |
| 39 | card 0: sgtl5000audio [sgtl5000-audio], device 0: HiFi sgtl5000-0 [] |
| 40 | Subdevices: 1/1 |
| 41 | Subdevice #0: subdevice #0 |
| 42 | card 2: imxhdmisoc [imx-hdmi-soc], device 0: IMX HDMI TX mxc-hdmi-soc-0 [] |
| 43 | Subdevices: 1/1 |
| 44 | Subdevice #0: subdevice #0 |
| 45 | }}} |
| 46 | * the above shows 2 playback capable devices: |
| 47 | * card 0: the sgtl5000audio device which has one subdevice (0) - this can be represented as 'hw:0,0' |
| 48 | * card 2: the imxhdmisoc device which has one subdevice (0) - this can be represented as 'hw:2,0' |
| 49 | * Note that card 1 is not listed as it is an HDMI Audio input only and not capable of playback |
| 50 | * see a list of all playback device 'names' |
| 51 | {{{ |
| 52 | $ aplay -L |
| 53 | null |
| 54 | Discard all samples (playback) or generate zero samples (capture) |
| 55 | sysdefault:CARD=sgtl5000audio |
| 56 | sgtl5000-audio, |
| 57 | Default Audio Device |
| 58 | sysdefault:CARD=imxhdmisoc |
| 59 | imx-hdmi-soc, |
| 60 | Default Audio Device |
| 61 | }}} |
| 62 | * the above shows 3 playback devices shown by name (Note that this is the name what can be used with 'aplay -D <devicename>' to specify playback device): |
| 63 | * null - a null device |
| 64 | * sysdefault:CARD=sgtl5000audio - Analog audio out |
| 65 | * sysdefault:CARD=imxhdmisoc - HDMI audio out |
| 66 | * see a list of all capture devices: |
| 67 | {{{ |
| 68 | root@ventana:~# arecord -l |
| 69 | **** List of CAPTURE Hardware Devices **** |
| 70 | card 0: sgtl5000audio [sgtl5000-audio], device 0: HiFi sgtl5000-0 [] |
| 71 | Subdevices: 1/1 |
| 72 | Subdevice #0: subdevice #0 |
| 73 | card 1: tda1997xaudio [tda1997x-audio], device 0: IMX HDMI RX tda1997x-0 [] |
| 74 | Subdevices: 1/1 |
| 75 | Subdevice #0: subdevice #0 |
| 76 | }}} |
| 77 | * the above shows 2 capture capable devices: |
| 78 | * card 0: the sgtl5000audio device which has one subdevice (0) - this can be represented as 'hw:0,0' |
| 79 | * card 1: the tda1997xaudio device which has one subdevice (0) - this can be represented as 'hw:1,0' |
| 80 | * Note that card 2 is not listed as it is an HDMI Audio output only and not capable of capture |
| 81 | * see a list of all record device 'names': |
| 82 | {{{ |
| 83 | $ arecord -L |
| 84 | null |
| 85 | Discard all samples (playback) or generate zero samples (capture) |
| 86 | sysdefault:CARD=sgtl5000audio |
| 87 | sgtl5000-audio, |
| 88 | Default Audio Device |
| 89 | sysdefault:CARD=tda1997xaudio |
| 90 | tda1997x-audio, |
| 91 | Default Audio Device |
| 92 | }}} |
| 93 | * the above shows 3 capture devices shown by name (Note that this is the name what can be used with 'arecord -D <devicename>' to specify capture device): |
| 94 | * 'null' - a null device |
| 95 | * 'sysdefault:CARD=sgtl5000audio' - Analog audio in |
| 96 | * 'sysdefault:CARD=tda1997xaudio' - HDMI audio in |
| 97 | * display audio controls: |
| 98 | {{{ |
| 99 | amixer |
| 100 | }}} |
| 101 | * you can use the '-c <cardno>' parameter to amixer to specify a specific card (card number for /proc/asound/cards such as 'amixer -c 0' for the first card) |
| 102 | * see 'amixer -h' for details on setting/getting various controls |
| 103 | |
| 104 | |
| 105 | [=#amixer] |
| 106 | == Mixer (mux/gain/volume) == |
| 107 | The ALSA mixer controls the muxing of inputs to outputs, capture gains, and volume levels. The settings vary per card. |
| 108 | |
| 109 | You can use the amixer command to get/set/list available controls per card: |
| 110 | * list controls for card0: |
| 111 | {{{ |
| 112 | amixer -c0 |
| 113 | }}} |
| 114 | |
| 115 | |
| 116 | [=#amixer-sgtl5000] |
| 117 | === sgtl5000 (analog audio) === |
| 118 | Note that by default, Ventana family boards that have analog audio have a default strapping of [http://en.wikipedia.org/wiki/Line_level line level] audio (both input and output). |
| 119 | |
| 120 | However, there is an option to load Headphone level output and/or Mic level input on request. Please contact sales@gateworks.com if you would like a special built with these loadings. |
| 121 | |
| 122 | |
| 123 | [=#amixer-sgtl5000-lineout] |
| 124 | ==== Line Level Audio Output ==== |
| 125 | common amixer settings for line level audio: |
| 126 | {{{ |
| 127 | # set output level to max |
| 128 | amixer -c 0 -q sset "PCM" 100% |
| 129 | # set capture mux |
| 130 | amixer -c 0 -q sset "Capture Mux" LINE_IN |
| 131 | amixer -c 0 -q sset "Line In Function" on |
| 132 | # set capture gain |
| 133 | amixer -c 0 -q sset "Capture" 8 |
| 134 | }}} |
| 135 | |
| 136 | |
| 137 | [=#amixer-sgtl5000-hpout] |
| 138 | ==== Headphone Level Audio Output ==== |
| 139 | If you've ordered a board with HP level audio the following specifications apply: |
| 140 | * sgtl5000 can drive 45mW max into a 16ohm load at 3.3V (53mA) |
| 141 | |
| 142 | common amixer settings for headphone level audio: |
| 143 | {{{ |
| 144 | # Set zero cross detect gain |
| 145 | amixer -c 0 sset Headphone Playback ZC 60% |
| 146 | }}} |
| 147 | |
| 148 | In addition, you will also have to make a change to your device tree file in the kernel. Below is a sample patch of what you will have to do (filename depends on product you've ordered) |
| 149 | {{{ |
| 150 | #!diff |
| 151 | diff --git a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi |
| 152 | index ed71beb..1c0b229 100644 |
| 153 | --- a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi |
| 154 | +++ b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi |
| 155 | @@ -109,7 +109,7 @@ |
| 156 | audio-codec = <&codec>; |
| 157 | audio-routing = |
| 158 | "LINE_IN", "Line In Jack", |
| 159 | - "Line Out Jack", "LINE_OUT"; |
| 160 | + "Headphone Jack", "HP_OUT"; |
| 161 | mux-int-port = <1>; |
| 162 | mux-ext-port = <4>; |
| 163 | }; |
| 164 | }}} |
| 165 | |
| 166 | The defaults for the analog audio (which are found by running 'amixer' with no args) are: |
| 167 | * Output Level (PCM) (0 - 192) |
| 168 | * Front Left: Playback 192 [100%] |
| 169 | * Front Right: Playback 192 [100%] |
| 170 | * Capture Mux (MIC_IN or LINE_IN) |
| 171 | * MIC_IN |
| 172 | * Capture Gain (0-15): |
| 173 | * Front Left: Capture 5 [33%] |
| 174 | * Front Right: Capture 6 [40%] |
| 175 | |
| 176 | |
| 177 | |
| 178 | [=#amixer-hdmi-out] |
| 179 | === HDMI (digital audio) === |
| 180 | |
| 181 | The '''imxhdmisoc''' audio (output only) device can be used to send digital audio to a connected (and unblanked) HDMI monitor that has speakers. |
| 182 | |
| 183 | The '''tda1997xaudio''' audio (input only) device (on GW5400 models) can be used to capture digital audio from a connected (and unblanked) HDMI source that streams audio. Note that HDMI audio supports multiple sample-rates and the sample-rate available to capture depends on the incoming source stream. The source stream's audio sample rate can be found via sysfs /sys/bus/i2c/drivers/tda1997x/2-0048/audmode |
| 184 | |
| 185 | |
| 186 | [=#alsa-utils] |
| 187 | == ALSA utility (alsa-utils package) examples (arecord/aplay) == |
| 188 | The alsa-utils package contains the arecord, aplay, amixer applications |
| 189 | |
| 190 | aplay: |
| 191 | * playback pre-recorded sound to analog audio device (GW54xx/GW53xx/GW52xx) |
| 192 | {{{ |
| 193 | aplay -D sysdefault:CARD=sgtl5000audio /usr/share/sounds/alsa/Front_Center.wav |
| 194 | }}} |
| 195 | * playback pre-recorded sound to HDMI audio output device |
| 196 | {{{ |
| 197 | aplay -D sysdefault:CARD=imxhdmisoc /usr/share/sounds/alsa/Front_Center.wav |
| 198 | }}} |
| 199 | |
| 200 | arecord: |
| 201 | * record 10 seconds of CD quality audio (16bit, 44.1KHz, stereo) from analog audio device to /tmp/foo.wav |
| 202 | {{{ |
| 203 | arecord -D sysdefault:CARD=sgtl5000audio -f cd -d 10 -t wav /tmp/foo.wav |
| 204 | }}} |
| 205 | * make sure you have specified the capture gain and input device (see above) |
| 206 | |
| 207 | |
| 208 | == Codecs == |
| 209 | For Codec support (Encoder / Decoder) details please see: |
| 210 | * [wiki:ventana/codec Ventana Codecs] |
| 211 | |
| 212 | |
| 213 | |
| 214 | [=#gstreamer] |
| 215 | == Gstreamer examples == |
| 216 | For GStreamer information and examples please see: |
| 217 | * [wiki:Yocto/gstreamer/audio GStreamer Audio Wiki Page] |