[HN Gopher] Coltrane: A music theory library with a command-line...
       ___________________________________________________________________
        
       Coltrane: A music theory library with a command-line interface
        
       Author : robenkleene
       Score  : 241 points
       Date   : 2023-03-10 11:02 UTC (1 days ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | tmountain wrote:
       | As a journeyman jazz guitarist and music theory enthusiast, I
       | can't wait to check this out!
        
       | [deleted]
        
       | [deleted]
        
       | gusmd wrote:
       | This is awesome! I've been using https://jguitar.com/ for quite
       | some time, specially the scales portion of it. I'll give this a
       | try!
        
       | kettunen wrote:
       | This is very cool! Sometime ago I ended up starting a similar
       | project in Common Lisp, but then life happened and it has stayed
       | as WIP for quite a while already... Maybe now I don't need stress
       | about finishing it since this seems quite handy!
        
       | flipcoder wrote:
       | My text-based music sequencer supports some music theory concepts
       | and also has a shell:
       | 
       | https://github.com/flipcoder/textbeat
        
       | huimang wrote:
       | I must be the only one here who downloaded it to try it out,
       | because none of the commands work. See issue#56, I just get
       | "abnormal end". It also hasn't been updated since 2021.
       | 
       | The chords for guitar also are weird. It doesn't seem to be using
       | traditional shapes, but is looking for available notes within a
       | fret range. Which leads to difficult, basically unusable
       | fingerings.
       | 
       | The other functions would be very useful to have, if it worked.
       | Maybe one day I'll write a similar CLI tool.
        
       | marai2 wrote:
       | Does anyone have recommendations for music theory from complete
       | basics? Like I don't even know what a pitch is, what a tone is?
       | 
       | Any recommendations would be much appreciated - books, videos,
       | tutorials?
        
         | eigenvalue wrote:
         | Check out Gracie Terzian on YouTube if you're a total beginner
         | and getting overwhelmed by other music theory sources. Her
         | speciality is really breaking things down and simplifying as
         | much as possible.
        
         | ck45 wrote:
         | https://www.youtube.com/@GracieTerzian is a really good
         | teacher.
        
         | petercooper wrote:
         | Yes, Rick Beato. He covers all sorts of stuff to different
         | extents. Like music theory in ten minutes:
         | https://www.youtube.com/watch?v=mWpXy57-mvc .. but he has
         | hundreds of videos on keys, modes, analyzing popular music, the
         | works.
         | 
         | If you really know _nothing_ you might enjoy this attempt at
         | explaining harmony at five different levels from a child to
         | Herbie Hancock: https://www.youtube.com/watch?v=eRkgK4jfi6M
        
           | lst68 wrote:
           | Rick Beato also has a book and interactive courses that are
           | on sale at the moment: https://rickbeato.com/ (I have bought
           | the bundle, but I haven't had time to check it out yet.)
           | 
           | An other useful channel I can recommend is
           | https://www.youtube.com/@DavidBennettPiano
        
             | gramie wrote:
             | Don't feel rushed, Rick's content is _always_ on sale. I
             | don 't have first-hand knowledge, but have read some
             | criticisms that the "Beato Book" is not always coherent or
             | well organized. That said, I believe he has recently made
             | substantial revisions, and added a lot of on-line content.
             | 
             | Probably not the worst way to spend ~$100!
        
         | ofalkaed wrote:
         | A teacher is by far the best way to go, failing that The
         | Complete Musician is the best book/source I have seen for self
         | study. The problem with self study is that the basics of
         | harmony/triads seems very simple and people plow through it and
         | think they understand than get completely stuck. Everything is
         | built on harmony and if you do not understand it you will not
         | progress. If you go with self study remember that if you are
         | stuck it means you did not understand what came before, go back
         | and figure out what you missed, which is where a teacher is
         | very handy since they will have a much better idea about what
         | you missed than you do.
        
       | Mizza wrote:
       | Looks awesome, love the tab view.
       | 
       | If there other hackers who make music here, I wrote this:
       | 
       | https://github.com/Miserlou/chords2midi
       | 
       | for writing chord progressions on the command line. I use it for
       | building progressions which I drag into my DAW. It has voice
       | leading, which required me translating an algorithm from 18th
       | century German musical textbook into Python. I don't speak German
       | and there were no unit tests in the 1700s so I'm only fairly
       | certain that it works properly.
       | 
       | I will make a plugin version once ableton supports CLAP.
        
         | ck45 wrote:
         | This looks really awesome! Do you know
         | https://www.mellowood.ca/mma/ and if yes, do you mind doing a
         | short feature comparison?
         | 
         | Edit: I just checked if it's worth submitting, but it has
         | already been submitted:
         | https://news.ycombinator.com/item?id=30903980
        
           | Mizza wrote:
           | Wow, never seen that before. This seems more like a whole
           | plaintext musical language, like mma is to midi what markdown
           | is to HTML. Mine is just a way for somebody in a hurry to get
           | the MIDI chords they want without putting all of the notes in
           | manually.
        
         | scns wrote:
         | Awesome! Please do a Show HN when the plugin is done.
        
       | originalcopying wrote:
       | I'm on a (possibly multi-)lifetime quest to understand this
       | better.
       | 
       | all of what this music library does comes out of the concept of
       | the music keyboard, which is (in my head) the same as the 12-note
       | _" meta"_-scale which is a system that enables 12 different
       | version of 7 note scales.
       | 
       | in this view, a scale does not begin in any specific note; this
       | perspective of "scale" goes beyond the typical music theory view.
       | understanding 'scales' like this implies that the major and minor
       | 'scales' are the same 'scale'. I should choose another vocabulary
       | term for this quasi-scale idea (semiscale?)
        
         | rdlw wrote:
         | If you are talking about a set of seven notes, that is not a
         | scale. C and Am have the same notes, but a different tonic, but
         | they are different scales, so a scale is defined by the notes
         | it contains and the mapping of scale degrees to those notes.
         | 
         | What you are describing, seven notes that do not 'start'
         | anywhere, is the set of all scales that are enharmonic with a
         | given scale, meaning they have all the same notes. These scales
         | are said to be relative to each other: Am is the relative minor
         | of C.
         | 
         | I think what you're trying to get at is that when you don't
         | consider any note to be the tonic, and play freely in a set of
         | seven notes, you can play more expressively. If you change the
         | tonic without changing the notes in the scale, you are now
         | playing in a different mode.
         | 
         | For example, if you started in C, playing the notes CDEFGAB,
         | you are playing in C Ionian (much more frequently just called C
         | Major). If you change the tonic to A, the scale is now ABCDEFG,
         | or A Aeonian (much more frequently just called A minor). Now if
         | you change the tonic to D, the scale is DEFGABC, or D Dorian.
        
           | originalcopying wrote:
           | yea, but for some reason I don't think I could explain very
           | well (which is a problem), I am trying to _somehow_ consider
           | all those 7 notes (and their 7 modes) as the same  'scale'.
           | As I said, I need to find another term to refer to this way
           | to consider the intervalic structure as if it were one thing.
           | 
           | Essentially I'm trying to grab a 'scale' and combine it with
           | all it's conjugate words (or circular shifts) [1,2] and I
           | don't know what to call this thing but I'm interested in it.
           | 
           | Why? because of how I choose to understand the origin of the
           | 7 note major scale:
           | 
           | you take any note (the base tone) and multiply the frequency
           | by 3. this creates a fifth (plus one octave). I'll keep in
           | mind that 'the octave' is defined by multiplying the
           | frequency by 2.
           | 
           | then, fit the fifth (base tone * 3) into only one octave
           | (3/2). And repeat 'recursively'.
           | 
           | This is the famous circle of fifths, but we all knew that.
           | Finally, after twelve repetitions we're back on the same
           | note, but an octave above. (but why? why stop at twelve? I'm
           | still working through this answer, but it has something to do
           | with convergence maybe? or just the fact that after 12 notes
           | we have now landed within two notes which we 'found'
           | already???)
           | 
           | With this in mind, we have two different ways to sort all
           | notes. Sequentially within a single octave, like on the piano
           | or a guitar. Or in the way which we generated them out
           | repeating 3/2.
           | 
           | If we only did 7 notes (instead of 12) we would get these two
           | ways to sort:
           | 
           | ABCDEFG;ABCDEFG; ABC...there are 8 octaves in a piano
           | 
           | CGDAEB... F# C# .... C
           | 
           | I just cannot yet get over the fact that this is not a
           | conjugate (not a circular shift) but a full on permutation, a
           | shuffling of the notes.
           | 
           | By this point, it should be apparent that the labels we use
           | for the notes are but a minor detail. I'm trying to abstract
           | all this away from the ultimately arbitrary names of the
           | notes.
           | 
           | ...I can keep going. this is just part of the setup.
           | 
           | when this starts to get interesting is when I go on to
           | consider the rhythmic aspect of music using similar symbolic
           | tools; but in a subtly different way. As I said upthread,
           | I've been thinking about this stuff for a while now, and it
           | adds up.
           | 
           | All this because I still do not understand (to my own
           | satisfaction) what's going on with the 12 note system, up to
           | which extent and how does it do? what I (almost but not
           | quite) understand to happen with 7 notes and
           | major/minor/other modes scales.
           | 
           | [1] https://en.wikipedia.org/wiki/Free_monoid#Conjugate_words
           | 
           | [2] https://en.wikipedia.org/wiki/Circular_shift
        
             | tremon wrote:
             | Note that different modes of the same scale are only
             | enharmonic in the standard piano tuning (equal
             | temperament). Under different tunings [1], the exact
             | frequencies of the notes in e.g. the A minor scale and the
             | C major scale do not necessarily match up. These different
             | tunings are the reason why certain keys are ascribed a
             | certain character (e.g. the E scale was considered morose
             | whereas the same scale in A was considered uplifting).
             | 
             | Then there's the octatonic scale, the double harmonic scale
             | and quarter-tone intervals present in e.g. arabic music
             | [2], or even more exotic scales [3]. So whatever "deeper
             | logic" you're after, there will always be scales that do
             | not match your preferred system. Be careful you're not
             | straying into numerology, trying to find a deeper "truth"
             | beyond what sounds agreeable to the ears of the listeners.
             | 
             | [1] https://en.wikipedia.org/wiki/Musical_tuning#Systems_fo
             | r_the...
             | 
             | [2] https://en.wikipedia.org/wiki/Quarter_tone_scale
             | 
             | [3] https://en.wikipedia.org/wiki/17_equal_temperament
        
             | AndrewPGameDev wrote:
             | >Why? because of how I choose to understand the origin of
             | the 7 note major scale: you take any note (the base tone)
             | and multiply the frequency by 3. this creates a fifth (plus
             | one octave). I'll keep in mind that 'the octave' is defined
             | by multiplying the frequency by 2. then, fit the fifth
             | (base tone * 3) into only one octave (3/2). And repeat
             | 'recursively'.
             | 
             | This is called 3-limit tuning:
             | https://en.xen.wiki/w/3-limit . 5-limit tuning is what
             | standard western music uses: https://en.xen.wiki/w/5-limit
             | (to include thirds as well as fifths) After reducing the
             | ratios to fit in an octave, you get exactly 8 notes (7 if
             | you subtract the octave itself). Note how
             | https://oeis.org/A054540 shows that 7 notes are a good
             | approximation of the ratios, but so are 12 (which shows why
             | creating a 12-note system was an advantageous move, over 11
             | or 13). Technically in 12-EDO a fifth is not exactly
             | generated by the ratio 1.5, it's slightly flat at
             | 1.498307... but we choose the note closest to 1.5.
             | 
             | > This is the famous circle of fifths, but we all knew
             | that. Finally, after twelve repetitions we're back on the
             | same note, but an octave above. (but why? why stop at
             | twelve? I'm still working through this answer, but it has
             | something to do with convergence maybe? or just the fact
             | that after 12 notes we have now landed within two notes
             | which we 'found' already???)
             | 
             | Suppose we already chose a 12-note equal-tempered system.
             | The closest note to the perfect fifth of a fundamental
             | frequency `f` will be `f * 12th-root(2)^7`, (7 notes out
             | just happens to be close to multiplying by 3/2). The next
             | fifth after that would be `f * 12th-root(2)^7 * 12th-
             | root(2)^7 = f * 12th-root(2)^14`. Going out by a fifth 12
             | times gets you `f * 12th-root(2)^84 = f * 12th-root(2)^(7
             | _12)`. But we know that `12th-root(2) ^ 12 = 2`, simply
             | from the definition of 12th root. Multiplication is
             | commutative, so we can group the roots-of-twelve by groups
             | of 12 instead of groups of 7, and we get `f_ 2^7`. Taking
             | that modulo 2, we just get f, i.e. the same (enharmonically
             | equivalent) note.
             | 
             | Now suppose we didn't make that choice, instead we chose a
             | 31-note system (I'm a big fan of 31-EDO). In that case, we
             | have the same construction. The fifth in 31-EDO happens to
             | be an interval of 18 notes, and similarly we jump around
             | the scale, but this time an interval of one note is `31st-
             | root(2)`, so we have to do 31 fifths to get back to the
             | same note.
             | 
             | This actually tells us something interesting - if we want
             | to form a circle (made out of intervals, that end up
             | hitting the original enharmonically-equivalent-note) to hit
             | all of the notes in our scale the notes we hit must be a
             | permutation of the original scale. It's a little beyond my
             | math to tell you how this works, I think Fermat's little
             | theorem and modular arithmetic has something to do with how
             | it works. Something about how 7 and 12 (or 18 and 31) are
             | relatively prime compared to each other, and it forms a
             | group which generates a permutation.
        
           | bonzini wrote:
           | One small correction: changing just the mode (i.e. keeping
           | the same notes while changing the tonic) is usually called a
           | modal interchange.
           | 
           | Modulation typically changes the notes, which is achieved by
           | changing either the tonic or the mode or both. For example C
           | major to D major is a modulation, but C Ionian (major) to D
           | Dorian is usually called a modal interchange.
           | 
           | Also, to be honest, the last paragraph is very simplistic and
           | makes me wonder if the whole comment didn't come out of
           | ChatGPT.
        
             | rdlw wrote:
             | Wow, ok. I think I'll take that as a compliment, at least
             | my input looks good at surface level! :)
             | 
             | I'm not super knowledgeable about modal jazz but when I
             | think 'mode', I think 'modal jazz', so I thought that would
             | be good to throw in there as an example of music you can
             | listen to if you want to hear these concepts in action
             | rather than just reading about them.
             | 
             | Thanks for the correction, that's my bad.
             | 
             | edit: I removed the last paragraph, "This process is called
             | modulation, and it is the defining feature of modal jazz.",
             | since your correction explains it better than I could
        
               | bonzini wrote:
               | What fooled me was going from an entirely correct
               | paragraph to one that... had words that were consistent
               | with the topic but a lot of inaccuracies. I think we can
               | treat it as a reverse Turing test. :) I knew I was
               | probably wrong but it seemed like an interesting
               | observation.
               | 
               | Modes other than major or minor are very common in modern
               | non-jazz music. A lot of minor songs are actually Dorian
               | (not all! a couple examples are Boulevard of Broken
               | Dreams or Wicked Game) or in the case of metal Phrygian.
               | A lot of major pop songs are Mixolydian (all those that
               | sound like Hey Jude, for example Sweet Child O'Mine).
               | 
               | Also Lydian is quite common in soundtracks because it has
               | a very "suspended" feeling (due to the lack of a dominant
               | seventh chord that can resolve to the tonic), for example
               | Yoda's theme and the Back to the Future theme are both
               | Lydian. In the case of Yoda it then goes to major (I
               | don't remember if it's a mode change or a modulation),
               | while BTTF remains Lydian.
               | 
               | David Bennett has videos on YouTube with many examples of
               | songs for each mode.
        
         | cka wrote:
         | In your third paragraph, I think you're talking about modes:
         | https://en.m.wikipedia.org/wiki/Mode_(music)
        
         | lioeters wrote:
         | > the major and minor 'scales' are the same 'scale'
         | 
         | Indeed, they are two modes of the same pattern. If you look at
         | that pattern in a circle, sometimes called a "necklace", the
         | major and minor scales are rotations of each other.
         | 
         | For this way of looking at music, I recommend the book A
         | Geometry of Music by Dmitri Tymoczko, who teaches composition
         | and theory at Princeton.
         | 
         | > A Geometry of Music provides an accessible introduction to a
         | new, geometrical approach to music theory. The book shows how
         | to construct simple diagrams representing voice-leading
         | relationships among familiar chords and scales. This gives
         | readers the tools to translate between the musical and visual
         | realms, revealing surprising structure in otherwise hard-to-
         | understand pieces.
         | 
         | https://dmitri.mycpanel.princeton.edu/geometry-of-music.html
         | 
         | ---
         | 
         | As an intellectual companion, there's a book called The
         | Geometry of Musical Rhythm.
         | 
         | https://en.wikipedia.org/wiki/The_Geometry_of_Musical_Rhythm
         | 
         | It's written by Godfried Toussaint, a computer scientist who
         | discovered "Euclidean rhythms", a large set of rhythm patterns
         | generated by a simple algorithm, many of which are common in
         | world music traditions.
         | 
         | > In 2004 he discovered that the Euclidean algorithm for
         | computing the greatest common divisor of two numbers implicitly
         | generates almost all the most important traditional rhythms of
         | the world.
         | 
         | The Euclidean algorithm generates traditional musical rhythm -
         | http://cgm.cs.mcgill.ca/~godfried/publications/banff.pdf (PDF)
        
       | thanatropism wrote:
       | I don't understand what this has to do with "music theory", but
       | the comment section seems to find it useful. Qapla'!
        
       | soperj wrote:
       | I love this, I just wish I could change the tuning of the guitar,
       | since I mostly play not in standard tuning.
        
       | madwebness wrote:
       | This shouldn't be free, I'd pay $500 for such a thing. UPDATE:
       | Why? Because it's got all the features without the abuse of the
       | various websites and apps spread out and containing just some of
       | those features. Let alone captchas and Cloudflare and ads.
        
         | oh_sigh wrote:
         | You could always donate $500 to him. And if he won't take it,
         | you could pay a freelancer $500 and task them with tackling
         | some of the open issues that are present in the tracker.
        
           | latexr wrote:
           | > And if he won't take it, you could pay a freelancer $500
           | and task them with tackling some of the open issues that are
           | present in the tracker.
           | 
           | Might be relevant:
           | https://github.com/pedrozath/coltrane/issues/57
        
           | madwebness wrote:
           | I don't particularly believe in donations, but I think
           | there's a better way. I will certainly be reaching out to the
           | author.
        
         | LegitShady wrote:
         | what would you use it for?
        
           | feanaro wrote:
           | Experimentation and visualization when practicing an
           | instrument, composing, improvising.
        
         | gpvos wrote:
         | But still, what is the problem with it being free?
        
       | college_physics wrote:
       | Its a very cool project but as I have seen some other cool
       | efforts as well, I feel that the domain of "open source computer-
       | assisted music theory tools" is quite fragmented and people must
       | reinvent wheels.
       | 
       | I wonder if we could imagine some sort of community project that
       | abstracts certain music related objects (scales, chords) and
       | representations and allows e.g. CLI or web-based rendering using
       | possibly different stacks, interfacing with musicxml, lilypond
       | etc.
       | 
       | Something like the "Grammar of Graphics" but for Music Theory
        
         | chaosprint wrote:
         | how about https://glicol.org
        
           | college_physics wrote:
           | thanks for the pointer, though from a quickscan this is not
           | really a music theory tool but more like supercollider in
           | rust?
        
       | FigurativeVoid wrote:
       | I have been looking for something like this for a while! Super
       | cool. And in ruby. The language of my heart.
        
       | tincholio wrote:
       | Repeating a recent comment on another music-related link. I've
       | recently come across the Humdrum [0] toolkit, which does a bunch
       | of related stuff, in very interesting ways. Coltrane looks
       | awesome! I'll have to delve into this :D
       | 
       | [0] https://www.humdrum.org/
        
       | ofalkaed wrote:
       | I don't think I could call this theory but it is useful.
        
         | [deleted]
        
         | jameshart wrote:
         | It is a tool for doing music theory things.
         | 
         | If someone showed you a slide rule and said it was for
         | 'engineering' would you say 'well it doesn't really do
         | engineering'?
        
           | ofalkaed wrote:
           | It is a chord and scale library and does not show how those
           | things relate or present them in a way conducive towards
           | study of that. If you know how the information this app
           | provides is related then you probably do not need the app for
           | theory. Theory is not memorization of chords, scales and
           | progressions; theory shows you how to construct those things
           | so you do not need to memorize everything.
           | 
           | A slide rule would be more analogous to a musical instrument.
           | If you want an analogy between this app and engineering in
           | the slide rule days, it would be closer to a pocket sized
           | reference book of log tables and formulas.
        
             | xhevahir wrote:
             | So you're saying this thing doesn't _teach_ theory. Fine.
             | But I don 't think it claims to do so.
        
               | ofalkaed wrote:
               | I did not say that at all. This programs relation to
               | theory is about the same as the relation between numbers
               | and calc, while numbers are very important to calc you
               | are not learning or using calc by using numbers, there is
               | a hell of a lot more to it.
        
               | seanyeh wrote:
               | I sort of see where you are coming from, but "music
               | theory" is the standard accepted term for this general
               | field of study, which includes the fundamentals (notes
               | and chords and more). source: used to teach music theory
               | at the university level
        
       | ksherlock wrote:
       | I know jazz guitarists have double jointed, mangled hands but
       | most of those generated guitar chords fingerings are, well, let's
       | just say not traditional.
        
       ___________________________________________________________________
       (page generated 2023-03-11 23:00 UTC)