On Sun, 2012-02-12 at 18:09 +0100, Nils Gey wrote: > Am Sun, 12 Feb 2012 16:51:14 +0000 > schrieb Richard Shann <[email protected]>: > > > It occurred to me a month or so ago that with just a few primitive > > commands added to Denemo we could generate the MIDI for playback from > > scheme. This would make it much easier to implement things like > > repeats, less mechanical note lengths and so on. > > With Nils working on a more MIDI oriented program, I wondered if there > > was a possibility of developing the algorithm for MIDI generation in > > an abstract form, so that it could easily be implemented for any > > program by providing primitives for the basic operations of stepping > > through a score. > > Does anyone fancy writing such a top-level description of MIDI > > generation from a score? Has anyone listened to other attempts at > > this, e.g. LilyPond's MIDI output? > > > > Richard > > > I use Python but I still use libsmf, the python bindings are done by > Dominic Sacre. > > The core of my midi generation is a cursor that goes through the > score, step by step from the beginning to the end. Each object in the > score has "exportMidi" method, hmm, how do tied notes work in that case - they just export a start but no end? With the tied-to note doing the end but no start? Yes, that would work - harder would be the sort of tenuto which implies notes overlapping slightly. You need to output the end note for a later time than the start note of the next note. Will you be able to handle this?
> which returns or directly adds the midi > byte object to the midi stream/libsmf. > > The clue here is that the cursor gathers data which can be used for > better midi generation. For example if there is a keysig change or > instrument change the cursor can save that and all following notes can > rely on that data. This example could be used for different tunings and > tuning changes, if it weren't possible anyway by just sending a tuning > command to the sampler. > > The real problems are repeats. I have not implemented them myself. A > simple repeat maybe would be simple but once you get first and second > volta and nested repeats it becomes more difficult. I would think repeats would be handled by making a first pass establishing which sections are to be played and the order they are to be played in. Then a second pass would traverse the sections (repeatedly as needed) obeying directives to do things like playing the repeat more quietly. I imagine a good MIDI generator would also keep track of which beat in the bar a note was on, and consult something to say how each beat should be played, (e.g. slightly louder ...) Well, I was just wondering if we could develop a written description of what should be done, an algorithm, which could then be implemented for any score-based program, rather than hard-coding the algorithm in some code. Richard > > Nils > > _______________________________________________ > Denemo-devel mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/denemo-devel _______________________________________________ Denemo-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/denemo-devel
