Is it possible to use an Fmod Studio project from a unity build?

This may be a weird question, but let’s say I have a game I made in Unity, and it has a music system that listens for Markers in Fmod.

Then I create a level editor for said game.

Would it be possible for my game to load and play a user-created Fmod Studio project and listen for Markers?

Or would I be better off using something else for the custom music?

Thanks in advance!

yes it is possible but it is too complex
I have tried it for myself as well
but it wont be the project file you can use because project file contains the information for the specified SOUND
there is a file which is placed near the project file known as the fsb or FMOD SOUND BANK
The fsb contains the audio
you can use FMOD API to retrieve the sound from that fsb if its not encrypted

			var result = FMOD.Factory.System_Create(out var system);

			result = system.setOutput(FMOD.OUTPUTTYPE.WAVWRITER);

			result = system.init(32, FMOD.INITFLAGS.NORMAL, System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(Path.Combine(outputDirectory, $"{name}.wav")));

			result = system.createSound(args[0], FMOD.MODE._2D | FMOD.MODE.LOOP_OFF | FMOD.MODE.CREATESTREAM, out var sound);

			result = sound.getSubSound(i, out var subsound);

			result = system.playSound(subsound, null!, false, out var channel);

			do
			{
				result = system.update();
				if (channel is not null)
				{
					result = channel.isPlaying(out bool playing);
					if (!playing)
						break;
				}
			} while (true);

			result = sound.release();
			result = system.close();
			result = system.release();

Wow thanks! I was wondering what the sound bank file held exactly.

So does this work with marker callbacks and such or is it just the sound?

1 Like

as i said that it is too complex so i cant just explain everything here
Here is my discord id where you can ask me in detail

mov eax,Bits&Bytes#6282

As for now i am also free so i can help

Ah thanks. It’s not really urgent or anything so it can wait, just curious to see if it’ll be an option further down the road once the game is ready to have a level editor.

good
hey do you know how to use FMOD low level api to create fsb files
I cant somehow initialize the file

I honestly don’t know how to do that yet, just recently got into Fmod so I’ve got quite a bit to learn. I thought I saw a post about not initializing somewhere on the forum, I’ll update you if I find it.

1 Like

It is possible to do this.There are two options:

The first is to provide a template project for users to add their music to an event, giving instructions on not to move markers, etc from the music event template. This does run the risk of users not reading the instructions carefully enough and causing some issues, but otherwise is the simplest solution. You can find information on how to support user-generated content here:

https://www.fmod.com/resources/documentation-studio?version=2.02&page=supporting-downloadable-and-user-generated-content.html

The second option is to have the music event use a programmer instrument, then have a custom system set up for the user to provide their music file(s) directly to the game. This is way guarantees the markers won’t be moved, but does require a little bit more setup. For more information on how to use programmer instruments, please check out the programmer_sound example in the FMOD Studio API installation examples, and read more here:

https://www.fmod.com/resources/documentation-studio?version=2.02&page=glossary.html#programmer-instrument

https://www.fmod.com/resources/documentation-unity?version=2.02&page=examples-programmer-sounds.html

1 Like

The user generated content section looks like it’ll be incredibly useful for my purposes. Actually, both will be useful cause the programmer instrument will provide an easier (but less customizable) option to the player, in addition to the UGC.

Thanks!!