// oscKaraoke.ltgs // Arguments: none // // // Author: LoopToGo // // Description : Example script on how to set up an OSC Karaoke client. // // Important: An OSC client must be set up (e.g., TouchOSC, Open Stage Control, OSC/Pilot, etc.) for this script to be useful. // You can use karaoke.tosc with TouchOSC as a simple example. // // Usage: In LoopToGo/Preferences/OSC, create an OSC connection between LoopToGo and the OSC client. // Name this connection KaraokeOtherPC or adjust the first line (variable oscClient KaraokeOtherPC) accordingly. // Start this script. Tip: Create a button to start this script easily or set it to start automatically when launching LoopToGo. // Note: You can restart the script; the old instance will be terminated. // Note 2: The OSC client must be set to use fixed-width fonts for proper display. // // In your OSC client, configure the following addresses to display text: // /songTitle : The song title. // /section1 : Current section where the playhead is. Must use fixed-width fonts. // /chords1 : Chords line (if any) for the current playhead section. Must use fixed-width fonts. // /lyrics1 : Lyrics line (if any) for the current playhead section. Must use fixed-width fonts. // /barPosition : A line showing the playhead's position. Must use fixed-width fonts. // /section2 : Next section where the playhead will move. Must use fixed-width fonts. // /chords2 : Next chords line (if any) where the playhead will move. Must use fixed-width fonts. // /lyrics2 : Next lyrics line (if any) where the playhead will move. Must use fixed-width fonts. // /section3 : Section after the next where the playhead will move. Must use fixed-width fonts. // /chords3 : Chords line after the next (if any) where the playhead will move. Must use fixed-width fonts. // /lyrics3 : Lyrics line after the next (if any) where the playhead will move. Must use fixed-width fonts. // Make sure you have created an OSC connexion in LoopToGo corresponding to the following variable value (or change the value accordingly) variable oscClient KaraokeOtherPC // Kill last script instance if any killScript $g_lastScriptKaraokeInstanceID globalVariable g_lastScriptKaraokeInstanceID $scriptID callFunction sendTitleAndAuthorInfo while 1 ifNot $songName = $lastSongName callFunction sendTitleAndAuthorInfo variable lastSongName $songNam endIf globalVariable g_lastSection " " callFunction sendChordsAndLineInfo 1 waitDelta .02 callFunction sendChordsAndLineInfo 2 waitDelta .02 callFunction sendChordsAndLineInfo 3 waitDelta .02 waitDelta .02 endWhile function sendTitleAndAuthorInfo if $songName sendOscMessage $oscClient "/songTitle" $songName else sendOscMessage $oscClient "/songTitle" " " endIf endFunction function sendChordsAndLineInfo // [in] level variable level $arg1 getKaraokeInfo section chordsLine lyricsLine barPosition $songBar $level - 1 // Current chords line //print $chordsLine //print $lyricsLine //print $level $section $songBar ifNot $chordsLine variable chordsLine " " endIf ifNot $lyricsLine variable lyricsLine " " endIf ifNot $section variable section " " endIf sendOscMessage $oscClient "/chords" & $level $chordsLine sendOscMessage $oscClient "/lyrics" & $level $lyricsLine if $section = $g_lastSection sendOscMessage $oscClient "/section" & $level " " else sendOscMessage $oscClient "/section" & $level $section endIf if $level = 1 variable square "^" for i 1 $barPosition variable square " " & $square endFor sendOscMessage $oscClient "/barPosition" $square endIf globalVariable g_lastSection $section endFunction