Audio input & output

Firefly-PX3-SE has 3 outputs for audio and 2 inputs for audio.The 3 audio outputs are as below:

  • Headphone

  • HDMI OUT

  • SPDIF OUT

The 2 audio inputs are as below:

  • Microphone

  • Line in

Audio output sample code

You can check the audio card and device SN of the 3 audio outputs via aplay -l command:

[root@firefly:/]# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: RKRK312X [RK_RK312X], device 0: RK312X PCM rk312x-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: RKRK312X [RK_RK312X], device 1: RK312X PCM rk312x-voice-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: RKHDMII2S [RK-HDMI-I2S], device 0: HDMI PCM rk-hdmi-i2s-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: RKSPDIFCARD [RK-SPDIF-CARD], device 0: SPDIF PCM Playback rk-hdmi-spdif-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

According to your actual needs, you can choose an audio output you need. For example, if you want to use audio output card 0,device 0, you can choose it like this:

aplay -Dhw:0,0 /mnt/udisk/xxx.wav

Note: only audio source with 48000Hz and in WAV format is supported.

Audio input sample code

Although there are two audio inputs, currently, the system only supports to collect audio data via the Microphone on the board, and the line in input is actually connected with the headphone output, which means the input of the line in is the output of the headphone. For the input of the Microphone, you can check its audio card information according to arecord -l in the software.

[root@firefly:/]# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: RKRK312X [RK_RK312X], device 0: RK312X PCM rk312x-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: RKRK312X [RK_RK312X], device 1: RK312X PCM rk312x-voice-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Ignore the device 1 here and just use device 0

arecord  -Dhw:0,0 -r48000 -f S16_LE -c2 > xxx.wav

Here, only 48000HZ, WAV format audio data can be collected.