IoTGateway/BSP/Android/Gettingstarted/How to use Audio

From ESS-WIKI
Jump to: navigation, search

Audio Card List

# cat /proc/asound/cards
 0 [sgtl5000       ]: sgtl5000 - sgtl5000
                      sgtl5000


Andorid Audio tools

Tinycap

Record wav file

# tinycap
Usage: tinycap file.wav [-D card] [-d device] [-c channels] [-r rate] [-b bits] [-p period_size] [-n n_periods]

example:

# tinycap /data/test.wav -D 0
Capturing sample: 2 ch, 44100 hz, 16 bit

note: press ctrl+c to terminate tinycap if wanting to finish capturing

TinyPlay

# tinyplay
Usage: tinyplay file.wav [-D card] [-d device] [-p period_size] [-n n_periods]

example:

# tinyplay /data/test.wav -D 0
Playing sample: 2 ch, 44100 hz, 16 bit

Tinymix

Get mixers

# tinymix -D 0
Mixer name: 'sgtl5000'
Number of controls: 9
ctl     type    num     name                                     value
0       INT     2       PCM Playback Volume                      156 156
1       INT     2       Capture Volume                           15 15
2       BOOL    1       Capture Attenuate Switch (-6dB)          Off
3       BOOL    1       Capture ZC Switch                        On
4       INT     2       Headphone Playback Volume                103 103
5       BOOL    1       Headphone Playback ZC Switch             On
6       INT     1       Mic Volume                               0
7       ENUM    1       Headphone Mux                            DAC
8       ENUM    1       Capture Mux                              MIC_IN

Set mixer

# tinymix -D 0 0 192