You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mezzo 是一个可以描述音乐的领域内编程语言 / Haskell 库,它可以对不同的音乐创作模式进行静态检查(类似于静态类型检查,这当然也是得益于 Haskell 的类型检查系统),也就是说,如果你创作了“坏”的音乐,你的作曲将不会被编译 – think of it as a very strict spell-checker for music.
importMezzo
comp = defScore $ start $ melody :| c :| d :| e :| f :>> g
main::IO()
main = renderScore "comp.mid""First composition" comp
Save, build and execute. You should get a .mid file in the project directory which looks something like this:
To test the correctness checking, change the d note in comp to a b. You should see the following when you save the file:
• Major sevenths are not permitted in melody: C and B
• In the first argument of ‘(:|)’, namely ‘melody :| c :| b’
In the first argument of ‘(:|)’, namely ‘melody :| c :| b :| e’
In the first argument of ‘(:>>)’, namely
‘melody :| c :| b :| e :| f_’
Mezzo has two ways of composing music: sequential (melodic) and parallel (harmonic) composition ...
Activity