We are in the process of migrating the Spacial Wiki content to our new Help Center at spacial.com.
Please visit the Help Center for latest Tips and Tricks, Documentation and Troubleshooting.
spacial.com/help-center

Write Some PAL

From SpacialAudio

Jump to: navigation, search

Link To Other PAL Articles

Table of Contents   Quick Start Guide   PAL Scripting 101   Objects   Script Examples    Music1 24 Hour PAL Script    Music 1 Hourly PAL   CBS News Scripts    Write some useful scripts


Here we will go though writing a few useful PAL scripts for your station.


Play Ids Every Quarter Hour

WithOut FadeToNext

Ok ,you want to play your station Ids at the Top Of the Hour(TOH), 15 minutes after, Bottom Of the Hour (BOH) and 15 minutes before TOH

Do you want the current song to finish playing or do you want the Station Id to play immediately?

Let us say you just want to make sure one is there to play at the Quarter Hour and let the current song finish before the id is played.

What else do we need to know?
Are all you Station Ids in the Content>Station ID Category folder in SAM?
If not where are they located?
How do you want to select the Station Ids that will be played? ( what selection Method)
This first script we will assume the Station Ids you want to use are in the built in Station Id Category Folder and we will use the least recently played Selection Method.
Do you want to EnforceRules? For this example we will use NoRules
Unless you have a few hundred Ids EnforceRules will not work well.

Simply stated
At the TOH load a Station Id from the Category Folder to the Top of the Queue, at 15 minutes after load another on at the Top of the Queue, at BOH load a station id and then at 45 minutes after load a station Id. then wait for the TOH and start over.

1. Every 1/4 hour Starting at TOH Load Station Ids from Station IDs (All) into the Top of Queue
2. Do not fade to next, wait for current song to complete.
3. Loop Back through to start again at the TOH xx:00:00

The Script:

PAL.Loop := True;
Pal.WaitforTime ('XX:00:00'); {## Wait for next hour} 
Cat['Station IDs (All)'].QueueTop(smLRP, NoRules); //load ID to the Top of The Queue

Pal.WaitforTime ('XX:15:00'); {## Wait for 15 minutes after the hour} 
Cat['Station IDs (All)'].QueueTop(smLRP, NoRules); //load ID to the Top of The Queue

Pal.WaitforTime ('XX:30:00'); {## Wait for BOH}
Cat['Station IDs (All)'].QueueTop(smLRP, NoRules); //load ID to the Top of The Queue

Pal.WaitforTime ('XX:45:00'); {## Wait for 45 minutes after the hour}
Cat['Station IDs (All)'].QueueTop(smLRP, NoRules); //load ID to the Top of The Queue
 //the script will now loop back to the top.

note:
There is more than 1 way to designate the hour parts. The above example is just a straight forward time after the Hour.

Different ways

WriteTime(T['xx:45:00']);  //Next 3/4 of an hour
WriteTime(T['NextHour']);  //Next hour
WriteTime(T['Next15']);    //Next Quarter
{Other:
 NextHour = Next60
 NextHalfHour = Next30
 NextQuarter = Next15
}

Top


Play Ids Every Quarter Hour

With FadeToNext

Play your station Ids at the Top Of the Hour(TOH), 15 minutes after, Bottom Of the Hour (BOH) and 15 minutes before TOH

Do you want the current song to finish playing or do you want the Station Id to play immediately?

Let us say you want to make sure one is there to play at the Quarter Hour and play it immediately.

What else do we need to know?
Are all you Station Ids in the Content>Station ID Category folder in SAM?
If not where are they located?
How do you want to select the Station Ids that will be played? ( what selection Method)

Do you want to EnforceRules? For this example we will use NoRules
Unless you have a few hundred Ids EnforceRules ill not work well.

This script will assume the Station Ids you want to use are in a Windows Directory Folder ( C:\Documents and Settings\Owner.Lappy\My Documents\My Music\ids) and we will use the Lemming Rules Selection Method and play immediately.
note: Lemming Rules (smLemmingRules) Lemming rules randomly selects a selection method, and then uses that selection method to select a song. This gives a very nice random selection.
Lemming Rules does not use the smMRP and smLRP selection methods since they tend to repeat songs too often.

Simply stated
At the TOH load a Station Id from the Category Folder to the Top of the Queue, at 15 minutes after load another on at the Top of the Queue, at BOH load a station id and then at 45 minutes after load a station Id. then wait for the TOH and start over.

1. Every 1/4 hour Starting at TOH Load Station Ids from C:\Documents and Settings\Owner.Lappy\My Documents\My Music\ids into the Top of Queue
2. Do FadeToNext.
3. Loop Back through to start again at the TOH xx:00:00

The Script:

PAL.Loop := True;
Pal.WaitforTime ('XX:00:00'); {## Wait for next hour} 
Dir['C:\Documents and Settings\Owner.Lappy\My Documents\My Music\ids'].QueueTop(smLemmingLogic, NoRulesRules);//load ID to the Top of The Queue
ActivePlayer.FadeToNext;

Pal.WaitforTime ('XX:15:00'); {## Wait for 15 minutes after the hour} 
Dir['C:\Documents and Settings\Owner.Lappy\My Documents\My Music\ids'].QueueTop(smLemmingLogic, NoRulesRules); //load ID to the Top of The Queue
ActivePlayer.FadeToNext;

Pal.WaitforTime ('XX:30:00'); {## Wait for BOH}
Dir['C:\Documents and Settings\Owner.Lappy\My Documents\My Music\ids'].QueueTop(smLemmingLogic, NoRulesRules); //load ID to the Top of The Queue

Pal.WaitforTime ('XX:45:00'); {## Wait for 45 minutes after the hour}
Dir['C:\Documents and Settings\Owner.Lappy\My Documents\My Music\ids'].QueueTop(smLemmingLogic, NoRulesRules); //load ID to the Top of The Queue
ActivePlayer.FadeToNext;
 //the script will now loop back to the top.

note:
There is more than 1 way to designate the hour parts. The above example is just a straight forward time after the Hour.


Again there are different ways. Refer to the Different Ways in the Playing Ids With No FadeToNext.

Top


Scenario:

  • 1. 1 Streaming Encoder
  • 2. 1 Encoder for Archiving
  • 3. Scheduled Start and Stop time(s) for the Show to be Archived


For the sack of agument:
Two encoders . First one is for streaming the second one is Archive and no server.
A show is done every Mon thru Friday at 10:30am and ends at 11:30am.
You want to save the archive.
So we shall wait till just before the start time we start the encoder and just after the stop time we stop the encoder.


var I : Integer;

for I := 0 to Encoders.Count-1 do
 if not Encoders[I].Started then
  Encoders[I].Start;


Link To Other PAL Articles

Personal tools