Re: [LAU] transform midi Control Change 7 into velocity events?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-user@...>
Date: Friday, November 21, 2008 - 3:07 am

On Thursday 20 November 2008 23:49:46 Philippe Hezaine wrote:

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

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@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAU] transform midi Control Change 7 into velocity events?, Philippe Hezaine, (Thu Nov 20, 2:09 pm)
Re: [LAU] transform midi Control Change 7 into velocity even..., Philippe Hezaine, (Thu Nov 20, 10:44 pm)
Re: [LAU] transform midi Control Change 7 into velocity even..., Dominic , (Fri Nov 21, 3:07 am)
Re: [LAU] transform midi Control Change 7 into velocity even..., Philippe Hezaine, (Fri Nov 21, 12:22 pm)
Re: [LAU] transform midi Control Change 7 into velocity even..., Philippe Hezaine, (Sat Nov 22, 12:28 pm)
Re: [LAU] transform midi Control Change 7 into velocity even..., Philippe Hezaine, (Mon Nov 24, 11:31 pm)