What's new

How to fade in a sample using mod wheel (complicated)

merlinhimself

Senior Member
I didnt want to make some crazy long title so.
basically, how would I create a script that allowed a slider to control when the sample would fade in via mod wheel.
for example:
I set the slider to 50%, then when the mod wheel CC hits 63, the group volume starts fading in from -inf to 0db
I get the general concept but the math has lost me completely.
 
Maybe a long shot, but @pendle at SoundDust has a library (Loop Pool Boom & Bust) that does this beautifully. Maybe he’d be willing to chime in or maybe it’s proprietary haha....maybe worth a PM to him....
 
Maybe a long shot, but @pendle at SoundDust has a library (Loop Pool Boom & Bust) that does this beautifully. Maybe he’d be willing to chime in or maybe it’s proprietary haha....maybe worth a PM to him....
I think I ended up figuring it out, it was much much simpler than I thought, I got flustered and wasn't going about it right, thinking it was more complex ha.
 
You can simply rescale the CC after a certain point.

Code:
{
    *PRE:
    (int) value - input variable for rescaling
    (int) in_min, in_max - range boundaries for input
    (int) out_min, out_max - range boundaries for output

    (int) return - rescaled value
}
function scale(value, in_min, in_max, out_min, out_max) -> return
    return := (((value - in_min) * (out_max - out_min)) / (in_max - in_min)) + out_min
end function

on controller
    if (CC_NUM = 1)
        ignore_controller
        if CC[CC_NUM] < RangeSlider    { let's say this RangeSlider goes from 0 to 96, but can be 0-127 but those highest values might not make too much sense }
            temp_value := 0
        else
            temp_value := scale(CC[CC_NUM], RangeSlider, 127, 0, 127)
        end if

        set_controller(CC_NUM, temp_value)
    end if
end on
 
Top Bottom