Music in flight ?

General discussion for players of Oolite.

Moderators: winston, another_commander

dansmith127
Mostly Harmless
Mostly Harmless
Posts: 3
Joined: Sat Oct 06, 2018 1:27 pm

Re: Music in flight ?

Post by dansmith127 »

another_commander wrote: Sun Sep 24, 2017 1:22 pm
Astrobe wrote: Sun Sep 24, 2017 12:21 pm
Hmmm... Both Hyperradio and the Orchestral Demo (that's just a demo though) don't make it easy to build your own playlist.
I 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.
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
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Re: Music in flight ?

Post by another_commander »

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:

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 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

rescued:{
	any:[{snd:"lib_orch_killed_any01.ogg",dur:51}, {snd:"mySong01.ogg",dur:100}, {snd:"mySong02.ogg",dur:125}]
}
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.
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Music in flight ?

Post by Svengali »

A third option for tracks is available - reduce volume. Range is [0...1].

So

Code: Select all

{snd:"mySong01.ogg",dur:100}
becomes

Code: Select all

{snd:"mySong01.ogg",dur:100, vol:0.7}
This way you can adjust the songs to your needs.

btw: The demo does not use the full range of possibilities. See [EliteWiki] Lib_Music for more.
dansmith127
Mostly Harmless
Mostly Harmless
Posts: 3
Joined: Sat Oct 06, 2018 1:27 pm

Re: Music in flight ?

Post by dansmith127 »

another_commander wrote: Sat Oct 06, 2018 1:54 pm
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:

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 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

rescued:{
	any:[{snd:"lib_orch_killed_any01.ogg",dur:51}, {snd:"mySong01.ogg",dur:100}, {snd:"mySong02.ogg",dur:125}]
}
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.
Thanks so much. I nearly figured this out but didn't think to put commas between the entries, I just used new lines.
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.
dansmith127
Mostly Harmless
Mostly Harmless
Posts: 3
Joined: Sat Oct 06, 2018 1:27 pm

Re: Music in flight ?

Post by dansmith127 »

Svengali wrote: Sat Oct 06, 2018 2:35 pm
A third option for tracks is available - reduce volume. Range is [0...1].

So

Code: Select all

{snd:"mySong01.ogg",dur:100}
becomes

Code: Select all

{snd:"mySong01.ogg",dur:100, vol:0.7}
This way you can adjust the songs to your needs.

btw: The demo does not use the full range of possibilities. See [EliteWiki] 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.
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Music in flight ?

Post by Svengali »

dansmith127 wrote: Sat Oct 06, 2018 5:03 pm
I am a musician so might get around to writing some tracks one day.
Musician, eh? Welcome to the club .-)
Post Reply