generate linear pitch / controller slides

8 views
Skip to first unread message

Mike

unread,
Jun 12, 2009, 4:02:10 AM6/12/09
to KeyKit
Hi group,

I am sure someone more maths orientated than myself must have created
this all ready; i'd love something akin to the following function:

ph=slide(1,1,0,127,4b)

slide accepts a controller #, a channel #, a start value, an end
value, and a duration, and returns a linear slide of the controller
data over that duration.

Similarly you would have:

ph=pitchslide(1,0,100,4b)

as above but with pitch bend and you provide a channel #, start
percentage of bend range, end percentage of bend range and a duration.

Have I missed these functions in the libs or has anybody created
anything like it? If not, anybody fancy taking a crack at it?

Kind regards,
Mike

Tony

unread,
Jun 13, 2009, 4:11:19 AM6/13/09
to Mike, KeyKit
Hi Mike,

I have here a function for creating midi-cc fades. I hope it works also for
you.

# use it like below
phrase = ''
cc_number = 74
phrase +=
makeccfade(integer(cc_number),starttime,endtime,startvalue,endvalue,interval
,channel)


# cc-fades
function
makeccfade(cc_number,starttime,endtime,startvalue,endvalue,interval,channel)
{
fade=''
for(counter=starttime;counter<(endtime-interval);counter+=interval)
{
value = integer (
startvalue
+
(
(

(counter-starttime) * (endvalue-startvalue)
)
/

(endtime-starttime)
)
)
tnote=midibytes(0xb0 | (channel-1), integer(cc_number),
integer(value))
tnote.time=counter-starttime
fade+=tnote
}
tnote=midibytes(0xb0 | (channel-1), integer(cc_number),
integer(value))
tnote.time=counter-starttime
fade+=tnote
fade.length=endtime-starttime
return(fade)
}


Kind regards,
Tony

Reply all
Reply to author
Forward
0 new messages