Script to send BPM value to midi out

Discussion in 'PangoScript, Universe and Midi Templates' started by Visionrx7, Dec 12, 2012.

  1. Visionrx7

    Visionrx7 New Member

    Is there a script to send a midi out message to make a LED on a midi controller flash with the BPM? I've been trying to figure it out today with no luck.

    Thanks for your help!
     
  2. dennisthemenace

    dennisthemenace Well-Known Member

    Hi Visionrx7 :)

    Not sure what midi controller you have, but this script i made here will flash the upper led on the apc to the beat set manually, you can also adjust it to go with the audio input if you prefer that.

    First script turns the light on to the first beat and off to the second beat.


    Code:
    StopOnBlackout 1     //This breaks the script loop on blackout
    CodeName "FlashLedOnBpm" //this is your codename
    
    Start_script:  //Here is where the scripts start
    midiout 0x90, 0x35, 0x01 //This turns the upper left led on (Apc40)
    WaitForTimerBeat 1 //This makes the script wait for a beat on the tempo set on main toolbar
    midiout 0x90, 0x35, 0x00 //This turns that led off
    WaitForTimerBeat 1 //This waits for another beat
    Goto Start_script  //this jumps up to where the script starts again
    Second script, turns it on to the beat, and straight off, and on to the second beat again.

    Code:
    StopOnBlackout 1     //This breaks the script loop on blackout
    CodeName "FlashLedOnBpm" //this is your codename
    Start_script:  //Here is where the scripts start
    midiout 0x90, 0x35, 0x01 //This turns the upper left led on (Apc40)
    midiout 0x90, 0x35, 0x00 //This turns the upper left led off (Apc40)
    WaitForTimerBeat 1 //This waits for another beat
    Goto Start_script  //this jumps up to where the script starts again

    Hope it helps :)
     
    Last edited: Dec 12, 2012
  3. Bob@Pangolin

    [email protected] Staff Member

    Yes.. sure its possible:

    Create a small background script in the controller section.

    Use this script :

    Code:
    Codename "BPMonMaster"
    waitforbeat 1,0;
    MidiOut 0x90, 0x50, 0x7F;
    Sleep 10
    MidiOut 0x90, 0x50, 0x00;
    waitforbeat 1,0;
    MidiOut 0x90, 0x50, 0x7F;
    Sleep 10
    MidiOut 0x90, 0x50, 0x00;
    restart
    And add tis code to your initialization script, on the last free rule:

    Code:
    Startcode "BPMonMaster"

    But it depends on the controller, in this example the Master button on the APC40 blinks.

    But every controller has other addresses for colors.
     
    Last edited by a moderator: Dec 12, 2012
  4. Bob@Pangolin

    [email protected] Staff Member

    Hi Dennis,

    WaitForTimerBeat I would not use in this example, not everything is on a timer, if you tap BPM by hand it will not work in all cases.
     
    Last edited by a moderator: Dec 12, 2012
  5. dennisthemenace

    dennisthemenace Well-Known Member

    it sure works when tapping the beat :) Try :D
     
  6. Bob@Pangolin

    [email protected] Staff Member

    Not if Virtual LightJay takes over and I can think of some other fx that wont display the beat correctly..

    Btw, your script shows only every other beat :cool: :)
     
    Last edited by a moderator: Dec 12, 2012
  7. Visionrx7

    Visionrx7 New Member

    I'm using two Novation Launchpads... I'll just change the midi address to work for my controller. Thank you for the quick replies!!!
     
  8. Bob@Pangolin

    [email protected] Staff Member

    We love it if you would share this novation template on this forum.
    Ill bet more people have LaunchPads!!

    Create your own thread Template: Launchpad :)
     
  9. Visionrx7

    Visionrx7 New Member

    Sure.. I'm going to make sure it's working correctly before uploading the templates. I'm using one Launchpad for cues and the other for quick fx. The only issue I'm having is with the Pangolin script reading two button presses.. one when the button is pressed and the other when it's released. Is there a way to map around this?... example, if I map the midi note 90 01 xx... on the Launchpad, 90 01 7F is button press and 90 01 00 is button release, so it ends up activating the script twice.
     
  10. Bob@Pangolin

    [email protected] Staff Member


    Did you enter the scripts on both tabs?

    If you enter the script on the tab "note on" only,
    leave the script field of the "note off" tab empty,
    it will execute the script only once when you press the button.
     

Share This Page