nurv Posted August 23, 2014 Share Posted August 23, 2014 We use a clockwheel to load news in mp3 from an external service (streaming mp3). We use the LinerOverlay script already, for liners in the beginning of songs. Is it possible to adapt that script, or use another, to automate the following? When the files nyheter.mp3 starts playing, start a music bed in AUX 2 (AUX1 is already taken with the LinerOverlay) When the files nyheter.mp3 is finished (after 2 minutes), fade out the music bed in AUX 2. Would greatly appreciate any help on this! This is the LinerOverlay script we use. { About: This script will play a liner in Aux1 as soon as a new track starts The liner will only be played if a) The song has an intro of specified minimem duration b) The song is of type S, i.e. a normal song. Then the script will wait the specified amount of time before it tries to play another liner. This script can help brand your station and make it sound like a true commercial terrestrial station. any source connected Usage: a) Make sure you use the song information editor to specify intro times for your tracks! b) Make sure the AGC settings on Aux1 is to your liking. Also set the volume a bit louder on Aux1 so you cna clearly hear the liner above the active Deck audio. c) Edit the configuration details below. Make sure to change the category to the one you use to store your liners. } { CONFIGURATION } {==================================================} const MIN_INTRO = 5*1000; //5 seconds const MIN_WAIT = '+00:00:30'; //Wait 15 minutes between liners const LINERS_CATEGORY = 'Liners'; { IMPLEMENTATION } {--------------------------------------------------} function ExtractIntro(Song : TSongInfo):Integer; forward; var Song, Liner : TSongInfo; var Waiting : Boolean = True; var Intro : Integer = 0; Aux1.Eject; {Step1: Queue up the deck, ready for play} Liner := CAT[LINERS_CATEGORY].ChooseSong(smRandom,NoRules); if (Liner=nil) then WriteLn('No valid liner found') else if (not Aux1.QueueSong(Liner)) then WriteLn('Failed to queue song: '+Liner['filename']); {Wait for a valid song with intro} while Waiting do begin {Step2: Wait for the song to change} PAL.WaitForPlayCount(1); {Step3: Grab current song information} Song := ActivePlayer.GetSongInfo; if (Song=nil) then WriteLn('The active player contained no song info??') else begin {Extract the intro time - this is a bit tricky} Intro := ExtractIntro(Song); {Start playing the liner if the current song matches our rules} if(Song['songtype']='S') and (Intro>=MIN_INTRO) then begin Aux1.Play; Waiting := False; end; Song.Free; Song := nil; end; end; {Wait 5 minutes before we do this all again} PAL.WaitForTime(MIN_WAIT); PAL.Loop := True; {................................................} function ExtractIntro(Song : TSongInfo):Integer; var P : Integer; XFade : String; begin Result := -1; XFade := Trim(Song['xfade']); WriteLn('Decoding XFade string'); WriteLn('XFade: '+XFade); if XFade = '' then Result := -1 else begin P := Pos('&i=',XFade); if (P > 0) then begin Delete(XFade,1,P+2); P := Pos('&',XFade); if (P>0) then Delete(XFade,P,Length(XFade)); Result := StrToIntDef(XFade,-1); WriteLn('Intro time detected: '+XFade); end; end; end; {--------------------------------------------------} Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.