When using ProgrammerSoundName to specify wav file, playback stops almost at once.

So in our dialog system, I build a path to a wav file I want to play, based on character/language/stress level, etc. I then use
UFMODBlueprintStatics::PlayEventAttached to create a component attached to the speaker, use SetProgrammerSoundName to give the wave file, and then call Play(). I get the first half second of the audio, and then it stops. I’ve got a handler on the OnEventStopped that gets called, but way earlier than it should.
I note that the first call thing that Play() does is to call Stop(), which seems like it may generate spurious errors to me. But even if I remove my handler, the sound still cuts out almost immediately.
Is there something else I need to be doing other than SetProgrammerSoundName to get this to work? I’ve stepped through the code I can, and in EventCallbackCreateProgrammerSound() it looks like the call to LowLevelSystem->createSound() returns successfully. I added some logging to get the length of the sound it’s returning, and it’s correctly several seconds long.

Here’s some logs:
LogFMOD:Verbose: Playing component 0000016D00CE0100
EEarthfall_LogUtility: PlayVODialog: Sound started at: 4.659204
LogFMOD:Verbose: Creating programmer sound from file ‘…/…/…/Earthfall/Content/FMod/Dialog/en/Roy_call_Printer_Foundb_calm_en.wav’
LogFMOD:Verbose: Programmer sound reports length of 2159 ms
LogFMOD:Verbose: Destroying programmer sound
LogFMOD:Verbose: UFMODAudioComponent 0000016D00CE0100 PlaybackCompleted
Earthfall_LogUtility: PlayVODialog: Got Finished from FMOD at 5.220541
LogFMOD:Verbose: UFMODAudioComponent 0000016D00CE0100 Stop

So despite having a 2+ length sound, it stops after half a second.

Any hints on how to debug this?


Rick Saada, Holospark

You should take a look at our documentation on Programmer sounds and Audio tables, they are basically made for dialog and localisation.

In the callstack it looks like the sound is playing before the programmer sound has been created, PlayEventAttached is set to automatically play by default which is changed using the last parameter in the function.

I did read that page, which covers setting a programmer sound name as a property on an existing component, and creating a sound on the fly from C++, but not my case, where I want to set a programmer name on a component I’m creating in C++.

I was passing false, as best I can tell. Here’s my code. BuildWaveFilename generates the relative path off of the content dir for the wav to use based on lots of variables. That part is working, as the sound starts playing. It just stops a moment later.

if (VODialog.AttachToActor)
VODialogFModAudioComp = UFMODBlueprintStatics::PlayEventAttached(ContainerEvent, VODialog.AttachToActor->GetRootComponent(), NAME_None, FVector::ZeroVector, EAttachLocation::SnapToTarget, true, false);
if (VODialogFModAudioComp)
// Do we have multiple performances of this? Construct a wav filename for FMod. TODO: Hardwired to English for now
VODialogFModAudioComp->SetProgrammerSoundName(BuildWaveFilename(VODialog.CalloutName, VODialog.FinalRowKey, VoiceoverLanguageSubdirectory, VODialog.AttachToActor, VODialog.Performances, VODialog.UseStressed, bRadio)); // Fill in the full wave file path to use
UE_LOG(Earthfall_LogUtility, Log, TEXT(“PlayVODialog: Sound started at: %f”), GetWorld()->GetTimeSeconds());
VODialogFModAudioComp->OnEventStopped.AddUniqueDynamic(this, &AEarthfallGameState::FModReportsDialogFinished);

One thing that might be an issue that I should mention. I’m reusing the same container events over and over, just setting different programmer names on them after creating the component. Is that an issue?

Thanks for the help!


Sorry, I may have been thinking of this the wrong way. The programmer sound option in UFMODAudioComponent isn’t for creating a new sound to play from file, it is for picking a programmer sound out of an audio table event.

For that you would be best to use the Low Level System to create and maintain your sounds, you just won’t have to worry about Initializing or Updating the system.

You should have access to the Low Level API on our downloads page, it will have examples you can use to create a sound from file and update the 3D Attributes to move the sound with the actor.

OK, so I’m confused. In this section of the docs:

Programmer Sounds by Path

Note: With this approach, you can easily play any media file for your event.

You can set up a programmer sound to point directly to a file. To do this, set the FMOD audio component’s “Programmer Sound Name” to the path to the .wav or .ogg file that you want to load. If this path is relative, it will be looked up relative to the content directory.


If you do this, you’ll need to make sure that directory with the media files is added to “Directories to Package” in the packaging settings, otherwise it will work in the editor, but not when packaged into the final game.

It makes it sound like you can do exactly what we’re doing, i.e. point directly to a file. Are the docs wrong? Or am I misunderstanding what they’re saying here.

My apologies, you are correct.
What version of Studio and the Integration are you using?
It sounds like it could be something to do with how the event is setup.

From our FModStudio.uplugin:

"FileVersion" : 3,

"FriendlyName" : "FMOD Studio Integration",
"Version" : 10814,
"VersionName" : "1.08.14",
"CreatedBy" : "Firelight Technologies",
"CreatedByURL" : "http://fmod.com",
"EngineVersion" : "4.6.0",
"Description" : "FMOD Studio Integration.",
"Category" : "Audio",
"EnabledByDefault" : true,
1 Like

In FMOD Studio on the programmer sound, if looping is turned on, it also gives it the ‘cutoff’ flag. http://imgur.com/3GShjaH
Turning the looping off in Studio will allow the programmer sound module to play out completely unless the event is stopped.

We are working on better documentation for these kind of features, which have also been exposed a bit nicer in 1.09.

Aha! Yes, that is indeed what was happening! Your little image was perfect, otherwise we wouldn’t have found that. Unchecked looping, and now it works correctly.

Thank You so much for your help!