ludennis / SPPP

Self-playing piano parser
MIT License
0 stars 1 forks source link

variable normal_note_dur #17

Open likevvii opened 6 years ago

likevvii commented 6 years ago

Function: Make normal_power_dur variable. The higher "normal_power" is, the smaller normal_power_dur will be. There will be a set minimum so that no modifications will be done to low powered notes.

Reason: Changing normal_power_dur directly affects the final volume of the piano key. Higher normal_power_dur = louder note, and reversed for the opposite. I set a minimum to preserve the reliablity of the "quietest possible note"

Desmos graph: https://www.desmos.com/calculator/ldnoy72wqx You can slide the sliders around to see how it is affected.

DESIRED_GAP_DUR
TARGET_MAX
TARGET_MIN
*BASE_NORMAL_POWER_DUR #used to be NORMAL_POWER_DUR. Added base to avoid confusion because "normal_power_dur" is a variable now.
*RATIO_CUT_NORMAL_POWER_DUR = .4 #larger this is, the smaller normal_power_dur will be.
*PERCENT_LOW_POWER_IGNORE = .20 #the percentage if low power to be not affected.

*TARGET_RANGE = TARGET_MAX - TARGET_MIN
*LOW_POWER_IGNORE = TARGET_RANGE * PERCENT_LOW_POWER_IGNORE

if note_dur > DESIRED_GAP_DUR #only if the duration of the note is long enough
    if note_power > TARGET_MIN + LOW_POWER_IGNORE #this is to set the minimum before normal_power_dur can be affected. In desmos, it functions like "o"
        new_normal_note_dur = n - ((((power - LOW_POWER_IGNORE)- TARGET_MIN)/(TARGET_RANGE + 1)) * BASE_NORMAL_POWER_DUR * RATIO_CUT_NORMAL_POWER_DUR)
ludennis commented 6 years ago

I will aim to finish this by 2/9/18, Friday.

ludennis commented 6 years ago

n = BASE_NORMAL_POWER_DUR