Tag Archives: beep

beeps again

I changed the structure of the beep fortune cookie. I use now the Audio::Beep which permits lilypond syntax and I used the idea from the best answer from this post to select a random perl beep file. Now my beep fortune works like this:

1) Have all beep perl files in a directory, e.g. ~/beep/

2) Run this bash script:


#!/bin/bash
files=(/home/alex/scripts/beep/*.pl)
/usr/bin/perl `printf "%s\n" "${files[RANDOM % ${#files[@]}]}"`

Now, every time my computer starts, I listen to a random selected beep melody. It's awesome! Every day I will write a new melody mainly from the classical repertory and put it in my beep repository (but also from medieval and folk music). After I will have many of them (only music allowing free reproduction), I will publish them for download.

Maybe I will write some original compositions as well! Well, that's interesting!...

And for the fans of the internal speaker, here is my beep of the week:


use Audio::Beep;
my $beeper = Audio::Beep->new();
print "J.S.Bach: Concert for Harspichord and Strings in d minor\n";
my $music = << 'EOS';
\tempo80
d16 e f8 e d a' d4 a8
bes g16 e  a8 f16 d  g8 e16 cis a8 bes'4
g16 e a,8 cis'4 bes16 g a,8 e''4 cis16 a bes g a f g e f d
e cis d b cis a b cis d e f g a bes c8
c16 d es8 fis, g cis, d gis, r a r d, r
EOS
$beeper->play( $music );

fortune cookie with internal pc speaker

If you have the programmes strfile, fortune and beep, you can have fortune cookies with music coming out of your pc speaker!

Here is how it goes.

1) Create a file, say MyMusicCookies, with some beep melodies, separated by %, see for example one previous post here.

2) run
strfile MyMusicCookies MyMusicCookies.dat

3) enjoy a random music piece with
fortune MyMusicCookies | bash

You can also make a mixed file with text and beep music and let yourself be surprised!

Have fun!

UPDATE: And if you use Arch Linux, then you can activate your fortune-music player on boot by writing a file as

/etc/systemd/system/boot-music.service

with a content like


[Unit]
Description=Set boot music

[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/bin/fortune /directory/to/MyMusicCookies | /bin/bash

[Install]
WantedBy=multi-user.target

and activating it with

systemctl enable boot-music

😉

arch log #2

Installed slrn, rdesktop, beep (I love the PC speaker!)

Here is a melody I wrote quickly to test it:

#!/bin/bash

note(){
case $1 in
"C" ) freq=261.6;;
"Cis") freq=277.2;;
"D" ) freq=293.7;;
"Dis") freq=311.1;;
"Es") freq=311.1;;
"E" ) freq=329.6;;
"F" ) freq=349.2;;
"Fis") freq=370.0;;
"G" ) freq=392.0;;
"Gis") freq=415.3;;
"A" ) freq=440.0;;
"Ais") freq=466.2;;
"B") freq=466.2;;
"H" ) freq=493.9;;
"c" ) freq=523.2;;
*) freq=1;;
esac
if [ "$2" != "" ]; then dur=$2; else dur=250; fi
beep -f $freq -l $dur
}

note 0 500
note Es
note D
note D 500
note Es
note D
note D 500
note Es
note D
note D 500
note B 500
note 0 500
note B
note A
note G 500
note G
note F
note Es 500
note Es
note D
note C 500
note C 500