Hacker News new | past | comments | ask | show | jobs | submit login

Could someone explain what the basics are of this? I'm not familiar with a lot of music theory. The arpeggio is something like:

    for base_note in range(B,B+5*2,2):
      for arpeggio_note in range(base_note,2*base_note,2):
        yield arpeggio_note
and the "chords" are single notes in some progression? Something like (R, R+1, R+3, R+5, R+6, R+8, R+10), where R is the root note?

What do the different modes do?




The modes are the sequence of seven notes you're choosing from. If we're counting in half-steps (where 12 half-steps is an octave and gets you back to the same note), the different modes would look like...

                    1    2    3    4    5    6    7
  Lydian:          (R,   R+2, R+4, R+6, R+7, R+9, R+11)
  Ionian (Major):  (R,   R+2, R+4, R+5, R+7, R+9, R+11)
  Mixolydian:      (R,   R+2, R+4, R+5, R+7, R+9, R+10)
  Dorian:          (R,   R+2, R+3, R+5, R+7, R+9, R+10)
  Aeolian (Minor): (R,   R+2, R+3, R+5, R+7, R+8, R+10)
  Phrygian:        (R,   R+1, R+3, R+5, R+7, R+8, R+10)
  Locrian:         (R,   R+1, R+3, R+5, R+6, R+8, R+10)
  
  Melodic:         (R,   R+2, R+3, R+5, R+7, R+9, R+11)
  Harmonic:        (R,   R+2, R+3, R+5, R+7, R+8, R+11)    
Then, once you have your mode, you form chords by picking a starting note (from one to seven) and then stacking every other note from there. We're only building triads, so stop after stacking three notes. So, if we're in Ionian, the chords would be...

  I:   (R, R+4, R+7)
  ii:  (R+2, R+5, R+9)
  iii: (R+4, R+7, R+11)
  IV:  (R+5, R+9, R)
  V:   (R+7, R+11, R+2)
  vi:  (R+9, R, R+4)
  vii: (R+11, R+2, R+5)
Instead of playing the three notes simultaneously, the arpeggiator here is playing them one at a time in different orders and octaves.

Hope that helped!


This is really succinct, I like your explanation.


Arpeggio is just a fancy way of saying that you play certain notes in a certain order, usually sequentially.

A mode (like minor or lydian) determines which notes are played. Let's take the notes in C major as an example. If you start with the C and play it up to C', then you get C major. If you play the same notes but starting at D, and up to D', then you get the D Dorian scale. Start with E, you get the E Phrygian scale, start with F, you get the F Lydian scale, etc.. Those scales or modes are all either major or minor (as the difference between major and minor is determined by the interval between first and third note), modes 1,4,5 are major and 2,3,6,7 are minor.

If someone plays a piece in E Phrygian mode, how would you know that it is? By looking at a piano keyboard, you would see that she only plays white keys, which tells you that the tonic/root is C major. Since a piece written in E Phrygian will most likely have progressions or melodies that start/end with an E, you would know that it's not C major, but E Phrygian. If you pay close attention to scores written for mystery movies (or the Simpson's), you will notice that it sounds outlandish or alien. That's because they use the Lydian scale. They might really only use C major notes, but starting a melody at the fourth (F) makes it sound completely different.

A major chord (example C major) is made up of three notes: first is the chord's tonic (C), second is a major third higher than the tonic (E), third is a quint higher than the tonic (G).

A minor chord is similar to a major, but the second note is only a minor third higher than the tonic. Using C minor as an example, the second note is Eb.

The chords that OP progresses over are the modes/scales I described above. If you set the tonic/root to C major, then the 5th mode would be G mixolydian (which happens to be a major mode), or the 6th would be good old A minor. Still, the only notes that are played are those that occur in the C major scale - the chords just use different starting points.


I wrote a little thing that demonstrates chords and scales/modes on a piano keyboard. Maybe it will help to clarify.

https://agile-fortress-99874.herokuapp.com


Wow, awesome, thanks!

Any chance on making the source available under a free/libre license?


Too much to address in a comment, best to look up a music theory primer but I'll attempt to summarize.

Chord = multiple notes played together. There are different ways to arrange the notes within the chord but a common example would be a major chord with consists of the root note, and then a note that is a 3rd above that, and then a 5th above that. For example a C major chord would be C-E-G.

An arpeggio is a rapid succession of notes within a chord. Instead of playing the notes in a chord all at once you cycle through them in some pattern. Typically ascending but as you can see from the tool there are lots of options.

Modes are similar to the scale but I've never learned them well enough to explain it. Altering the mode gives the "scale" a different quality sound. Think about the white and black keys on the piano and how they are not evenly spaced. If you start on C and play all the way to the next C one note at a time it sounds like one scale but if you do the same thing shifting one note higher it is going to sound completely different (not just shifted higher in pitch) it actually has a different quality.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: