diff options
-rw-r--r-- | .gitignore | 8 | ||||
-rwxr-xr-x | build | 11 | ||||
-rw-r--r-- | changelog | 5 | ||||
-rw-r--r-- | control | 1 | ||||
-rw-r--r-- | copyright | 17 | ||||
-rw-r--r-- | format | 1 | ||||
-rw-r--r-- | fss.pkg/control | 5 | ||||
-rw-r--r-- | fss.pkg/docs | 0 | ||||
-rw-r--r-- | src/fss.sh | 90 |
9 files changed, 138 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e8832d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# Swap and backup files +.*.sw* +.sw* +*~ +Session.vim + +# Work area +tmp/ @@ -0,0 +1,11 @@ +#!/usr/bin/make -f + +nop: + @: + +build: + @: + +install: + install -d -m 0755 fss.data/usr/bin + install -p -m 0755 src/fss.sh fss.data/usr/bin/fss diff --git a/changelog b/changelog new file mode 100644 index 0000000..54eab5d --- /dev/null +++ b/changelog @@ -0,0 +1,5 @@ +fss (1.0) trunk + + * Initial release. + + -- "P. J. McDermott" <pj@pehjota.net> Sun, 24 Jan 2016 21:56:04 -0500 @@ -0,0 +1 @@ +Maintainer: "P. J. McDermott" <pj@pehjota.net> diff --git a/copyright b/copyright new file mode 100644 index 0000000..3414037 --- /dev/null +++ b/copyright @@ -0,0 +1,17 @@ +Copyright (C) 2016 Patrick "P. J." McDermott + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. + +On this system, a copy of the GNU General Public License may be found at +<file:///usr/share/common-licenses/GPL-3>. @@ -0,0 +1 @@ +2.0 diff --git a/fss.pkg/control b/fss.pkg/control new file mode 100644 index 0000000..341e43e --- /dev/null +++ b/fss.pkg/control @@ -0,0 +1,5 @@ +Architecture: all +Platform: all +Description: "Free Software Song" player + The fss program plays the melody of the "Free Software Song", based on the + Bulgarian folk song, "Sadi Moma". diff --git a/fss.pkg/docs b/fss.pkg/docs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/fss.pkg/docs diff --git a/src/fss.sh b/src/fss.sh new file mode 100644 index 0000000..e4e2135 --- /dev/null +++ b/src/fss.sh @@ -0,0 +1,90 @@ +#!/bin/sh +# +# "Free Software Song" player +# +# Copyright (C) 2016 Patrick "P. J." McDermott +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +play() +{ + local octave_shift="${1}" + local note_length="${2}" + shift 2 + local note= + local octave= + local length= + local freq= + + while [ ${#} -gt 0 ]; do + note="${1%_*}" + octave="${1%:*}" + octave="${octave#*_}" + length="${1#*:}" + shift 1 + case "${note}" in + C) note=-9;; + Cs|Df) note=-8;; + D) note=-7;; + Ds|Ef) note=-6;; + E) note=-5;; + F) note=-4;; + Fs|Gf) note=-3;; + G) note=-2;; + Gs|Af) note=-1;; + A) note=0;; + As|Bf) note=1;; + B) note=2;; + esac + # A note's frequency is: + # n/12 + # f = 2 * 440 Hz + # where n is the distance from A4. + freq=$(awk -v octave_shift=${octave_shift} -v octave=${octave} \ + -v note=${note} ' + BEGIN { + octaves = octave_shift + octave - 4 + note / 12; + freq = 2 ^ octaves * 440; + print(int(freq + 0.5)); + } + ') + length=$(($length * $note_length)) + beep -f ${freq} -l ${length} + done +} + +# "Free Software Song" +# +# Time signature: 7/8 +# Octaves: 4, 5 +# Tempo: 252 BPM +# Duration: 0:20 +# +# The notation for the "Free Software Song" is from +# <https://www.gnu.org/music/free-software-song.html>. + +play 4 238 \ + D_1:2 C_1:1 B_0:2 A_0:2 \ + B_0:2 C_1:1 B_0:1 A_0:1 G_0:2 \ + G_0:3 A_0:3 B_0:1 \ + C_1:3 B_0:2 B_0:1 D_1:1 \ + A_0:3 A_0:4 \ + D_1:2 C_1:1 B_0:4 \ + \ + D_1:2 C_1:1 B_0:2 A_0:2 \ + B_0:2 C_1:1 B_0:1 A_0:1 G_0:2 \ + G_0:3 A_0:3 B_0:1 \ + C_1:3 B_0:2 B_0:1 D_1:1 \ + A_0:3 A_0:4 \ + A_0:7 |