Sound installation
Back to Robobot.
Contents |
Sound
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)
NB! this is valid if there is a HDMI-plug connected, else the card should be 0:
defaults.pcm.card 1 defaults.ctl.card 1
Logout and re-login.
On the GUI interface, there are other options, but not from software or the command line.
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
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 'Headphone',0 Capabilities: pvolume pvolume-joined pswitch pswitch-joined Playback channels: Mono Limits: Playback -10239 - 400 Mono: Playback 400 [100%] [4.00dB] [on]
The name 'Headphone' is the nickname to use
Setting the sound level can be done by:
amixer set Headphone 0dB unmute
Setting to maximum (100%) is about the same as setting 4dB (maybe too much for amplifier).
amixer set Headphone 100% unmute