HTML5 API - Cannot create sounds from audio table

HTML5 engine - 2.03.03
using fmodstudioL.wasm
banks loaded via memory

I have a simple audio table and an event with a single programmer instrument. I have this code (below) in my CREATE_PROGRAMMER_SOUND callback, but the error (described below code snippet) occurs when running this code in any context, not just in an event callback.

this.hostKey is a string. getSoundInfo throws when the sound name is not found in the table, so it knows the table exists and returns sound info correctly.

const info = audioSystem.FMOD.STUDIO_SOUND_INFO();
audioSystem.assert(audioSystem.system.getSoundInfo(this.hostKey, info));

const soundVal: any = {};
audioSystem.assert(audioSystem.core.createSound(info.name_or_data, info.mode & ~audioSystem.FMOD.OPENMEMORY_POINT | audioSystem.FMOD.OPENMEMORY, info.exinfo, soundVal));

The issue occurs when calling createSound here. It throws ERR_FORMAT: Unsupported file or audio format.

Preceding this error is also the following trace:

[LOG] SystemI::createSoundInternal             : Create data=0x5a8970, mode=0x00000A00
[LOG] SystemI::createSoundInternal             : exinfo->cbsize             = 144
[LOG] SystemI::createSoundInternal             : exinfo->length             = 15237152
[LOG] SystemI::createSoundInternal             : exinfo->fileoffset         = 7936
[LOG] SystemI::createSoundInternal             : exinfo->numsubsounds       = 1
[LOG] SystemI::createSoundInternal             : exinfo->inclusionlist      = 0x5a869c
[LOG] SystemI::createSoundInternal             : exinfo->inclusionlistnum   = 1
[LOG] SystemI::createSoundInternal             : exinfo->dlsname            = 
[LOG] SystemI::createSoundInternal             : exinfo->encryptionkey      = 
[LOG] SystemI::createSoundInternal             : exinfo->suggestedsoundtype = 5
[ERR] CodecOggVorbis::openInternal             : failed to open as ogg
[ERR] CodecMOD::openInternal                   : 'M.K.' etc ID check failed [???]
[ERR] CodecS3M::openInternal                   : 'SCRM' ID check failed [????]
[ERR] CodecXM::openInternal                    : 'Extended Module: ' ID check failed [????]
[ERR] CodecIT::openInternal                    : 'IMPM' etc ID check failed [????]
[ERR] CodecMIDI::openInternal                  : 'HThd' ID check failed [????]
[ERR] CodecMPEG::openInternal                  : failed to open as mpeg

The sounds in the audio table are .ogg vorbis files, but the error and trace were identical when I tested with a .wav file.

I have also tried playing around with the flags for createSound to no avail (other than receiving errors from using OPENMEMORY_POINT with memory-loaded banks).

Hi,

Thank you for all the information.

We have a programmer sound example included in our HTML5 Engine here: fmodstudioapi20303html5\api\studio\examples\programmer_sound.js which may have some useful information, it also uses .ogg fiels.

Would it be possible to share the whole script, a screenshot of the event in FMOD Studio and the audio table as well?

Thank you for pointing me towards the included example.

I attempted loading the example banks into my own engine project with the same results. The only difference I could find was the way the banks were loaded.

I am now loading my banks using the filesystem approach (FS_createPreloadedFile and loadBankFile), akin to the example, which fully solves the issue, so it is only loading banks via memory that causes this.

1 Like

Thank you for sharing the solution.