PAL Script - Hourly Time Signal (The Pips)

This script was written to play the hourly time signal (the pips) at the top of the hour.  To utilize this script simply download the time signal track at the bottom of this document, add it to SAM Broadcaster in its own 'TimeSignal' playlist or category and run the script.  The PAL Script is also available to download from the bottom of this page.

For instructional purposes, this script includes comments describing the various sections.


// PAL Script to play the BBC Time Signal (pips) at 5 seconds to the hour through AUX1

PAL.loop := true;                   // Loop the script to ensure the time signal is played at every hour

var Player1 : TPlayer = DeckA;      // Declare an instance of TPlayer and assign it DeckA
var Player2 : TPlayer = Aux1;       // Declare an instance of TPlayer and assign it Aux1
var ActiveVol, AuxVol : integer;    // Declare containers for the current volume levels
var TimeSignal : TSongInfo;         // Create a container for the time signal track

if DeckA.Status <> psPlaying then
  Player1 := DeckB;

TimeSignal := Cat['TimeSignal'].ChooseSong(smLRP, noRules);   // Assign the time signal to the TimeSignal container

ActiveVol := ActivePlayer.Volume;   // Record the current Active Player Volume
AuxVol := Player2.GetVolume;        // Record the current Active Player Volume

PAL.WaitForTime('XX:59:55');        // wait for 5 seconds before the hour

PAL.LockExecution;                  // Speed up the Script processing

if TimeSignal <> nil then begin     // Check to ensure the time signal track is ready

  Player1.Volume := 30;             // Lower the volume of the Active Player
  Player2.Volume := 300;            // Raise the volume of the Aux Player (with extra gain);

  PAL.WaitForTime('+00:00:05');     // Wait for 5 seconds to pass before restoring volume levels

  Player1.Volume := ActiveVol;      // Restore the Active Player Volume to the previous level
  Player2.Volume := AuxVol;         // Restore the Idle Player Volume to the previous level

PAL.UnlockExecution;                // Return PAL Script processing to normal speed
TimeSignal.Free;                    // Release the memory
Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request