<div dir="ltr">Hello,<div>I wrote a Haskell program which reads a MusicXML score and plays it through real-time MIDI messages (using the portmidi module) via some algorithms that are customized depending on the MIDI synthesizer that is receiving the messages. The program also plays back the music with musically expressive nuances. </div><div><br></div><div>In the next version of this program, I am going to add more complicated algorithms for the expressive nuances, and it would be helpful to configure them and express them in actual Haskell code. My workflow will look like this:</div><div><br></div><div>A. write a score using the music typesetting program Sibelius</div><div><br></div><div>B. write some Haskell code to provide expressive nuances</div><div><br></div><div>C. play the music through a MIDI synthesizer and listen.</div><div><br></div><div>D. based on what I hear and where I want to take the music, modify the score and the Haskell code </div><div><br></div><div>E. loop back to C</div><div><br></div><div>Therefore, if I don't want to recompile the program each time I do step D, I need to compile and load code dynamically.<br></div><div><br></div><div>Let's say that a data structure which contains a MusicXML score and a nominal rendition into MIDI messages together with time tags is of type Score. Then I want to write, and dynamically compile/load, a function</div><div><br></div><div>vary :: Score -> Score</div><div><br></div><div>which varies the MIDI messages and time tags to add expressive nuances.</div><div><br></div><div>Let's say 'vary' is contained in Vary.hs.</div><div><br></div><div>I want to write 'vary' in terms of already-compiled functions that provide the basic music-processing operations. Let's say that these functions are in the module MusicBase. Then Vary.hs will look like</div><div><br></div><div>import MusicBase</div><div><br></div><div>vary = ... operations in MusicBase ...</div><div><br></div><div>Can I get some basic idea of how to do this?</div><div><br></div><div>D</div><div><br></div></div>