Skip to content

Instantly share code, notes, and snippets.

@jobbautista9
Created March 29, 2022 10:07
Show Gist options
  • Save jobbautista9/aa88c801dd692682983091a50301dd4d to your computer and use it in GitHub Desktop.
Save jobbautista9/aa88c801dd692682983091a50301dd4d to your computer and use it in GitHub Desktop.
Dichromatic Lotus Butterfly ~ Ancients
#!/bin/bash
: '
Copyright (C) 2022 Job Bautista
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'
echo ' __ __ __ __ ___ __'
echo '| \ | / ` |__| |__) / \ |\/| /\ | | / `'
echo '|__/ | \__, | | | \ \__/ | | /~~\ | | \__,'
echo
echo ' _-==---_ _____ ___'
echo ' | -=== _ - | | | / \'
echo ' | -==== ( ) - | | | /____'
echo ' | -===== - | | | /'
echo ' |____ -==( )= - | \__/ \___/'
echo ' -===== _-'
echo ' -==--- mn'
echo
echo ' __ ___ ___ ___ __ ___'
echo ' |__) | | | | |__ |__) |__ | \ /'
echo ' |__) \__/ | | |___ | \ | |___ |'
echo
echo "Dichromatic Lotus Butterfly ~ Ancients"
echo "Composed by ZUN for Seihou Shuusou Gyoku"
echo "Arranged by Job Bautista"
printf "Yin-Yang ASCII by Michael Naylor\n\n"
# unused notes and durations are commented
# notes
: '
declare -r c0=16
declare -r cs0=17
declare -r d0=18
declare -r ds0=19
declare -r e0=20
declare -r f0=21
declare -r fs0=23
declare -r g0=24
declare -r gs0=25
declare -r a0=27
declare -r as0=29
declare -r b0=30
declare -r c1=32
declare -r cs1=34
declare -r d1=36
declare -r ds1=38
declare -r e1=41
declare -r f1=43
declare -r fs1=48
declare -r gs1=51
declare -r a1=55
declare -r as1=58
declare -r b1=61
declare -r c2=65
declare -r cs2=69
declare -r d2=73
declare -r ds2=77
declare -r e2=82
declare -r f2=87
declare -r fs2=92
declare -r g2=97
declare -r gs2=103
declare -r a2=110
declare -r as2=116
declare -r b2=123
declare -r c3=130
declare -r cs3=138
declare -r d3=146
declare -r ds3=155
declare -r e3=164
'
declare -r f3=174
# declare -r fs3=184
declare -r g3=195
# declare -r gs3=207
declare -r a3=220
declare -r as3=233
# declare -r b3=246
declare -r c4=261
# declare -r cs4=277
declare -r d4=293
# declare -r ds4=311
# declare -r e4=329
declare -r f4=349
declare -r fs4=369
declare -r g4=391
declare -r gs4=415
declare -r a4=440
declare -r as4=466
declare -r b4=493
declare -r c5=523
declare -r cs5=554
declare -r d5=587
declare -r ds5=622
declare -r e5=659
declare -r f5=698
declare -r fs5=739
declare -r g5=783
declare -r gs5=830
declare -r a5=880
declare -r as5=932
declare -r b5=987
declare -r c6=1046
declare -r cs6=1108
declare -r d6=1174
declare -r ds6=1244
: '
declare -r e6=1318
declare -r f6=1396
declare -r fs6=1479
declare -r g6=1567
declare -r gs6=1661
declare -r a6=1760
declare -r as6=1864
declare -r b6=1975
'
# durations
declare -r fu=0.75
declare -r ha=0.5
declare -r qu=0.25
declare -r ei=0.125
declare -r si=0.0625
function note { # $1 = duration, $2 = note
echo $1 $2; play -q -V0 -n synth $1 sin $2;
}
function fu { note $fu $1; };
function ha { note $ha $1; };
function qu { note $qu $1; };
function ei { note $ei $1; };
function si { note $si $1; };
function loopstart {
function brrrr-text { sleep 0.0625; echo $1; };
function brrrr-text-real {
brrrr-text "$si $as5"
brrrr-text "$si $a5"
brrrr-text "$si $c5"
brrrr-text "$si $a4"
}
function brrrr-mus {
play -q -V0 \
"|sox -n -p synth $si sin $as5" \
"|sox -n -p synth $si sin $a5" \
"|sox -n -p synth $si sin $c5" \
"|sox -n -p synth $si sin $a4"
}
brrrr-text-real & brrrr-mus;
function dahdadadadah {
ei $d5
ei $g5
ei $d5
ei $a5
qu $as5
}
function first {
dahdadadadah
ei $d5
dahdadadadah
ei $d5
dahdadadadah
qu $c6
ei $c6
qu $as5
}
function second { ei $a5; fu $as5; qu 0; };
first; second;
first; second;
first; second;
first
ei $a5
ei $as5
qu $c6
ei $a5
qu $g5
qu $g5
ei $g5
qu $g5
qu $g5
ei $g5
qu $g5
qu $g5
ei $fs5
qu $fs5
ha $fs5
fu $g5
fu $d5
qu $c5
qu $as4
ei $a4
fu $as4
fu $g5
fu $d5
qu $c5
qu $d5
note 1 $g5
fu $as5
qu $a5
qu $c6
qu $as5
ei $a5
qu $a5
fu $as5
fu $as4
qu $d4
qu $c5
ei $fs4
ei $a4
ei $c5
ei $d5
ei $fs5
ei $a5
ei $c6
si 0
}
function part1 {
function common {
ha $d5
qu $d5
ei $c5
ei $f5
ei $ds5
ha $d5
}
function first {
ei $g4
ei $c5
ei $as4
ei $a4
ei $as4
ha $g4
qu $d5
ei $c5
ei $f5
ei $g5
note 1.25 $d5
note 0.05 0
}
function second {
ei $g5
ei $g5
ei $g5
ei $a5
ei $as5
ha $g5
qu $d6
ei $c6
ei $a5
ei $fs5
note 1.25 $g5
note 0.05 0
}
common; first;
common; second;
common; first;
common; second;
}
function part2 { # basically a higher-pitched part2
function common {
ha $ds5
qu $ds5
ei $cs5
ei $fs5
ei $e5
ha $ds5
}
function first {
ei $gs4
ei $cs5
ei $b4
ei $as4
ei $b4
ha $gs4
qu $ds5
ei $cs5
ei $fs5
ei $gs5
note 1.25 $ds5
note 0.05 0
}
function second {
ei $gs5
ei $gs5
ei $gs5
ei $as5
ei $b5
ha $gs5
qu $ds6
ei $cs6
ei $as5
ei $g5
note 1.25 $gs5
}
common; first;
common; second;
note 0.05 0
common; first;
common; second;
ha 0
}
function part3 {
function main {
fu $g5
fu 0
ha $as5
note 0.625 $a5
note 0.45 $f5
ha $g5
ha 0
ei $c5
qu $f5
ei 0
ei $g4
ei $a4
ei $as4
ei $a4
ei $g4
qu $f4
si 0
fu $g4
fu 0
note 0.625 $as4
note 0.45 $a4
note 0.35 $f4
ha $g4
}
main
ha 0
ei $c4
qu $f4
ei $g3
ei $a3
ei $as3
ei $a3
ei $g3
ha $f3
main
fu 0
fu $g5
ha 0
}
trap 'exit 0' SIGUSR2
# drum-like start
si 120
si 90
ha 0
while true
do
loopstart
part1
part2
part3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment