Diary - Learning some music

 

I don't know anything about music. And I don't remember how this started, but now I am making an attempt to learn some music using my laptop.

Although I never finished this (Hegwid's Theme), this was 1st piece of music which I programmed after learning to read some sheet music (about a month back).  Here's the part of sheet music, which I used, along with the code.

(Click on the image)

# Hegwid'sThemeExp.py

from music import *

##### define the data structure
score = Score("Hegwid's Theme", 195) # tempo is 195 bpm

### Celesta Part
celestaPart = Part(CELESTA, 0)


celestaPhrase1= Phrase(0.0);
celestaPitches11 = [REST, B4, E5, G5, FS5, E5, B5, A5, FS5, E5, G5, FS5, DS5, FS5, B4] 
celestaDurations11 = [HN, QN, QN+EN, EN, QN, HN, QN, HN+QN, HN+QN, QN+EN, EN, QN, HN, QN, HN+QN] 
celestaPitches12 = [B4, B4, E5, G5, FS5, E5, B5]
celestaDurations12 = [HN, QN, QN+EN, EN, QN, HN, QN]
celestaPitches13 = [[D5, G5, D6], DF6, [C5,F5, C6], AF5, [C5, E5, C6],A5, GS5]
celestaDurations13 = [ HN, QN, HN, QN, QN+EN, EN, QN]
celestaPitches14 = [AS4, G5, E5, G5, [E5,B5], G5, [E5,B5], G5, [E5, C6], B5]
celestaDurations14 = [HN, QN, HN+QN+HN, QN, HN, QN, HN, QN, HN, QN]
celestaPitches15 = [[FS5,AS5], FS5, [E5, G5], B5, AS5]
celestaDurations15 = [ HN, QN, QN+EN, EN, QN]

celestaPhrase1.addNoteList(celestaPitches11, celestaDurations11)
celestaPhrase1.addNoteList(celestaPitches12, celestaDurations12)
celestaPhrase1.addNoteList(celestaPitches13, celestaDurations13)
celestaPhrase1.addNoteList(celestaPitches14, celestaDurations14)
celestaPhrase1.addNoteList(celestaPitches15, celestaDurations15)

celestaPhrase2= Phrase(0.0);
celestaPitches21 = [REST, E4, E4, E4, E4, E4, AS4, B3, E4, G4]
celestaDurations21 = [HN+QN, HN+QN, HN+QN, HN+QN, HN+QN, HN+QN, HN, QN, HN, QN]
celestaPitches22 = [B4, B3, E4, E4]
celestaDurations22 = [HN, QN, HN+QN, HN+QN]
celestaPitches23 = [[D5, G5, BF6], [C5, F5, AF5],[C5, E5, A5]]
celestaDurations23 = [ HN+QN, HN+QN, HN+QN]
celestaPitches24 = [[CS5, E5, F5], E4, G4, B4, B3, E4, G4, B4, B3, E4, G4]
celestaDurations24 = [ HN+QN, HN, QN, HN, QN, HN, QN, HN, QN, HN, QN]
celestaPitches25 = [AS4, E4, F4, G4, A4, B4, A4, G4, F4, E4, G4]
celestaDurations25 = [QN, SN, SN, SN, SN, SN, SN, SN, SN, HN, QN]

celestaPhrase2.addNoteList(celestaPitches21, celestaDurations21)
celestaPhrase2.addNoteList(celestaPitches22, celestaDurations22)
celestaPhrase2.addNoteList(celestaPitches23, celestaDurations23)
celestaPhrase2.addNoteList(celestaPitches24, celestaDurations24)
celestaPhrase2.addNoteList(celestaPitches25, celestaDurations25)

celestaPart.addPhrase(celestaPhrase1)
celestaPart.addPhrase(celestaPhrase2)

Mod.transpose(celestaPart, 12)
score.addPart(celestaPart)

Write.midi(score, 'Hegwid'sTheme.mid')
Play.midi(score)

 

Original MIDI Version produced directly through python code:

http://moebiuscurve.com/wp-content/uploads/2018/06/HegwidsTheme.mid

 

 

And after converting to mp3 (https://www.zamzar.com/):

 

Although, there's still a lot to learn about basic music.  And it will probably take years. Nevertheless, this is a start for me. And I am loving it.

Share This:

Leave a Reply