audio.createmusic(text url), but how ?

Discuss everything related to custom data creation.

Moderator: NADEO

Post Reply
reaby
Posts: 1032
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

audio.createmusic(text url), but how ?

Post by reaby »

Ok so, i would like to experiment with the music thing... but there's no documentation at all about it.

Code: Select all

Audio.CreateMusic(Text url)
https://maniaplanet.github.io/maniascri ... music.html

what format the file at url needs to be, where do i define metadata like segments, bpm, etc...
what format the audio tracks to be in, and in which naming convension ?
does all the audio tracks needs to be same in length, how to handle looping points...
User avatar
Miss
Posts: 2155
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: audio.createmusic(text url), but how ?

Post by Miss »

Took the information for this post from the Turbo scripts and some quick reverse engineering.

The URL should point to a zip file, so something like:

Code: Select all

file://Media/Sounds/TMConsole/MapEditor/RandomGeneration.zip
This file:// path is a path that can be part of a title pack. I'm unsure if this could also be a http URL, you'd have to test that.

The zip contains a file called "settings.xml":

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<music>
	<tempo beatsperminute="110" beatsperbar="4" />
	<segment name="0">
		<track name="000_RdmGen_PlaceTerrain_01"/>
	</segment>
	<segment name="1">
		<track name="000_RdmGen_PlaceTerrain_01"/>
		<track name="001_RdmGen_PlaceTerrain_02"/>
	</segment>
	<segment name="2">
		<track name="000_RdmGen_PlaceTerrain_01"/>
		<track name="001_RdmGen_PlaceTerrain_02"/>
		<track name="002_RdmGen_PlaceRoads"/>
	</segment>
	<segment name="3">
		<track name="000_RdmGen_PlaceTerrain_01"/>
		<track name="001_RdmGen_PlaceTerrain_02"/>
		<track name="002_RdmGen_PlaceRoads"/>
		<track name="003_RdmGen_PlaceDeco"/>
	</segment>
</music>
All the referenced tracks should be located in a folder called "Tracks" and be saved as ogg format. So, the path referenced in the zip will be "Tracks/{Name}.ogg". The ogg files can be any standard stereo 44.1 kHz file.

A segment may also have a trackgroup with several variants. Here's another example:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<music>
	<tempo beatsperminute="102" beatsperbar="4" />
	<segment name="lap">
		<trackgroup>
			<variant name="01 Lap" intensity="2"/>
		</trackgroup>
	</segment>
	<segment name="freewheel">
		<trackgroup>
			<variant name="02 Freewheel" intensity="4"/>
		</trackgroup>
	</segment>
	<segment name="loop" variant_maxcycles="8">
		<trackgroup variant_order="intensity">
			<variant name="03" intensity="2" subgroups="0"/>
			<variant name="04" intensity="2" subgroups="0"/>
			<variant name="05" intensity="3" subgroups="0"/>
			<variant name="06" intensity="3" subgroups="0"/>
			<variant name="07" intensity="3" subgroups="0"/>
			<variant name="08" intensity="3" subgroups="0"/>
			<variant name="09" intensity="4" subgroups="0"/>
			<variant name="10" intensity="4" subgroups="0"/>
			<variant name="11" intensity="4" subgroups="0"/>
			<variant name="12" intensity="4" subgroups="0"/>
			<variant name="13" intensity="4" subgroups="0"/>
			<variant name="14" intensity="4" subgroups="0"/>
			<variant name="15" intensity="4" subgroups="0"/>
			<variant name="16" intensity="3" subgroups="0"/>
			<variant name="17" intensity="2" subgroups="0"/>
			<variant name="18" intensity="2" subgroups="0"/>
		</trackgroup>
	</segment>
</music>
In the example above, the names of the variants also refer to ogg files inside of the "Tracks" folder, for example: "Tracks/02 Freewheel.ogg", "Tracks/14.ogg", etc.

Here's a quick attempt of documenting all the xml tags and the attributes it accepts:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<music>
	<tempo beatsperminute="int" beatsperbar="int"/>
	<segment name="string" variant_reset="bool" variant_maxcycles="int" variant_maxbeats="int">
		<trackgroup variant_order="sequential or intensity or random">
			<variant name="string" volume="float" intensity="float" subgroups="int" />
		</trackgroup>
		<track name="string" volume="float" intensity="float" />
	</segment>
</music>
There's also an "Events" folder, but I have not found any examples in Turbo's files yet.

If you DM me on Discord I'll send you a couple zip files that are in Turbo, if you want! :thumbsup:
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
reaby
Posts: 1032
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: audio.createmusic(text url), but how ?

Post by reaby »

Many Thanks!
Post Reply

Return to “Title Pack & Custom Data Creation”

Who is online

Users browsing this forum: No registered users and 1 guest