Audio - monkeymia/orangepizero GitHub Wiki

Audio

One Wire Audio" (OWA); SPDIF

The H3 CPU has a "One Wire Audio" (OWA) module. It provides a serial bus interface for audio data between system. The interface is widely used for consumer audio connect (SPDIF).

Name PIN Function2 Func3 Comment
OWA_DOUT PA17
connected to STATUS-LED

Armbian Overlay

https://github.com/armbian/sunxi-DT-overlays/blob/master/sun8i-h3/README.sun8i-h3-overlays

overlays=spdif-out

Activates SPDIF/Toslink audio output

SPDIF pin: PA17

Note: In case of Orange Pi Zero PA17 is wired to the red LED.

Audio Codec

H3 Datsheet: The Audio Codec module provides a stereo DAC for playback and a stero ADC for recording.

  • Line IN (Left, Right)
  • Mic (First, Second)
  • Line OUT (Left, Right)

In case of Orange Pi Zero:

  • Line IN is not connected
  • MIC2 is not connected
  • LINE out, MIC1 are routed to 13 pin header.

Armbian Overlay

https://github.com/armbian/sunxi-DT-overlays/blob/master/sun8i-h3/README.sun8i-h3-overlays

overlays=analog-codec

Activates SoC analog codec driver that provides Line Out and Mic In functionality

Basic Test - aplay, arecord, amixer

  1. Connect active speaker (with amplifier)
  2. copy audio file in wav format
  3. aplay x.wav
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Codec [H3 Audio Codec], device 0: CDC PCM Codec-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
aplay -L
null
  Discard all samples (playback) or generate zero samples (capture)
default:CARD=Codec
  H3 Audio Codec,
  Default Audio Device
sysdefault:CARD=Codec
  H3 Audio Codec,
  Default Audio Device
dmix:CARD=Codec,DEV=0
  H3 Audio Codec,
  Direct sample mixing device
dsnoop:CARD=Codec,DEV=0
  H3 Audio Codec,
  Direct sample snooping device
hw:CARD=Codec,DEV=0
  H3 Audio Codec,
  Direct hardware device without any conversions
plughw:CARD=Codec,DEV=0
  H3 Audio Codec,
  Hardware device with all software conversions
demonstrator@orangepizero:/tmp$ amixer
Simple mixer control 'Line In',0
  Capabilities: pvolume pvolume-joined pswitch cswitch
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 7
  Front Left: Playback 3 [43%] [0.00dB] [off] Capture [off]
  Front Right: Playback 3 [43%] [0.00dB] [off] Capture [off]
Simple mixer control 'Line Out',0
  Capabilities: pvolume pvolume-joined pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 17 [55%] [-21.00dB] [on]
  Front Right: Playback 17 [55%] [-21.00dB] [on]
Simple mixer control 'Line Out Source',0
  Capabilities: penum
  Items: 'Stereo' 'Mono Differential'
  Item0: 'Stereo'
  Item1: 'Stereo'
Simple mixer control 'Mic1',0
  Capabilities: pvolume pvolume-joined pswitch cswitch
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 7
  Front Left: Playback 3 [43%] [0.00dB] [off] Capture [off]
  Front Right: Playback 3 [43%] [0.00dB] [off] Capture [off]
Simple mixer control 'Mic1 Boost',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 4 [57%] [33.00dB]
Simple mixer control 'Mic2',0
  Capabilities: pvolume pvolume-joined pswitch cswitch
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 7
  Front Left: Playback 3 [43%] [0.00dB] [off] Capture [off]
  Front Right: Playback 3 [43%] [0.00dB] [off] Capture [off]
Simple mixer control 'Mic2 Boost',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 4 [57%] [33.00dB]
Simple mixer control 'Mixer',0
  Capabilities: cswitch
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'Mixer Reversed',0
  Capabilities: cswitch
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'ADC Gain',0
  Capabilities: cvolume cvolume-joined
  Capture channels: Mono
  Limits: Capture 0 - 7
  Mono: Capture 3 [43%] [0.00dB]
Simple mixer control 'DAC',0
  Capabilities: pvolume pvolume-joined pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 63
Mono:
  Front Left: Playback 45 [71%] [-20.88dB] [on]
  Front Right: Playback 45 [71%] [-20.88dB] [on]
Simple mixer control 'DAC Reversed',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [off]
  Front Right: Playback [off]

Per default mic is disabled. Enable (cap) or disable (nocap) via amixer:

demonstrator@orangepizero:/tmp$ amixer set Mic1 cap
Simple mixer control 'Mic1',0
Capabilities: pvolume pvolume-joined pswitch cswitch
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: Playback 0 - 7
Front Left: Playback 3 [43%] [0.00dB] [off] Capture [on]
Front Right: Playback 3 [43%] [0.00dB] [off] Capture [on]

Example command line: audio record wav in CD quality for 3 seconds into file test.wav:

arecord --file-type wav --device=default --format=cd --duration=3 test.wav

MISC

⚠️ **GitHub.com Fallback** ⚠️