diff options
Diffstat (limited to 'midicsv-1.1/chorus.pl')
| -rw-r--r-- | midicsv-1.1/chorus.pl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/midicsv-1.1/chorus.pl b/midicsv-1.1/chorus.pl new file mode 100644 index 0000000..00b398f --- /dev/null +++ b/midicsv-1.1/chorus.pl @@ -0,0 +1,28 @@ + + # Chorus all notes in a CSV MIDI file + + $offset = -12; + $percussion = 9; + + while ($a = <>) { + print($a); + + # Recognise Note_on_c and Note_off_c records and crack into: + + # $1 Start of record + # $2 Channel number + # $3 Note number + # $a Balance of record + + if ($a =~ s/(\d+,\s*\d+,\s*Note_\w+,\s*(\d+),\s*)(\d+)//) { + if ($2 != $percussion) { + $n = $3; + $n += $offset; + if ($n < 0) { + next; + } + $a = "$1$n$a"; + print($a); + } + } + } |
