1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Waveform Script problem

Discussion in 'Scripting Workshop' started by Mauduit, Sep 25, 2021.

  1. Mauduit

    Mauduit NI Product Owner

    Messages:
    31
    Hello,
    a have a script to watch the waveform of the sounds played on the performance view.
    It works for the first notes from C-2 but after 2 octaves, no more waveforms displayed when a note i played.
    I don't understand why i doesn't work
    Here is the script, below:
    Code:
    {example with waveform and cursor at playback}
    
    on init
      make_perfview {enable performance view}
      set_ui_height_px(100) {set performance view height}
      declare $noteid
      declare $selZone {selected zone}
      declare $playpos {playback position var}
      declare $selZoneRAW
     
      declare ui_waveform $my_waveform(2,3) {create waveorm view}
     
    end on
    
    on note
      $selZoneRAW := get_event_par($EVENT_ID,$EVENT_PAR_NOTE)
     
      {selected zone / set C2 as zone 0}
      $selZone := $selZoneRAW - 48
      message ($selZone)
     
      {display waveform for selected zone}
      attach_zone ($my_waveform,$selZone,0)
     
      {display playback cursor}
      while ($NOTE_HELD = 1)
        $playpos := get_event_par ($EVENT_ID,$EVENT_PAR_PLAY_POS)
        set_ui_wf_property ($my_waveform,$UI_WF_PROP_PLAY_CURSOR,0,$playpos)
        {message (get_ui_wf_property($my_waveform,$UI_WF_PROP_PLAY_CURSOR,0))}
        message("id zone number:" & $selZoneRAW & " || selected Zone:" & $selZone &...
         " || event id:" & $EVENT_ID & " || note id:" & $EVENT_NOTE)
        wait (10000)
      end while
    end on
    
     
  2. corbo-billy

    corbo-billy NI Product Owner

    Messages:
    652
    Well that's normal; your script is written to only show the C2 note.

    To see appear on all notes, add on init callback:
    $selZone := find_zone("your zone name")
     
    Last edited: Sep 25, 2021
  3. Mauduit

    Mauduit NI Product Owner

    Messages:
    31
    Thanks Corbo-billy .
    I wiil check that tomorrow.