analogmad / reaper

Analogmad's Reaper Effects and Scripts
MIT License
11 stars 0 forks source link

BUG: Playdium output invalid MIDI velocity #1

Closed X-Raym closed 9 months ago

X-Raym commented 1 year ago

Hi,

It seems playdium JS can sometimes output velocities beyond 127

These doesnt trigger sounds in R5k.

Thx!

analogmad commented 1 year ago

Thanks for the report. Will take a look this weekend and figure out what is causing it to go over the max velocity of 127 in some cases.

Also thanks for checking out my script/js Raymond! You are a legend. :)

On Thu, May 25, 2023 at 9:33 AM Raymond Radet @.***> wrote:

Hi,

It seems playdium JS can sometimes output velocities beyond 127

These doesnt trigger sounds in R5k.

Thx!

— Reply to this email directly, view it on GitHub https://github.com/analogmad/reaper/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOMDNGNAHGTEHXWQ2ULS2SLXH6CXJANCNFSM6AAAAAAYPC4NPU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

X-Raym commented 1 year ago

haha, many thanks 🙏🥰

When you will update, you will be able to keep only one @changelog declaration on top of the JSFX (they are 3 currently).

Good luck with the bug fix! 🖖

analogmad commented 9 months ago

Finally had some time after many many months to look at the Velocity Range. I put in a check to ensure that the velocity range always stays between the vel_low and vel_high ranges. So it can never go out of range. Just committed a version 1.4 update. Cleaned up the older 3 declarations. After hours of testing. It no longer goes out of Velocity range.

analogmad commented 9 months ago

Updated JSFX to version 1.4 with a fix

`// Generate a random velocity without repeating the recent history function random_velocity() ( sample_range = (127 - 0 + 1) / num_samples;

new_velocity = vel_low + floor(rand(num_samples) sample_range) + floor(rand(sample_range)); while (new_velocity > vel_high) ( new_velocity = vel_low + floor(rand(num_samples) sample_range) + floor(rand(sample_range)); ); new_velocity; );`