1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Multiple Waveforms

Discussion in 'KONTAKT: Sampling, Programming & Scripting' started by jfino, Jul 11, 2018.

Tags:
  1. jfino

    jfino Senior Member

    89
    50
    Jan 10, 2017
    Hi Everyone,

    I want to have couple of waveforms on display and each with its own independent play cursor.
    Each sample is mapped on a different key.

    I tried the code below but something is not right..
    Any advice would be very helpful.

    Thanks so much!!

    Code:
    on init
        set_ui_height_px(350)
    
        declare $play_pos
        declare ui_waveform $Waveform(6,6)
        attach_zone ($Waveform,find_zone ("Sample1"),0)
       
        declare $play_pos2
        declare ui_waveform $Waveform2(6,6)
        attach_zone ($Waveform2,find_zone ("Sample2"),0)
    
    
    end on
    
    on note
    
        while ($NOTE_HELD = 1)
            $play_pos := get_event_par($EVENT_ID,$EVENT_PAR_PLAY_POS)
            set_ui_wf_property($Waveform,$UI_WF_PROP_PLAY_CURSOR,0,$play_pos)
    
           $play_pos2 := get_event_par($EVENT_ID,$EVENT_PAR_PLAY_POS)
            set_ui_wf_property($Waveform2,$UI_WF_PROP_PLAY_CURSOR,0,$play_pos2)
            wait (10000)
        end while
    end on
     
    Last edited: Jul 11, 2018
  2. P.N.

    P.N. Senior Member

    276
    105
    Aug 14, 2015
    Hi.

    I made something like this a while ago with up to 25 simultaneous waveforms, but i took a different aproach.

    I redefined the event id and used the LCB, not a wait command. I also didn't use the $NOTE_HELD command, but a variable that activates the waveform in the LCB (and i do believe i didn't use one in the RCB, for some reasons i don't remember).

    So, you could do something similar for your case. Have 2 variables that activate the waveform in the LCB, and you may use those 2 same variables in the RCB to stop/reset the waveforms.
     
    jfino likes this.
  3. EvilDragon

    EvilDragon KSP Wizard

    4,657
    2,524
    May 25, 2010
    Croatia
    Yes for this sort of stuff you'd need to use LCB.
     
    jfino likes this.
  4. OP
    OP
    jfino

    jfino Senior Member

    89
    50
    Jan 10, 2017
    Thanks guys! I will try out your suggestions later on today.
    I've never used the Listener CB but I saw an example in the manual.
     
  5. P.N.

    P.N. Senior Member

    276
    105
    Aug 14, 2015
    Here's another cool thing you could try out, if you're feeling adventurous.

    Instead of having the 2 waveforms idle, you could have them on top of each other, and only the relevant one appears when activated. If the 2 notes that activate the waveform are pressed at the same time, you could have a script that resizes them both on the fly (and moves one of them), so that you have a dynamic interface.
    You'll see them both, but with a smaller size.

    I did something like this before, and it's actually pretty cool to look at, while keeping a cleaner GUI.

    It's just an idea. It all depends on your goals and the rest of your interface. :)
     
    jfino likes this.
  6. OP
    OP
    jfino

    jfino Senior Member

    89
    50
    Jan 10, 2017
    Cool idea P.N!
     

Share This Page