Closed sergei-mironov closed 7 years ago
Hi! Thanks for your interest :)
I think the issue in your case is the play
function: it is only intended to convert melodies into Music
values, which is what prog
does with progressions. In very simplistic terms, you have:
Progression
: the abstract type for chord progressions.Music
: the main data type which performs the rule-checking.Score
: type of MIDI tracks which can be exported into MIDI files.prog :: Progression -> Music
: function to convert abstract progressions into concrete Music
values.defScore :: Music -> Score
: function to convert Music
values into exportable MIDI tracks.Hence you only need
p = defScore $ prog $ ph_IVI ton dom_V ton :+ cadence (full subdom_IV auth_V7_I)
As an aside, play
was renamed to start
in the latest release (which I just added) to avoid confusion with the live playback functions.
Once you have a Score
(by applying defScore
or the more general score construction functions to a Music
value), you can use renderScore
to render it into a MIDI file (that part of your program seems correct).
Thanks for the kind words! I do agree that type-level hackery is a bit risky – it's quite easy to break stuff and output an enormous and scary error message. However, it's quite nice when it works! I am considering rewriting Mezzo on the term level (or even TH, as you suggest) in the future to compare the benefits and drawbacks of the two approaches (though this will have to wait as I need to concentrate on a different project this year).
I hope this helped!
Hi! Thanks for the nice package. I tried to compile examples from the README, but got stuck near the progressions section. Could you please describe how to compile progressions into midi?
My attempt looks as follows
In response, I got a screen full of letters...
As a more in-depth feedback, let me state that idea is of music-dsl with rule-checking is truly brilliant! I would be happy to use such DSL to learn music theory. Unfortunately, in current implementation, GHC error messages are nearly impossible to understand! I would suggest to re-implement the language as full-scale DSL (e.g. using QuasyQuotes) with its own compiler/interpreter. I believe such a language may live with some well-known typechecker like HindleyMilner. Overcomplicated GHC types kill all the fun!