Python Forum
Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Music Notation
#11
You should take a look at lilypond. It has become almost a standard for textual music notation
You can find sheet music all over the web that is written in lilypond format. In addition, there are
some very sophisticated music editors that output lilypond format. Frescobaldi (http://frescobaldi.org/)
is the one that I use. I was good enough at lilypond script at one point that I could write an entire score
in it using emacs and LaTex.

Frescobaldi also has midi input and output. I have used it with my piano, using midi into Frescobaldi. I
had to touch it up some, but not a lot.

My wife and two sons play music, oldest son attended Berkley School of Music but then went on to become
a pharm-D.

My program actually does translaton to lilypond format, and creates an intermediate file. Here's the one that
created the last screen shot:

Output:
\version "2.18.2" #(define (naturalize-pitch p)   (let ((o (ly:pitch-octave p))         (a (* 4 (ly:pitch-alteration p)))         ;; alteration, a, in quarter tone steps,         ;; for historical reasons         (n (ly:pitch-notename p)))     (cond      ((and (> a 1) (or (eq? n 6) (eq? n 2)))       (set! a (- a 2))       (set! n (+ n 1)))      ((and (< a -1) (or (eq? n 0) (eq? n 3)))       (set! a (+ a 2))       (set! n (- n 1))))     (cond      ((> a 2) (set! a (- a 4)) (set! n (+ n 1)))      ((< a -2) (set! a (+ a 4)) (set! n (- n 1))))     (if (< n 0) (begin (set! o (- o 1)) (set! n (+ n 7))))     (if (> n 6) (begin (set! o (+ o 1)) (set! n (- n 7))))     (ly:make-pitch o n (/ a 4)))) #(define (naturalize music)   (let ((es (ly:music-property music 'elements))         (e (ly:music-property music 'element))         (p (ly:music-property music 'pitch)))     (if (pair? es)        (ly:music-set-property!          music 'elements          (map (lambda (x) (naturalize x)) es)))     (if (ly:music? e)        (ly:music-set-property!          music 'element          (naturalize e)))     (if (ly:pitch? p)        (begin          (set! p (naturalize-pitch p))          (ly:music-set-property! music 'pitch p)))     music)) naturalizeMusic = #(define-music-function (parser location m)   (ly:music?)   (naturalize m)) \header {   title = "Major and Minor Scales - Ghana Heptatonic  (alias for Major)"   composer = "Created By McNote ver. 1.0.0" } music = \relative c' { c d e f g a b c \bar "|." } \score {   \relative c' { c \mark "C Ghana Heptatonic" d e f g a b c \bar "|." } } \score {   \relative c' { cis \mark "C# Ghana Heptatonic" dis eis fis gis ais bis cis \bar "|." } } \score {   \relative c' { des \mark "Db Ghana Heptatonic" ees f ges aes bes c des \bar "|." } } \score {   \relative c' { d \mark "D Ghana Heptatonic" e fis g a b cis d \bar "|." } } \score {   \new Staff {     \naturalizeMusic     \transpose c dis {       \mark "D# Ghana Heptatonic - Theoretical Key"       \music     }   }   \layout { \override NonMusicalPaperColumn.page-break-permission = ##f } } \score {   \relative c' { ees \mark "Eb Ghana Heptatonic" f g aes bes c d ees \bar "|." } } \score {   \relative c' { e \mark "E Ghana Heptatonic" fis gis a b cis dis e \bar "|." } } \score {   \new Staff {     \naturalizeMusic     \transpose c eis {       \mark "E# Ghana Heptatonic - Theoretical Key"       \music     }   }   \layout { \override NonMusicalPaperColumn.page-break-permission = ##f } } \score {   \new Staff {     \naturalizeMusic     \transpose c fes {       \mark "Fb Ghana Heptatonic - Theoretical Key"       \music     }   }   \layout { \override NonMusicalPaperColumn.page-break-permission = ##f } } \score {   \relative c' { f \mark "F Ghana Heptatonic" g a bes c d e f \bar "|." } } \score {   \relative c' { fis \mark "F# Ghana Heptatonic" gis ais b cis dis eis fis \bar "|." } } \score {   \relative c' { ges \mark "Gb Ghana Heptatonic" aes bes ces des ees f ges \bar "|." } } \score {   \relative c' { g \mark "G Ghana Heptatonic" a b c d e fis g \bar "|." } } \score {   \new Staff {     \naturalizeMusic     \transpose c gis {       \mark "G# Ghana Heptatonic - Theoretical Key"       \music     }   }   \layout { \override NonMusicalPaperColumn.page-break-permission = ##f } } \score {   \relative c' { aes \mark "Ab Ghana Heptatonic" bes c des ees f g aes \bar "|." } } \score {   \relative c' { a \mark "A Ghana Heptatonic" b cis d e fis gis a \bar "|." } } \score {   \new Staff {     \naturalizeMusic     \transpose c ais {       \mark "A# Ghana Heptatonic - Theoretical Key"       \music     }   }   \layout { \override NonMusicalPaperColumn.page-break-permission = ##f } } \score {   \relative c' { bes \mark "Bb Ghana Heptatonic" c d ees f g a bes \bar "|." } } \score {   \relative c' { b \mark "B Ghana Heptatonic" cis dis e fis gis ais b \bar "|." } } \score {   \new Staff {     \naturalizeMusic     \transpose c bis {       \mark "B# Ghana Heptatonic - Theoretical Key"       \music     }   }   \layout { \override NonMusicalPaperColumn.page-break-permission = ##f } } \score {   \relative c' { ces \mark "Cb Ghana Heptatonic" des ees fes ges aes bes ces \bar "|." } }

I've decided to put the code on Github tomorrow. It will be a work in
progress because as I stated before, the code is crude and developed
as I want along and was learning python.

Perhaps it will be liked enough that others will halp to bring it up to par.
Reply
#12
Added Github repository at: https://github.com/Larz60p/MusicScales
I will be adding code modules one at a time. I need to examine each and
at least correct the most blatantly bad code.
Reply
#13
I just uploaded the last file. A working version is now out there -- for better or worse --
Beware - There's lots of checking to be done, including proper building of scales and just
about everything else.

I already warned you that the code is probably poorly written.
I will be re-writing almost all of it, but will fix bad things that are found until then.
Reply
#14
ouch... looks like lisp. not my cup of tea.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#15
Well, it is, but that's lilypond
As I stated before, it's pretty much the way the automated music notation is going.
The McNote, however is Python, with a built in (crude) lisp generator that I wrote for the
project.

A more accurate statement would be...  Lilypond uses LaTex
LaTex uses Lisp, Sooo.. Lilypond is not really Lisp. It's only related
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Video Rendering math notation with ASCIIMath within Nodezator KennedyRichard 0 1,127 Sep-18-2023, 03:58 PM
Last Post: KennedyRichard

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020