Support stdin as a method to input notes

Added arrange of The Internationale as example for custom samples
Pierrot of the Star-Spangled Banner as well for synths (incomplete)
This commit is contained in:
Job Bautista 2022-05-01 00:30:38 +08:00
parent 90914ac95d
commit a5f6a964de
36 changed files with 484 additions and 0 deletions

View File

@ -0,0 +1,34 @@
$qu:G#3
$qu:D#4/C4
$qu:G#3
$qu:D#4/C4
$qu:C#4
$qu:G#4/F4
$qu:C#4
$qu:G#4/F4
$qu:D#4
$qu:C#4
$qu:C4
$qu:A#3
$qu:G#3
$qu:G3
$qu:F3
$qu:D#3
$qu:G#3
$qu:D#4/C4
$qu:G#3
$qu:G4/D#4
$qu:F4
$qu:C5/G#4
$qu:D#4
$qu:A#4/G4
$qu:C#4
$qu:G#4/F4
$qu:A#3
$qu:F4/C#4
$qu:D#3
$qu:A#3
$qu:D#4

View File

@ -0,0 +1,33 @@
$qu:A#4/G4
$qu:G#3
$qu:C4
$qu:D#4
$qu:C4
$qu:C#4
$qu:F4
$qu:G#4
$qu:C#4
$qu:D#4
$qu:C#4
$qu:C4
$qu:A#3
$qu:G#3
$qu:C4
$qu:D#4
$qu:C4
$qu:F4
$qu:D#4
$qu:C4
$qu:A#3
$qu:C#4
$qu:F4
$qu:G#4
$qu:C#4
$qu:D#4
$qu:G4
$qu:A#4
$qu:G4
$fu:G#4/D#4

View File

@ -0,0 +1,4 @@
$qu:D#4
$qu:A#4/F4
$qu:D#4
$qu:A#4/F4

View File

@ -0,0 +1,2 @@
$qu:D#4
$qu:A#4/G4

View File

@ -0,0 +1,13 @@
#!/bin/sh
(echo "\$qu:0";
cat verse1 \
verse2 \
verse1 \
verse3 ;
echo "\$qu:0";
cat dasg dasg dasg \
dasg dasf verse5 \
verse6 \
verse7 \
chorus/1 chorus/2 \
) | ../stdin/samples.pl 100 4 2 ../piano/ff

View File

@ -0,0 +1,7 @@
$qu:G#3
$qu:D#4
$qu:C#4
$qu:C4
$qu:C#4
$qu:C4
$ha:A#3

View File

@ -0,0 +1,7 @@
$qu:G3
$qu:D#4
$qu:C#4
$qu:A#3
$qu:G#3
$qu:C4
$ha:D#4

View File

@ -0,0 +1,7 @@
$qu:D#4
$qu:C#4
$qu:G4
$qu:D#4
$qu:G#3
$qu:D#4
$qu:G#4

View File

@ -0,0 +1,3 @@
$qu:D#4
$qu:D4
$qu:C4

View File

@ -0,0 +1,9 @@
$qu:A#3
$qu:D#3
$qu:A#3
$qu:D#4
$qu:A#3
$qu:G#3
$qu:D#4/C4
$qu:G#3
$qu:D#4/C4

View File

@ -0,0 +1,5 @@
$qu:A#3
$qu:G4/D#4
$qu:A#3
$qu:F4/D4
$fu:G4/D#4

View File

@ -0,0 +1,30 @@
$dei:C6
$si:A#5
$ha:G#5
$dqu:D#5
$ei:C5
$ha:F5
$qu:C#5
$dei:A#5
$si:G#5
$ha:G5
$qu:F5
$qu:D#5/C#5
1.8:D#5/C5
$qu:D#5/C#5
$dqu:C6
$ei:C6
$qu:A#5
$qu:D#5
$ha:G#5
$dqu:G5
$ei:G5
$dqu:F5
$ei:E5
$qu:F5
$qu:A#5
$ha:A#5
$qu:A#5

View File

@ -0,0 +1,30 @@
$dei:C7/C6
$si:A#6/A#5
$ha:G#6/G#5
$dqu:D#6/D#5
$ei:C6/C5
$ha:F6/F5
$qu:C#6/C#5
$dei:A#6/A#5
$si:G#6/G#5
$ha:G6/G5
$qu:F6/F5
$qu:D#6/D#5
1.8:C7/C6
$qu:C7/C6
$dqu:D#7/D#6
$ei:D#7/D#6
$qu:C#7/C#6
$qu:C7/C6
$qu:A#6/A#5
$qu:C7/C6
$dqu:C#7/C#6
$ei:C#7/C#6
$dqu:C7/C6
$ei:C7/C6
$dqu:A#6/A#5
$ei:A#6/A#5
$fu:G#6/G#5

View File

@ -0,0 +1,4 @@
$ei:D#5
$ei:D#5
$ei:D5
$ei:D#5

View File

@ -0,0 +1,11 @@
#!/bin/sh
cat verse1 \
verse2 \
verse1 \
verse3 \
verse4 \
dsdsdds verse5 \
verse6/1 dsdsdds verse6/2 \
verse7 \
chorus/1 chorus/2 |
../stdin/samples.pl 100 4 2 ../piano/ff

View File

@ -0,0 +1,9 @@
$qu:D#5
$dqu:G#5/C5
$ei:G5
$ei:A#5
$ei:G#5
$ei:D#5
$ei:C5
$ha:F5
$qu:C#5/A#4

View File

@ -0,0 +1,9 @@
$ei:C5
$ei:F5
$dqu:A#5/D#5
$ei:G#5
$ei:G5
$ei:F5
$ei:D#5
$ei:C#5
1.8:C5

View File

@ -0,0 +1,7 @@
$ei:A#5
$ei:G#5
$qu:G5/D#5
$qu:A#5
$qu:C#6/C#5
$qu:G5/A#4
1.8:G#5/C5

View File

@ -0,0 +1,9 @@
$dei:C6/D#5
$si:A#5
$dqu:G5
$ei:G5
$ei:F5
$ei:G5
$ei:G#5
$ei:F5
$ha:G5

View File

@ -0,0 +1,7 @@
$dqu:F5
$ei:F5
$dqu:A#5
$ei:G#5
$qu:G5/D#5
$qu:D5
$qu:D#5/C5

View File

@ -0,0 +1,3 @@
$qu:A#5
$dqu:A#5/D#5
$ei:G5

View File

@ -0,0 +1,5 @@
$ha:C6
$ei:G#5
$ei:F5
$ei:G5
$ei:G#5

View File

@ -0,0 +1,5 @@
$qu:G5
$qu:A#5
$qu:G#5
$qu:F5
1.8:D#5

View File

@ -0,0 +1,16 @@
$ha:C#2/F#1/C#3
$ha:F#4/E4/C#4
$ha:C#2/F#1/C#3
$ha:F#4/E4/C#4
$ha:B1/F1/B2
$qu:F#4/B3/G#3
$ei:F#3
$ei:G#3
$ei:A#1/F1/A#2/A#3
$ei:F#3
$ei:D#3
$ei:A#3
$ei:A1/F1/A2/A3
$ei:F3
$ei:G#1/E1/G#2/D3
$ei:C3

View File

@ -0,0 +1,33 @@
$ei:G2/E2/G2/C#3/D3/G1
$ei:D3/G1
$ei:G2/E2/G2/C#3/G1
$ei:D3/G1
$ei:G2/E2/G2/C#3/G1
$ei:D3/G1
$ei:G2/E2/G2/D#3/G1
$ei:E3/G1
$ei:G#2/F2/G#2/D3/G#1
$ei:D#3/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\
$PIERROT/03/aa \
$PIERROT/03/ga \
$PIERROT/03/ga \
$PIERROT/03/ga \
$PIERROT/03/therest \
$PIERROT/04-05-common \
$PIERROT/04 \
$PIERROT/04-05-common \
$PIERROT/05 |
../stdin/synths.pl 180 6 square square triangle square square sawtooth |
xargs play

47
stdin/samples.pl Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env perl
use warnings;
use strict;
=begin
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.
=cut
use lib '..';
use SoXMusicGen;
our @notes;
setTempo($ARGV[0]);
our $maxSynthChannels=$ARGV[1];
our $maxSamplesChannels=$ARGV[2];
our $samplesDir=$ARGV[3];
our @notestemp=<STDIN>;
for my $note (@notestemp) {
if ($note ne "\n") { # Check first if string is just a trailing newline,
$note =~ s/(\$\w+)/$1/ee; # Evaluate variable names in stdin
$note =~ s/\R\z//; # Remove trailing newlines, else xargs will get confused
push (@notes, $note);
} # we don't want to print a forever synth after all
}
createSamples();

54
stdin/synths.pl Executable file
View File

@ -0,0 +1,54 @@
#!/usr/bin/env perl
use warnings;
use strict;
=begin
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.
=cut
use lib '..';
use SoXMusicGen;
our @notes;
setTempo($ARGV[0]);
our $maxSynthChannels=$ARGV[1];
my @synths;
for my $synth (iterate(2,@ARGV)) {
if (exists($ARGV[$synth])) {
push (@synths, $ARGV[$synth]);
}
}
setDefaultSynthType(@synths);
our @notestemp=<STDIN>;
for my $note (@notestemp) {
if ($note ne "\n") { # Check first if string is just a trailing newline,
$note =~ s/(\$\w+)/$1/ee; # Evaluate variable names in stdin
$note =~ s/\R\z//; # Remove trailing newlines, else xargs will get confused
push (@notes, $note);
} # we don't want to print a forever synth after all
}
createSynths();