Skip to content
GradedJestRisk edited this page Nov 11, 2020 · 25 revisions

Table of Contents

General

If you need audio editing, you need a:

  • real-time kernel;
  • using JACK instead of PulseAUdio.
To listed sound devices, including: - embeded soundcard (here Intel) - USB microphone (here, Yeti) - external soundcard (here, AudioEngine)

sudo lshw -class multimedia

[sudo] password for topi: 
  *-usb:0                   
       description: Audio device
       product: Yeti Stereo Microphone
       physical id: 3
  *-usb:0
       description: Audio device
       product: Audioengine HD3
       physical id: 2
  *-multimedia
       description: Audio device
       product: Sunrise Point-LP HD Audio
       physical id: 1f.3

ALSA

ALSA: Advanced Linux Sound Architecture, API for sound card device drivers The sound servers PulseAudio work on top of ALSA and implements sound card device drivers.

overview here

General:

  • restart: sudo alsa force-reload
  • sound levlel countrol: alsamixer
List
  • sudo alsaconf

Pulse

General:

  • get
  • GUI is pavucontrol : you can mute a window in Playback tab
  • config file are:
    • system-wide: /etc/pulse/default.pa
    • user: ~/.config/pulse/default.pa

Heatheck

General:

  • check if running: pulseaudio --check
  • stop pulse: pulseaudio -k | --kill
  • show logs: pulseaudio -v | --verbose
  • start as service: systemctl --user restart pulseaudio.service
  • start (?): pulseaudio -D | --daemon
  • if problem persists, restarts ALSA

Set device

From here

Input (source)

List:

  • get: pactl list short source
  • set default for current session (lost at reboot): pactl set-default-source'<SOURCE_NAME>'

Output (sink)

List:

  • get: pactl list short sinks
  • set default for current session (lost at reboot): pactl set-default-sink '<SINK_NAME>'

default

Steps:

  • get input/output number using
    • pactl list short sinks
    • pactl list short sources
  • edit system pulse confsudo vi /etc/pulse/default.pa
  • uncomment the following lines
### Make some devices default
#set-default-sink output
#set-default-source input
  • replace output/input by their values
### Make some devices default
set-default-sink 1
set-default-source 2
  • delete user pulse config rm -rf ~/.config/pulse
  • reboot

Modules

General:

  • list modules: pactl list short modules
  • load module: pactl load-module <MODULE_NAME>
  • unload module: pactl unload-module <MODULE_NAME>
Modules:
  • loopback (hear your voice>: pactl load-module module-loopback latency_msec=1

GNOME

List:

Multiple soundcard

From http://linuxmao.org/Alsa+-+g%C3%A9rer+plusieurs+cartes

Identify soundcards

Use aplay --list-devices (Alsa play)

aplay --list-devices
**** List of PLAYBACK Hardware Devices ****
card 0: HD3 [Audioengine HD3], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Microphone [Yeti Stereo Microphone], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: PCH [HDA Intel PCH], device 0: CX8200 Analog [CX8200 Analog]

So we've got:

  • an external USB soundcard on card 0, device 0
  • a USB microphone on card 1, device 0
  • an embedded USB soundcard on card 2, device 0 (you can't guess it from output, but by unplugging everything and running again)

Playing test file to check they work correctly

The embedded USB soundcard works from the start, but not the external

It's discussed here and for the sake of example I included the test.

To play sound file, we'll use aplay

We'll tell aplay> to send the sound to each soundcards trough a <SOUNDCARD>,<DEVICE> pattern aplay -Dhw:<SOUNDCARD>,<DEVICE>, eg aplay -Dhw:0,0 for internal USB

To avoid such hassle, I used environment variable

EXTERNAL_SOUNDCARD=0,0
INTERNAL_SOUNDCARD=2,0

Testing 44Khz standard sample rate

curl https://www.kozco.com/tech/organfinale.wav > organ-13s-44khz.wav
aplay -Dhw:$INTERNAL_SOUNDCARD organ-13s-44khz.wav
aplay -Dhw:$EXTERNAL_SOUNDCARD organ-13s-44khz.wav

Testing 48kHz sample rate

curl https://www.kozco.com/tech/organfinale.wav > organ-13s-44khz.waw
aplay -Dhw:$INTERNAL_SOUNDCARD Piano-7s-48khz.wav
aplay -Dhw:$EXTERNAL_SOUNDCARD Piano-7s-48khz.wav

Note: aplay --rate argument does NOT modify input sample rate. Rather, it overwrite detected sample rate. From manual

For supported soundfile formats, the sampling rate, bit depth, and so forth can be automatically determined from the soundfile header.
Clone this wiki locally