Sound installation: Difference between revisions

From Rsewiki
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
Back to [[Robobot]].
Back to [[Robobot]].


===Sound===
==Sound==


====festival====
===Headphone jack===


Easy understandable voice, but takes time to generate
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
and require two intermediate files


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


====Music files====
===Music files===


Play sound files, like
Play sound files, like
Line 37: Line 61:


https://www.imagevienna.com/fileadmin/mp3/radetzky-marsch_Schloss-Schoenbrunn-Konzerte_Wien_full-length.mp3
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===
===Sound level===
Line 43: Line 73:


  $ amixer
  $ amixer
   Simple mixer control 'PCM',0
   Simple mixer control 'Headphone',0
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
    Playback channels: Mono
  Playback channels: Mono
    Limits: Playback -10239 - 400
  Limits: Playback -10239 - 400
    Mono: Playback 400 [100%] [4.00dB] [on]
  Mono: Playback 400 [100%] [4.00dB] [on]
 
The name 'Headphone' is the nickname to use


An thus:<br>
Setting the sound level can be done by:
Setting the sound level can be done by:


  amixer set PCM 0dB unmute
  amixer set Headphone 0dB unmute


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


  amixer set PCM 100% unmute
  amixer set Headphone 100% unmute

Latest revision as of 15:29, 28 December 2021

Back to Robobot.

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

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 '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