Programmer Instrument

Hi,

Version FMOD: 2.01.10
Version Unity: 2020.2.2f1

I am unable to get programmer instrument to work. I am a musician and a soundDesigner and my programming skills are not very high.

I have copied the example script from the Fmod page and changed the name of my audio file to “key”.

I have put a folder with the audio in the Desktop folder (Unity-Fmod does not generate the StreamingAssets folder only Desktop)

I have put the correct address on the audible bank.

When I test unity I get two errors:

[FMOD] FMOD_OS_File_Open : fopen failed to open ‘/Documents/GitHub/TestFMOD/Assets/StreamingAssets/Assets/SoundDialogues/BibRepeater5th_bip AtmosfericFMOD.wav’, errno = 2

UnityEngine.Debug:LogError (object)
FMODUnity.RuntimeManager:DEBUG_CALLBACK (FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr) (at Assets/Plugins/FMOD/src/Runtime/RuntimeManager.cs:32)

and

[FMOD] SoundSourceInstrumentInstance::startChannelIfReady : Waveform instance in error state 18

UnityEngine.Debug:LogWarning (object)
FMODUnity.RuntimeManager:DEBUG_CALLBACK (FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr) (at Assets/Plugins/FMOD/src/Runtime/RuntimeManager.cs:36)

If anybody know resolve this problem, I would appreciate.

Thanks,

Adrián.

In the Programmer Sounds example, audio assets should be located in the StreamingAssets directory, I suggest creating the directory yourself inside Unity, and moving any audio you want the Programmer Instrument to play into there.

That first error indicates the file doesn’t exist at that location, I think this is because your audio files are inside the Desktop folder and not StreamingAssets. The second error is just a result of the file not being opened to begin with.

The final step would be to modify the void Update() method to use your audio assets, i.e

void Update()
{
    if (Input.GetKeyDown(KeyCode.Alpha1))
    {
        PlayDialogue("key.wav");
    }
    if (Input.GetKeyDown(KeyCode.Alpha2))
    {
        PlayDialogue("BibRepeater5th_bip AtmosfericFMOD.wav");
    }
    if (Input.GetKeyDown(KeyCode.Alpha3))
    {
        PlayDialogue("BibRepeater8ve_bip AtmosfericFMOD.wav");
    }
}

Hopefully that makes sense, let me know how you go!

1 Like

Thank you!!

Now it reproduces the audio that I choose but I have two doubts.

I have created a folder named “StreamingAssets” in Unity Assets. Why isn’t that folder created by FMOD? I remember that in version 2.0 l created. And why can’t a subfolder be put inside that folder to organize the dialogs that are going to be used? It only allows me to put the audios directly in that folder and not in another.

The other question is because this warning appears:

[FMOD] SoundSourceInstrumentInstance :: startChannelIfReady: Loading delay exceeded, sound may play at incorrect time

UnityEngine.Debug: LogWarning (object)
FMODUnity.RuntimeManager: DEBUG_CALLBACK (FMOD.DEBUG_FLAGS, intptr, int, intptr, intptr) (at Assets / Plugins / FMOD / src / Runtime / RuntimeManager.cs: 36)

The audio starts right after pressing the key. I dont understand her.

Thank you very much again.

Glad that’s working now!

The StreamingAssets directory is created at build time in 2.01, not sure what the design rational was there, but it looks like it’s back to being auto generated in 2.02.
Your can set the subfolder for the banks using the FMOD Bank Sub Folder field in the integration settings, and if you have raw audio assets then you should be able to put them anywhere in the StreamingAssets folder.

This warning usually indicates that too many samples are being loaded at once. If you enable Load Bank Sample Data in the integration settings and enable Preload Sample Data on your FMOD Studio Event Emitters and FMOD Studio Bank Loaders then this should prevent that warning from popping up.