# "FSBank Error: The format of the source file is invalid."

**URL:** <https://qa.fmod.com/t/fsbank-error-the-format-of-the-source-file-is-invalid/23090>\
**Category:** FMOD Engine\
**Tags:** cpp\
**Created:** [June 26, 2025, 11:42pm UTC](https://qa.fmod.com/t/fsbank-error-the-format-of-the-source-file-is-invalid/23090 "2025-06-26T23:42:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kat2201](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@kat2201](https://qa.fmod.com/u/kat2201)\
**Post date:** [June 26, 2025, 11:42pm UTC](https://qa.fmod.com/t/fsbank-error-the-format-of-the-source-file-is-invalid/23090/1 "2025-06-26T23:42:27Z")

</div>

Hi, I have been trying to automate a process for building FSBs using the FSBANK api but I am running into an error when trying to build some banks “The format of the source file is invalid.”:

```cpp
std::vector<const char*> fileNames; // absolute paths to .wavs

FSBANK_SUBSOUND subSound = {};
subSound.fileNames = fileNames.data();
subSound.numFiles = static_cast<unsigned int>(fileNames.size());

const FSBANK_SUBSOUND* subSounds = &subSound;

fs::path fsbPath = dir / (stem + ".fsb");

std::cout << "Building FSB: " << fsbPath << "\n";
ERRCHECK(FSBank_Build(subSounds, 1, FSBANK_FORMAT_PCM, FSBANK_BUILD_DEFAULT, 0, nullptr, fsbPath.string().c_str()));

```

 ![Pasted image 20250627092806](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/e/ebea660b6a4b94b346501713894abb690c145eab.png)

It’s only some of my banks that get this error too.

But what gets me is that using fsbank.exe seems to happily build the bank with the same .wavs!

 ![Pasted image 20250627093254](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/8/84883c491a77dd98ed1ba30bce2b4ab2244ea97c.png)  
.

I also get the error “An invalid parameter has been passed to this function.” on FSBank\_Build for some other banks – while these .wav files also build successfully in fsbank.exe.

What am I missing?

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [July 1, 2025, 6:18am UTC](https://qa.fmod.com/t/fsbank-error-the-format-of-the-source-file-is-invalid/23090/2 "2025-07-01T06:18:24Z")

</div>

Hi! If possible, could I get you to upload the problem wavs to your [FMOD user profile](https://www.fmod.com/profile#uploads) for me to take a look at on my end?

---

<div class="post-metadata">

**Author:** ![kat2201](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@kat2201](https://qa.fmod.com/u/kat2201)\
**Post date:** [July 7, 2025, 1:29am UTC](https://qa.fmod.com/t/fsbank-error-the-format-of-the-source-file-is-invalid/23090/3 "2025-07-07T01:29:34Z")

</div>

Hi! Apologies for the late response - I don’t think I am able to provide these files publicly, but I can show details of the file.

This is one of the problem wav files:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/7/7fa0b5086cf08d2570edfb9d1c3a878b98a590a7.png)

This has actually been converted from a Playstation 2 .vag file using FFMPEG.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/a/a2e0850a8dc320252a16a2f4c98b88ed7afa0220.png)

I don’t have a great deal of experience with audio, so I may have missed something fairly obvious here - I appreciate the help.

---

<div class="post-metadata">

**Author:** ![kat2201](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@kat2201](https://qa.fmod.com/u/kat2201)\
**Post date:** [July 7, 2025, 1:34am UTC](https://qa.fmod.com/t/fsbank-error-the-format-of-the-source-file-is-invalid/23090/4 "2025-07-07T01:34:45Z")

</div>

Something I’ve actually noticed is that multiple files that I am trying to build into the same .FSB do have different sample rates.  
For example,  
File 1 - 22042 Hz  
File 2 - 11015 Hz  
File 3 - 24000 Hz

---

<div class="post-metadata">

**Author:** ![kat2201](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@kat2201](https://qa.fmod.com/u/kat2201)\
**Post date:** [July 8, 2025, 11:33pm UTC](https://qa.fmod.com/t/fsbank-error-the-format-of-the-source-file-is-invalid/23090/5 "2025-07-08T23:33:14Z")

</div>

I’ve identified the error here and have been able to fix it.

I misunderstood the documentation of FSBANK\_SUBSOUND – Specifically, “fileNames - List of file names used to produce an interleaved sound.”.

I assumed this was where I was to provide the paths to all of my waves that I wanted to build into the .fsb, but the correct way to do it is to have an FSBANK\_SUBSOUND for each sub sound (should be obvious, right? My mistake…)

My updated, correct code:

```cpp
std::vector<FSBANK_SUBSOUND> subSounds;
std::vector<std::vector<const char *>>
    subSoundFileNames; // Need to keep strings in scope...
for (const auto &fileName : wavFileNames)
{
    subSoundFileNames.push_back({fileName.c_str()});

    FSBANK_SUBSOUND subSound = {0};
    subSound.fileNames = subSoundFileNames.back().data();
    subSound.numFiles = 1;

    subSounds.push_back(subSound);
}

ERRCHECK(FSBank_Build(subSounds.data(), static_cast<unsigned int>(subSounds.size()),
                      FSBANK_FORMAT_PCM, FSBANK_BUILD_DEFAULT, 0, nullptr, outputPath);

```

This actually builds a set of wavs into a single .fsb, which was my intention.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [July 22, 2025, 4:03am UTC](https://qa.fmod.com/t/fsbank-error-the-format-of-the-source-file-is-invalid/23090/6 "2025-07-22T04:03:51Z")

</div>

Happy to hear that you resolved the issue!

The general use of a subsound is indeed to create a single subsound per audio file. This is what the FSBank executable does. Providing multiple files to a single subsound is done when you want to the audio data from each file to be interleaved in the encoded output - i.e. providing 6 mono files to be interleaved into a single 6ch subsound.

As you’ve noted, the FSBank API docs aren’t the clearest on this point, so I’ve flagged it for improvement internally.
