I know this is an old thread but I'd love some advice on creating playlists in script.js. I downloaded Orchestral Demo and have tried tweaking the script but can't figure out how to get several tracks per event instead of just one. Can anyone help with syntax?another_commander wrote: ↑Sun Sep 24, 2017 1:22 pmI don't know about Hyperradio, but I can tell you that you you are wrong about Orchestral Demo. I have already built playlists in it for fight and cruising modes. Check its script.js, there is a place there reserved specifically for building such playlists. Granted that it requires file editing to work, but it is most certainly doable.
Music in flight ?
Moderators: winston, another_commander
-
- Mostly Harmless
- Posts: 3
- Joined: Sat Oct 06, 2018 1:27 pm
Re: Music in flight ?
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Re: Music in flight ?
Hi and welcome. Here is how you can change your playlists for Orchestral Demo by editing script.js inside the OXP's Config folder.
If you open the script file in a text editor, you will find this very close to the top:The possible events that the OXP responds to are titled aegis, alert, docked, exitWS, killed, launch, planetIn and rescued. Inside each event, you can find the arrays of music files to play for each event, surrounded by '[' and ']'. .To change the playlists, you simply add, remove or change the filenames inside those arrays. For more than one song to choose from for a particular event, you just add music files like in this example:
The number that follows dur: is the duration of the file to play in seconds. Make sure that your song files are inside the OXP's Music folder and you should be good to go.
If you open the script file in a text editor, you will find this very close to the top:
Code: Select all
this.startUpComplete = function(){
delete this.startUpComplete;
// Add event music
var a = this.name;
worldScripts.Lib_Music._addEventMusic({
aegis:{
enter:[{snd:"lib_orch_aegis_enter03.ogg",dur:98}]
},
alert:{
red:[{snd:"lib_orch_alert_red06.ogg",dur:106}]
},
docked:{
any:[{snd:"lib_orch_aegis_enter04.ogg",dur:109}]
},
exitWS:{
inter:[{snd:"lib_orch_exitws_inter01.ogg",dur:99}],
standard:[{snd:"lib_orch_exitws_standard06.ogg",dur:107}]
},
killed:{
any:[{snd:"lib_orch_killed_any01.ogg",dur:51}]
},
launch:{
any:[{snd:"lib_orch_launch_any01.ogg",dur:92}]
},
planetIn:{
enterMain:[{snd:"lib_orch_planet_enter_main01.ogg",dur:65}],
enterSun:[{snd:"lib_orch_planet_enter_sun02.ogg",dur:92}]
},
rescued:{
any:[{snd:"lib_orch_killed_any01.ogg",dur:51}]
}
},a);
Code: Select all
rescued:{
any:[{snd:"lib_orch_killed_any01.ogg",dur:51}, {snd:"mySong01.ogg",dur:100}, {snd:"mySong02.ogg",dur:125}]
}
Re: Music in flight ?
A third option for tracks is available - reduce volume. Range is [0...1].
So becomes
This way you can adjust the songs to your needs.
btw: The demo does not use the full range of possibilities. See Lib_Music for more.
So
Code: Select all
{snd:"mySong01.ogg",dur:100}
Code: Select all
{snd:"mySong01.ogg",dur:100, vol:0.7}
btw: The demo does not use the full range of possibilities. See Lib_Music for more.
-
- Mostly Harmless
- Posts: 3
- Joined: Sat Oct 06, 2018 1:27 pm
Re: Music in flight ?
Thanks so much. I nearly figured this out but didn't think to put commas between the entries, I just used new lines.another_commander wrote: ↑Sat Oct 06, 2018 1:54 pmHi and welcome. Here is how you can change your playlists for Orchestral Demo by editing script.js inside the OXP's Config folder.
If you open the script file in a text editor, you will find this very close to the top:The possible events that the OXP responds to are titled aegis, alert, docked, exitWS, killed, launch, planetIn and rescued. Inside each event, you can find the arrays of music files to play for each event, surrounded by '[' and ']'. .To change the playlists, you simply add, remove or change the filenames inside those arrays. For more than one song to choose from for a particular event, you just add music files like in this example:Code: Select all
this.startUpComplete = function(){ delete this.startUpComplete; // Add event music var a = this.name; worldScripts.Lib_Music._addEventMusic({ aegis:{ enter:[{snd:"lib_orch_aegis_enter03.ogg",dur:98}] }, alert:{ red:[{snd:"lib_orch_alert_red06.ogg",dur:106}] }, docked:{ any:[{snd:"lib_orch_aegis_enter04.ogg",dur:109}] }, exitWS:{ inter:[{snd:"lib_orch_exitws_inter01.ogg",dur:99}], standard:[{snd:"lib_orch_exitws_standard06.ogg",dur:107}] }, killed:{ any:[{snd:"lib_orch_killed_any01.ogg",dur:51}] }, launch:{ any:[{snd:"lib_orch_launch_any01.ogg",dur:92}] }, planetIn:{ enterMain:[{snd:"lib_orch_planet_enter_main01.ogg",dur:65}], enterSun:[{snd:"lib_orch_planet_enter_sun02.ogg",dur:92}] }, rescued:{ any:[{snd:"lib_orch_killed_any01.ogg",dur:51}] } },a);
The number that follows dur: is the duration of the file to play in seconds. Make sure that your song files are inside the OXP's Music folder and you should be good to go.Code: Select all
rescued:{ any:[{snd:"lib_orch_killed_any01.ogg",dur:51}, {snd:"mySong01.ogg",dur:100}, {snd:"mySong02.ogg",dur:125}] }
By the way the demo is already great but it's nice to know how to adapt it. I am a musician so might get around to writing some tracks one day.
-
- Mostly Harmless
- Posts: 3
- Joined: Sat Oct 06, 2018 1:27 pm
Re: Music in flight ?
Svengali wrote: ↑Sat Oct 06, 2018 2:35 pmA third option for tracks is available - reduce volume. Range is [0...1].
SobecomesCode: Select all
{snd:"mySong01.ogg",dur:100}
This way you can adjust the songs to your needs.Code: Select all
{snd:"mySong01.ogg",dur:100, vol:0.7}
btw: The demo does not use the full range of possibilities. See Lib_Music for more.
Thanks svengali, and thanks for creating this! I did read the wiki entry but I struggled to translate it into practice. I just find it much easier when I can see a full example and adapt.
Re: Music in flight ?
Musician, eh? Welcome to the club .-)dansmith127 wrote: ↑Sat Oct 06, 2018 5:03 pmI am a musician so might get around to writing some tracks one day.