On Thursday 20 November 2008 23:49:46 Philippe Hezaine wrote:
> > I'm not sure mididings is the right tool for the job. The Python code
> > to transform the events would be quite simple, but mididings doesn't
> > support reading/writing MIDI files (yet?). You could of course use a
> > separate MIDI player/recorder, and route the events through mididings,
> > but you'd lose all meta information (tempo, time signature, etc.) from
> > the original file.
>
> Yes. I was sucessfull to loop a midi file with Jack and Rosegarden. The
> outputs was routed through mididings and went back to Rg for a new
> record on a new track. But it was not for this purpose and i didn't look
> for the meta information.
> But for now, if i have a copy about these informations may be i can try
> again this experience? It isn't a piece of music, only a succession of
> drums patterns. I can organize them to avoid different time signature...
Recording to a new track in the same Rosegarden session is actually a very
good idea, I didn't think of that... You wouldn't lose anything that way.
As for the transformation, something like this should do the trick (not
thoroughly tested):
from mididings import *
class Volume2Velocity:
def __init__(self):
self.vol = {}
def __call__(self, ev):
if ev.type_ == CTRL and ev.param == 7:
self.vol[ev.channel] = ev.value
return None
elif ev.type_ == NOTEON and ev.channel in self.vol:
ev.velocity = self.vol[ev.channel]
return ev
run(Call(Volume2Velocity()))
> > As far as I can see, all tracks in your MIDI file are on the same
> > channel, so CC #7 messages on one track will affect the other tracks as
> > well. You should probably assign a different channel to each track.
>
> No. Like i have said these are drums patterns written by Lilypond. After
> the famous transformation i could join all the tracks in one if i want.
Yes, but then you need to do the transformation one track at a time. If you
play multiple tracks through the same MIDI port on the same channel, some
notes will get the wrong velocity (unless every note event is immediately
preceded by a volume change).
Cheers,
Dominic
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user
Received on Fri Nov 21 08:15:01 2008
This archive was generated by hypermail 2.1.8 : Fri Nov 21 2008 - 08:15:01 EET