Epistemologist-at-large
I decided to side-step and do some yak shaving on the size of note intervals and what acoustically makes up a chord.
This turned out to get more complicated, the closer I shaved^Wlooked.
Command-line options and default settings.
Use C major tonality. That is, C is our reference and we're in major.
There is also "minor tonality", which swaps a couple intervals but we'll pretend it isn't important, for now.
Build a note to ratio to named description model from the known intervals.
Create a frequency sorted scale of names by evaluating the interval ratios.
Compute the names, frequencies, intervals, cents and prime factorizations, etc. for each possible chord.
Math::Combinatorics
Music::Chord::Namer qw(chordname);
MIDI::Pitch qw(name2freq);
Math::Fraction; # XXX Syntax check spits warnings but does fractional approximation. Submit patch.
Sort::ArbBiLex;
Music::Scales
=> Perl !
Reveal the "guts" of chords - the frequencies of the notes and the intervals between them.
There are over 400 known intervals! (Under __DATA__)
Handle: Just intonation (ratio), Equal temperament (decimal), Cents, Prime factorization, Interval and Chord names.
size = 3, # Number of notes in a chord. octave = 4, # Common octave: A=440Hz equalt = 0, # Show equal temperament. justi = 0, # Show just, ratio or natural intonation. intervals = 0, # Show chord intervals. chords = 0, # Show chord names. rootless = 0, # Show 'no-root' chords. cents = 0, # Show note cents. freqs = 0, # Show note frequencies. primes = 0, # Show prime factorizations. tonic = C, # C Major tonality only for now. temper = 1200/log(2), # Equal temperament factor.
perl intervals --size=3 --chords --equalt --intervals C E G perl intervals --ch --e --i C E G # Same as above. perl intervals --ch --r --j --p --i C D E perl intervals --j --f --i C pM3 pM7 # Pythagoras would be proud. perl intervals --j --ce C D D\# # Intersting analysis... perl intervals --j --ce C D Eb perl intervals --s=8 --j --ce --f --i C D D\# Eb E E\# Fb F perl intervals --j --f --ce --i C 11h 7h # Crazy!
perl intervals --size=3 --chords --equalt --justi --intervals C E G C E G => { chords => [C], eq_tempered_intervals => { C E => 1.25992104989487, C G => 1.49830707687668, E G => 1.18920711500272 }, natural_intervals => { C E => { 5/4 => major third }, C G => { 3/2 => perfect fifth }, E G => { 6/5 => minor third } } }
perl intervals --j --f --i C pM3 G C pM3 G => { natural_frequencies => { C => { 1/1 => unison, perfect prime, tonic }, G => { 3/2 => perfect fifth }, pM3 => { 81/64 => Pythagorean major third } }, natural_intervals => { C G => { 3/2 => perfect fifth }, C pM3 => { 81/64 => Pythagorean major third }, pM3 G => { 32/27 => Pythagorean minor third } } }
> perl intervals --s=9 --j --f --i C D Db D\# Eb E E\# Fb F C Db D D# Eb E Fb E# F => { natural_frequencies => { C => { 1/1 => unison, perfect prime, tonic }, D => { 9/8 => major whole tone }, D# => { 75/64 => classic augmented second }, Db => { 27/25 => large limma, BP small semitone (minor second), alternate Renaissance half-step }, E => { 5/4 => major third }, E# => { 125/96 => classic augmented third }, Eb => { 6/5 => minor third }, F => { 4/3 => perfect fourth }, Fb => { 32/25 => classic diminished fourth } }, ... }
> perl intervals --s=9 --j --f --i C D Db D\# Eb E E\# Fb F C Db D D# Eb E Fb E# F => { ..., natural_intervals => { C D => { 9/8 => major whole tone }, C D# => { 75/64 => classic augmented second }, ... Eb E => { 25/24 => classic chromatic semitone, minor chroma, minor half-step }, Eb E# => { 625/576 => 1.08506944444444 }, Eb Fb => { 16/15 => minor diatonic semitone, major half-step }, Eb F => { 10/9 => minor whole tone }, E E# => { 25/24 => classic chromatic semitone, minor chroma, minor half-step }, E Fb => { 128/125 => minor diesis, diesis, diminished second }, E F => { 16/15 => minor diatonic semitone, major half-step }, E# F => { 128/125 => minor diesis, diesis, diminished second }, Fb E# => { 3125/3072 => small diesis }, Fb F => { 25/24 => classic chromatic semitone, minor chroma, minor half-step } } }