in reply to Chord Values for MIDI
use MIDI::Simple; my %chords = ( major => [0, 4, 7, 12], minor => [0, 3, 7, 12], major7 => [0, 4, 7, 11], minor7 => [0, 3, 7, 10], minor75 => [0, 3, 6, 10], dim => [0, 3, 6, 9], dom7 => [0, 4, 7, 10], major9 => [0, 4, 7, 11, 14], minor9 => [0, 3, 7, 10, 14], ); sub chord { # chord(NOTE, CHORD); # NOTE is the base note of the chord (numeric or name) # CHORD is a reference to the chord array # uses MIDI::Simple's interval procedure # returns a list of notes (numeric or name) based on the format of NOT +E my ($note, $chord) = @_; return interval $chord, $note; } my $note = 'Cs5'; # C sharp, 5th octave (D flat) my @CsMajor5 = chord2($note, $chords{major}); print "C sharp major chord, 5th octave: @CsMajor5\n"; # displays: C sharp major chord, 5th octave: Df5 F5 Af5 Df6
|
|---|