Package: maj7
Eb-maj7DescriptionEb-maj7 (pronounced E flat major 7) is an esoteric programming language that runs programs and outputs a midi file.
This means that one can run an artificial intelligence while writing it so, that it outputs a beautiful midi file to play.You have to figure out on what languages this languages takes references, I don't know myself.RunTo run a program, simply clone the repo and run the following cmd:./maj7.py <path to file>.NOTE: make sure that by default, a python file is opened with an interpreter, not with pycharm etc...NOTE 2: this will change to simple cmd (maj7 [run|build] [path])SourceThe pip version can be found on GitHub underthis link.The development version can be found on GitHub underthis link.How to write a program?This is (not) very simple. A program consists of:a headera titlea keya composera datea placeNOTE: the naming of the place will be important later ona timingthe name of the main function (it has to be aBar)at least oneBaras manyChordas you wish - I mean, you are the composer right?HeaderThe header is to be writen like this:<title> in <key>
<composer>
Composed in <date>
Composed in [as many words as you wish, only the last is kept] <place>

Time: <time>

opening in <name of the first Bar>TitleThe Title is not important for the project, so you can write whatever you want, Mr. Hans Zimmer.Note that it only acceptsletters.KeyThe key has the following Grammar:<A|B|C|D|E|F|G>[#] <Major|Minor>.
Example:A# Major.ComposerThe Composer is not important for the project, so it can contain whatever you wish Einstein.Note that it only acceptsletters.Date:The Date may or may not be important for the project.Note that it only acceptsarabic numbers(0-9).PlaceThe placeis very important. The last word you put after "Composed in" will be the name of the list (you will soon learn what this list is).Note that it only acceptsletters.TimeSame as date, you know the procedure...Name of the first BarLike the name states, it's the name of the first Bar you want to execute.RestSo here you are young padawan, motivated to learn about this language. Nice!So first up: forget variables...Variables...wait not entirely, the language has two variables:LeftHandandRightHand. (I hope you understand the naming)List"But I need more variables!!" you may ask... and you'd be wrong but still... I thought of everything.As hinted above there is a (infinitely big) list where you can store values - remember: you named it, it's where you've written your composition.to access the content:<list name>/<index>.
Note that index can be anote numberor a variable.Wait... what's a "note number"Well... numbers doesn't really exist in arabic form.You may create a number by the following rules:a note has avaluefor example:Cis 0,Dis 2,D#is 3 etc...Capital letters a positive, small letters are negativedis -2Note that you can have as many#as you wish, soD##is 4.two notes that a next to each other are being multipliedfor example:DDis 4 (2x2),D#Dis 6 (3x2)note groups separated by a,are being added togetherfor exampleD#, Dis 5 (3+2),D#D, Dis 8 (3x2 + 2)Once you've understood how that works, you just have to relearn how to do basic math, it's a good exercise for the brain old man (or old woman).AssignmentsShort answer:<variable, list> := <variable, list, note number>.Reason being that i just liked the aesthetic of:=, deal with it I guess right.LoopsLoops are very simple:Forn|:
  [code]
:|Your code will be looped n times over.While|:
  [code]
:|Your code will be loopedinfinitelyover. You have to stop the loop with atenuto.If<keyword> a b <play NAME|tenuto> [<keyword> <play NAME| tenuto>]If statements are pretty easy for intelligent people to understand. They are 4 keywords:forte,piano,harmonizes.The first keyword determines the type of check that is being madeforte: a > bpiano: a < bharmonizes: a == b (Yes I know, harmonies are more complex, but I think that this is not my problem right?)NOTE: for the second keyword, a different keyword than the first one should be created, and harmonizes can't be used for the second keyword.PrintTo print sth. to the console, we have two possibilities:press [hard] <value>- System.out.print(<value>)smash [hard] <value>- System.out.println(<value>)If the keywordhardis being used, then the true value ofvalueis printed, else it's the ascii representation.CommentsMade using#. Avoid using inline comments, it's not very stable.Bar and ChordsEverything (above) must be written in a Bar or a Chord.Bars and Chords are basically functions. For the program, they have no difference, but will do different jobs at generating the midi file.PlayTo run a Bar or a chord, simply writeplay <name>.NOTE: LeftHand and RightHand are only local, so the played chord/bar doesn't inherit the values of the last chord/bar.User inputYou can uselistenin a declaration to listen to the users input. Only the ascii number of the first char is returned.Example program that print "Hello World"Fuer Elise in A MinorLudwig van BeethovenComposed in 1802Composed in a SaloonTime:138opening in Hello World# Comment style 1Bar:Hello Worldplay Write in ens Mudaplay printChord:Write in ens Muda# init index 0LeftHand := CRightHand := C# Write H to indexSaloon/LeftHand := AF#, D# 72# increment index by 1LeftHand := LeftHand, C## Write e# etc...Saloon/LeftHand := AA, C## 101LeftHand := LeftHand, C## lSaloon/LeftHand := AA#, d# 108 (10x11 - 2)LeftHand := LeftHand, C## lSaloon/LeftHand := AA, G# 108 (10x10 + 8)LeftHand := LeftHand, C## oSaloon/LeftHand := AA, A## 111LeftHand := LeftHand, C## " "Saloon/LeftHand := EED# 32LeftHand := LeftHand, C## WSaloon/LeftHand := EDA, F#LeftHand := LeftHand, C## oSaloon/LeftHand := AA, A## 111LeftHand := LeftHand, C## rSaloon/LeftHand := AA#, ELeftHand := LeftHand, C## lSaloon/LeftHand := AA, G# 108LeftHand := LeftHand, C## dSaloon/LeftHand := AA# 100LeftHand := LeftHand, C## !Saloon/LeftHand := EED, C## 33LeftHand := LeftHand, C#Chord:print# One could also print the chars directly in the above Chord.# This Chord is only there to show for loopsLeftHand := C12|:press Saloon/LeftHandLeftHand := LeftHand, C#:|