please help me

Discussion in 'Education' started by berrahem, Jun 14, 2024.

  1. berrahem

    berrahem Newbie

    Joined:
    Jun 5, 2023
    Messages:
    1
    Likes Received:
    0
    Is it possible to manipulate the individual voice collectively for each voice separately? I have this script with some errors, can you please help me find a solution for these errors?

    Code:
    on init
        declare ui_knob $TUNE (-36, 36, 1)
        declare ui_knob $REVERB (0, 1200, 100)
        declare ui_knob $VOLUME (0, 100, 1)
        declare ui_knob $PAN (-100, 100, 1)
    
        declare const $TUNE_DEFAULT := 0
        declare const $REVERB_DEFAULT := 600
        declare const $VOLUME_DEFAULT := 50
        declare const $PAN_DEFAULT := 0
    
        $TUNE := $TUNE_DEFAULT
        $REVERB := $REVERB_DEFAULT
        $VOLUME := $VOLUME_DEFAULT
        $PAN := $PAN_DEFAULT
    
        make_persistent($TUNE)
        make_persistent($REVERB)
        make_persistent($VOLUME)
        make_persistent($PAN)
    
        set_ui_height_px(100)
    
        message("Initialized")
    end on
    
    on ui_control($TUNE)
        declare $i := 0
        while ($i < 100)
            set_engine_par($ENGINE_PAR_TUNE, $TUNE * 1000, $i, -1, -1)
            $i := $i + 1
        end while
    end on
    
    on ui_control($REVERB)
        declare $i := 0
        while ($i < 100)
            set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, $REVERB * 100, $i, 1, -1)
            $i := $i + 1
        end while
    end on
    
    on ui_control($VOLUME)
        declare $i := 0
        while ($i < 100)
            set_engine_par($ENGINE_PAR_VOLUME, $VOLUME * 14400 - 1440000, $i, -1, -1)
            $i := $i + 1
        end while
    end on
    
    on ui_control($PAN)
        declare $i := 0
        while ($i < 100)
            set_engine_par($ENGINE_PAR_PAN, $PAN * 10000, $i, -1, -1)
            $i := $i + 1
        end while
    end on
     
  2.  
  3. saccamano

    saccamano Rock Star

    Joined:
    Mar 26, 2023
    Messages:
    1,195
    Likes Received:
    481
    Location:
    CBGB omfug
    A little backstory would help.
     
  4. Melodic Reality

    Melodic Reality Rock Star

    Joined:
    Feb 18, 2023
    Messages:
    630
    Likes Received:
    407
    I noticed a potential issue in your script: you're iterating over 100 steps to set the parameters for each voice. However, if you're dealing with a variable number of voices, this might not be the best approach. Additionally, the way you're calculating the parameter values might not be correct.
     
  5. Zenarcist

    Zenarcist Audiosexual

    Joined:
    Jan 1, 2012
    Messages:
    4,251
    Likes Received:
    2,728
    Location:
    Planet Earth
    I'm here for the Beatles song.
     
  6. stopped

    stopped Platinum Record

    Joined:
    Mar 22, 2016
    Messages:
    528
    Likes Received:
    190
  7. saccamano

    saccamano Rock Star

    Joined:
    Mar 26, 2023
    Messages:
    1,195
    Likes Received:
    481
    Location:
    CBGB omfug
  8. Lois Lane

    Lois Lane Audiosexual

    Joined:
    Jan 16, 2019
    Messages:
    4,761
    Likes Received:
    4,682
    Location:
    Somewhere Over The Rainbow
    At the end of Strawberry Fields Forever, John Lennon utters"I buried BobDule". Anyway, that's what I hear.
     
    Last edited: Jun 14, 2024
    • Funny Funny x 1
    • Creative Creative x 1
    • List
  9. Kelsier

    Kelsier Kapellmeister

    Joined:
    Feb 9, 2024
    Messages:
    98
    Likes Received:
    54
    Agreed, doing the same calculation in a loop is costly, those calculations have to be performed every iteration of the loop. A better approach is to perform the calculation once, outside of the loop
     
Loading...
Loading...