Sound installation

From Rsewiki
Revision as of 12:11, 25 December 2021 by Jca (Talk | contribs)

Jump to: navigation, search

Back to Robobot.

Contents

Sound

Use headphone jack

On bullseye (Raspbian GNU/Linux 11 (bullseye)) the default is sound on the HDMI.

To see the Linux version use

cat /etc/os-release

Change output to the headphone jack a configuration file is needed

Create a file called .asoundrc

nano ~/.asoundrc

insert these two lines (1=jack, 0=HDMI sound):

defaults.pcm.card 1
defaults.ctl.card 1

Logout and re-login

festival

Easily understandable voice, but takes time to generate and require two intermediate files

sudo apt install festival
echo "The brown fox jumps over lazy dog" > aaa.txt
text2wave aaa.txt -o aaa.wav
aplay aaa.wav

or on one line

echo "The brown fox jumps over lazy cat" | text2wave -o ccc.wav && aplay ccc.wav

Music files

Play sound files, like

sudo apt-get install sox libsox-fmt-all
play -v0.1 music.mp3

This line plays an mp3 file with volume reduced by a factor 0.1. The at startup the blue button on the gamepad plays the file in /home/local/Music/music.mp3.
This is a symbolic link to some real music (Radetzky Marsch in this case):

ls ~/Music
   radetzky-marsch_Schloss-Schoenbrunn-Konzerte_Wien_full-length.mp3
cd ~/Music
ln -s radetzky-marsch_Schloss-Schoenbrunn-Konzerte_Wien_full-length.mp3 music.mp3

The free music is found at

https://www.imagevienna.com/en/services/downloadarea/downloads.html

https://www.imagevienna.com/fileadmin/mp3/radetzky-marsch_Schloss-Schoenbrunn-Konzerte_Wien_full-length.mp3

and can be downloaded using a wget command and then make a link named music.mp3:

cd Music
wget https://www.imagevienna.com/fileadmin/mp3/radetzky-marsch_Schloss-Schoenbrunn-Konzerte_Wien_full-length.mp3
ln -s radetzky-marsch_Schloss-Schoenbrunn-Konzerte_Wien_full-length.mp3 music-mp3

Sound level

On a Raspberry pi version 3+ (not tested on other versions)

$ amixer
 Simple mixer control 'PCM',0
   Capabilities: pvolume pvolume-joined pswitch pswitch-joined
   Playback channels: Mono
   Limits: Playback -10239 - 400
   Mono: Playback 400 [100%] [4.00dB] [on]

The name 'PCM' may be different, e.g. 'Headphone' or otherwise

An thus:
Setting the sound level can be done by:

amixer set PCM 0dB unmute

Setting to maximum (100%) is about the same as setting 4dB (may be too much for amplifier).

amixer set PCM 100% unmute
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox