Linux Multimedia
Linux
Audio
Video
Audio
ALSA
ALSA (Advanced Linux Sound Architecture)…
- …full audio and MIDI functionality for Linux
- Kernel sound card drivers since Linux 2.6 (1998)
- User space driven library for application developers
- Optional OSS emulation mode for
/dev/sound,/dev/dsp, etc - Device files in
/dev/snd/(use alsa-lib instead)
# kernel messages for sound devices
sudo dmesg | egrep -i "alsa|snd"
# verify that sound modules are loaded
lsmod | grep '^snd' | column -tConfiguration
/proc/asound kernel interface
/proc/asound/version # ALSA version
/proc/asound/cards # list of registered cards
# PCM device-related information and status
tail -n+2 /proc/asound/card[0-9]/pcm*/info# list of registered ALSA devices
>>> cat /proc/asound/devices
2: [ 0- 0]: digital audio playback
3: [ 0- 0]: digital audio capture
4: [ 0- 3]: digital audio playback
5: [ 0- 7]: digital audio playback
6: [ 0- 8]: digital audio playback
7: [ 0- 9]: digital audio playback
8: [ 0-10]: digital audio playback
9: [ 0- 0]: hardware dependent
10: [ 0- 2]: hardware dependent
11: [ 0] : control
33: : timer
| | |
| | `- device number
| `---- card number
`--------- minor numberALSA library configuration:
/usr/share/alsa/alsa.conf
/etc/asound.conf
~/.asoundrc
Save settings (volume states) for device:
alsactl store # store alsamixer confguration
alsactl restore # restores the saved alsamixer statealsamixer & aplay
Users have permission to play audio and change mixer levels:
amixer # configure audio settings
alsamixer # ..using a TUI
# list audio devices
aplay -l
aplay -L | grep :CARD
# produce noise on a device
speaker-test -D default:PCH -c 2Keyboard volume control:
amixer set Master 5%+ # increase volume
amixer set Master 5%- # decrease volume
amixer set Master toggle # toggle mutepulseaudio
pulseaudio -vvvvv # start in foreground with debugging
pulseaudio -k # kill running server
pulseaudio -D # start as daemon
pacmd ls # show audio system state
pulsemixer # curses base volume control/mixer
pavucontrol # GTK based volume control/mixer# input sources (* indicates current default)
pacmd list-sources | grep -e 'index:' -e device.string -e 'name:'
# output sources
pacmd list-sinks | grep -e 'name:' -e 'index:'PulseAudio under the hood (2017)
https://gavv.github.io/articles/pulseaudio-under-the-hood
Music
SoX
SoX…
- …Swiss Army knife of sound processing programs
- …Fedora
soxpackage - …documentation
- …includes
playcommand
# play a list of MP3 files...
play path/to/*.mp3mpd
- …
$SCRIPTS/etc/mpdconf(in my case)- …
$HOME/musicstores all music files… - …
$HOME/.mpdstores all run-time information
- …
- …configuration is stored a version control system
bind_to_address "127.0.0.1"
port "12345"
music_directory "~/music/"
auto_update "yes"
playlist_directory "~/.mpd/playlists"
db_file "~/.mpd/mpd.db"
log_file "~/.mpd/mpd.log"
pid_file "~/.mpd/mpd.pid"
volume_normalization "yes"
#audio_output {
# type "alsa"
# name "My ALSA Device"
#}
audio_output {
type "pulse"
name "pulse audio"
mixer_type "hardware"
}Some shell-init …$SCRIPTS/var/aliases/mpd.sh (in my case)…
- …starts
mpdusing custom configuration (above)- …unless running already
- …requires exigences of
$HOME/music
command -v mpd >/dev/null && {
MPD_CONF=$SCRIPTS/etc/mpdconf
# read the port from the configuration file
MPD_PORT=$(grep ^port $MPD_CONF | cut -d'"' -f2)
MPD_PLAYLISTS=$HOME/.mpd/playlists
MUSIC_DIR=$HOME/music
export MPD_PORT \
MPD_CONF \
MPD_PLAYLISTS \
MUSIC_DIR
if [ -d $MUSIC_DIR ]
then
# if MPD is not running
if ! pgrep -u $USER mpd &>/dev/null
then
[[ -d $MPD_PLAYLISTS ]] || mkdir -p $MPD_PLAYLISTS
# start MPD
mpd $MPD_CONF 2>&-
# update music index
mpc -w update
echo mpd started
fi
fi
}mpc & ncmpc connecting to the MPD instance…
alias mpc="mpc --host 127.0.0.1 -p $MPD_PORT"
alias ncmpc="ncmpc --host 127.0.0.1 --port $MPD_PORT"Pictures
Editor
gThumb 1 is a basic image browser with editing…
- …thumbnail browser & image viewer for all common formats
- …editor …coloring, scale, crop, etc.
- …basic image conversion & slide-shows
Screenshot
Screenshots…
- …capture entire screen
- …a particular application window
- …any user defined area
GNOME includes a simple screenshot tool…
- …press
printkey for accecss …escto exits…select areac…capture screenw…capture windowt…toggle mouse pointer
- …annotation with GNOME Drawing
Alternatively …Flameshot screenshot application…
Footnotes
gThumb Project, GNOME, GitHub
https://wiki.gnome.org/Apps/Gthumb
https://github.com/GNOME/gthumb↩︎