Visualize the metronome?

Does someone see a way to visualize the metronome? Maybe we can do that with a timer callback? On the first beat a red widget LED, on 2, 3, 4 a green one?

That is possible, i will post a script

Here is a script, just create 4 LEDā€™s and give then the corresponding script name,
quick and dirty but it should work

//$<AutoDeclare>
// DO NOT EDIT THIS SECTION MANUALLY
Var
   RED : Widget
   GREEN2 : Widget
   GREEN3 : Widget
   GREEN4 : Widget
//$</AutoDeclare>




on BeatChanged(bar : integer, beat : integer, subbeat : integer)
 Print(beat % 4)
 if beat%4   == 0 then
    SetWidgetValue(RED, 1.0)
    SetWidgetValue(GREEN2, 0.0)
    SetWidgetValue(GREEN3, 0.0)
    SetWidgetValue(GREEN4, 0.0)
 elsif beat%4 == 1 then
    SetWidgetValue(RED, 0.0)
    SetWidgetValue(GREEN2, 1.0)
    SetWidgetValue(GREEN3, 0.0)
    SetWidgetValue(GREEN4, 0.0)
 elsif beat%4 == 2 then
    SetWidgetValue(RED, 0.0)
    SetWidgetValue(GREEN2, 0.0)
    SetWidgetValue(GREEN3, 1.0)
    SetWidgetValue(GREEN4, 0.0)
 elsif beat%4 == 3 then
    SetWidgetValue(RED, 0.0)
    SetWidgetValue(GREEN2, 0.0)
    SetWidgetValue(GREEN3, 0.0)
    SetWidgetValue(GREEN4, 1.0) 
 end   
  
end
3 Likes

A another possibility with just 2 LEDā€™s, 1 red and 1 green.
But you have to include another MIDI in Block (OSC Midi in is fine):

//$<AutoDeclare>
// DO NOT EDIT THIS SECTION MANUALLY
Var
   TRIGGER : MidiInBlock
   RED : Widget
   GREEN : Widget
//$</AutoDeclare>


m :MidiMessage
   
initialization
 m = MakeNoteMessage(C3, 100)
end 


on BeatChanged(bar : integer, beat : integer, subbeat : integer)
 
 if beat%4 == 0 then
    SetWidgetValue(RED, 1.0)
 else
    SetWidgetValue(RED, 0.0)
    SetWidgetValue(GREEN, 1.0)
 end 

 ScheduleMidiEvent(TRIGGER, m, 100.0)

 end
 
 on NoteEvent(m : NoteMessage) from TRIGGER
  SetWidgetValue(RED,0.0)
  SetWidgetValue(GREEN,0.0)
 end
1 Like

Wow! Thank you for your quick answer, and also for the excellent idea to use an OSC MidiInBlock to trigger something. I can use this more often in my script.
:+1: :wave:

Thanks for getting me started on replicating this @pianopaul. I was figuring out how to display the bar and beat number in a widget labelā€¦and why not include LEDs as well!

GP_Bar_Beat_Counter_Widgets

// Script to display bar and beat numbers in a widget label and LEDs
Var 
    bar,beat : Integer
    position_label,led1,led2,led3,led4 : Widget
    bar_s,beat_s,label : String
    
On BeatChanged(barNumber : Integer, BeatNumber : Integer, tick : Integer) // Called every time the beatNumber increments
// Note that barNumber and tick are not currently implemented

    // Calculate bar and beat number
    bar := Floor(BeatNumber / 4) + 1
    beat := BeatNumber % 4 + 1
    
    // Update widget label
    bar_s := bar
    beat_s := beat
    label := bar_s + "." + beat_s
    SetWidgetLabel (position_label, label)
    
    // Update LEDS
    If beat == 1 Then SetWidgetValue(led1,1) Else SetWidgetValue(led1,0) End
    If beat == 2 Then SetWidgetValue(led2,1) Else SetWidgetValue(led2,0) End
    If beat == 3 Then SetWidgetValue(led3,1) Else SetWidgetValue(led3,0) End
    If beat == 4 Then SetWidgetValue(led4,1) Else SetWidgetValue(led4,0) End
End
3 Likes

how do i get this to work in a blank rackspace ?
I get these errors
The widget ā€˜position_labelā€™ is declared in a script but does not exist in the rackspace called ā€˜Rackspaceā€™
The widget ā€˜led1ā€™ is declared in a script but does not exist in the rackspace called ā€˜Rackspaceā€™
The widget ā€˜led2ā€™ is declared in a script but does not exist in the rackspace called ā€˜Rackspaceā€™
The widget ā€˜led3ā€™ is declared in a script but does not exist in the rackspace called ā€˜Rackspaceā€™
The widget ā€˜led4ā€™ is declared in a script but does not exist in the rackspace called ā€˜Rackspaceā€™

a gigfile would be handy for us non programmers
cheers

Use this
beat.gig (8.6 KB)

thanlks pp

I see you have to create the widgets and give them the correct name first
I,m learning slowly
cheers

how would you be able to fit the ā€œandā€ beats into the sequence ?
cheers

is there a way to define the bpm so you can have a different bpm in different rackspaces/songs ?

cheers


https://gigperformer.com/docs/Userguide36/rackspaceproperties.html

sorted thanks, missed that one