Audio en Linux
El beep
Para que funcione beep hay que activar el módulo en el kernel
sudo modprobe pcspkr
Luego el comando beep se puede usar para enviar sonido directamente al altavoz del sistema. También se puede enviar el caracter '\a' a una terminal:
echo -en "\a" > /dev/tty5
de wv +cue a wav
shnsplit -f in.cue in.wv
el programa está en el paquete shntool y necesitas en paquete wavpack, que son los codecs
de wav a mp3
En la terminal se puede usar el programa lame
Otro uso de lame puede ser comprimir mp3:
$ lame -b 32 1.mp3 1c.mp3
$ for i in *.wma; do echo "$i"; ffmpeg -i "$i" "$i.wav"; done; for i in *.wav; do echo "$i"; lame "$i"; done
$ find -name "*.wav" -exec lame {} \;
Comandos varios
$ aplay -c 2 -f S16_LE -r 44100 /dev/urandom $ echo "main(i){for(i=0;;i++)putchar(((i*(i>>8|i>>9)&46&i>>8))^(i&i>>13|i>>6));}" | gcc -x c - && ./a.out | aplay
Scripts
#!/bin/bash
# music.sh
# Music without external files
# Author: Antonio Macchi
# Used in ABS Guide with permission.
# /dev/dsp default = 8000 frames per second, 8 bits per frame (1 byte),
#+ 1 channel (mono)
duration=2000 # If 8000 bytes = 1 second, then 2000 = 1/4 second.
volume=$'\xc0' # Max volume = \xff (or \x00).
mute=$'\x80' # No volume = \x80 (the middle).
function mknote () # $1=Note Hz in bytes (e.g. A = 440Hz ::
{ #+ 8000 fps / 440 = 16 :: A = 16 bytes per second)
for t in `seq 0 $duration`
do
test $(( $t % $1 )) = 0 && echo -n $volume || echo -n $mute
done
}
e=`mknote 49`
g=`mknote 41`
a=`mknote 36`
b=`mknote 32`
c=`mknote 30`
cis=`mknote 29`
d=`mknote 27`
e2=`mknote 24`
n=`mknote 32767`
# European notation.
echo -n "$g$e2$d$c$d$c$a$g$n$g$e$n$g$e2$d$c$c$b$c$cis$n$cis$d \
$n$g$e2$d$c$d$c$a$g$n$g$e$n$g$a$d$c$b$a$b$c" | aplay
# dsp = Digital Signal Processor
exit # A "bonny" example of an elegant shell script!
Fuente: [1]
Comando play
$ paste <(seq 7 | shuf | tr 1-7 A-G) <(seq 7 | shuf) | while read i j; do play -qn synth 1 pluck $i synth 1 pluck mix $2; done
Reproduir els permisos:
$ n=(C D E F G A B "C4 "); echo -n 1357 |while read -n1 k;do x=${n[$k]};sleep .2;play -qn synth pl ${x}3 fade 0 1& done
Acorde de guitarra:
$ play -n synth pl E2 pl A2 pl D3 pl G3 pl B3 pl E4 delay 0 .05 .1 .15 .2 .25 remix - fade 0 4 .1 norm -1
Phase
phase() { while :; do for n in E4 F#4 B4 C#5 D5 F#4 E4 C#5 B4 F#4 D5 C#5; do /usr/bin/play -qn synth $1 pluck $n; done; echo -n "[$1]"; done; }; phase 0.13 & phase 0.131 &
Enlaces
http://music.stackexchange.com/questions/3103/software-for-microtonal-midi
https://news.ycombinator.com/item?id=8750127
http://www.microsiervos.com/archivo/mundoreal/20-a-20000-hz.html
https://github.com/kylophone/spectro-photo
http://www.caseyrule.com/projects/sounds-of-sorting/
http://blog.robertelder.org/bash-one-liner-compose-music/
http://askubuntu.com/questions/19906/beep-in-shell-script-not-working
http://opensourceforu.com/2016/11/create-music-free-software/
http://opensourceforu.com/2016/11/create-music-free-software/
https://poesiabinaria.net/2018/01/generar-ruido-diferentes-colores-gnulinux/#ruido-blanco