GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - SamboyCoding/Fmod5Sharp: Managed-Only C# Library for Decoding FMOD 5 sound banks (FSB or bank files)

BranchesTags
Open more actions menu

Latest commit

 

History

48 Commits
48 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
BankExtractor
BankExtractor
 
 
Fmod5Sharp.Tests
Fmod5Sharp.Tests
 
 
Fmod5Sharp
Fmod5Sharp
 
 
HeaderGenerator
HeaderGenerator
 
 
.gitignore
.gitignore
 
 
Fmod5Sharp.sln
Fmod5Sharp.sln
 
 
LICENSE
LICENSE
 
 
NOTICE
NOTICE
 
 
README.md
README.md
 
 

Repository files navigation

Fmod5Sharp

Managed decoder for FMOD 5 sound banks (FSB files).

NuGet

This library allows you to read FMOD 5 sound bank files (they start with the characters FSB5) into their contained samples, and then export those samples to standard file formats (assuming the contained data format is supported).

Support for more encodings can be added as requested.

Usage

The Fmod file can be read like this

//Will throw if the bank is not valid.
FmodSoundBank bank = FsbLoader.LoadFsbFromByteArray(rawData);

Or if you don't want it to throw if the file is invalid, you can use

bool success = FsbLoader.TryLoadFsbFromByteArray(rawData, out FmodSoundBank bank);

You can then query some properties about the bank:

FmodAudioType type = bank.Header.AudioType;
uint fmodSubVersion = bank.Header.Version; //0 or 1 have been observed

And get the samples stored inside it:

List<FmodSample> samples = bank.Samples;
int frequency = samples[0].Metadata.Frequency; //E.g. 44100
uint numChannels = samples[0].Metadata.Channels; //2 for stereo, 1 for mono.

string name = samples[0].Name; //Null if not present in the bank file (which is usually the case).

And, you can convert the audio data back to a standard format.

var success = samples[0].RebuildAsStandardFileFormat(out var dataBytes, out var fileExtension);
//Assuming success == true, then this file format was supported and you should have some data and an extension (without the leading .).
//Now you can save dataBytes to an file with the given extension on your disk and play it using your favourite audio player.
//Or you can use any standard library to convert the byte array to a different format, if you so desire.

You can also check if a given format type is supported and, if so, what extension it will result in, like so:

bool isSupported = bank.Header.AudioType.IsSupported();

//Null if not supported
string? extension = bank.Header.AudioType.FileExtension();

Alternatively, you can consult the table below:

Format Supported? Extension Notes
PCM8 ✔️ wav
PCM16 ✔️ wav
PCM24 ❌ No games have ever been observed in the wild using this format.
PCM32 ✔️ wav Supported in theory. No games have ever been observed in the wild using this format.
PCMFLOAT ❌ Seen in at least one JRPG.
GCADPCM ✔️ wav Tested with single-channel files. Not tested with stereo, but should work in theory. Seen in Unity games.
IMAADPCM ✔️ wav Seen in Unity games.
VAG ❌ No games have ever been observed in the wild using this format.
HEVAG ❌ Very rarely used - only example I know of is a game for the PS Vita.
XMA ❌ Mostly used on Xbox 360.
MPEG ❌ Used in some older games.
CELT ❌ Used in some older indie games.
AT9 ❌ Native format for PlayStation Audio, including in Unity games.
XWMA ❌ No games have ever been observed in the wild using this format.
VORBIS ✔️ ogg Very commonly used in Unity games.
FADPCM ✔️ wav Seems to be used in Unreal Engine games.
OPUS ❌ ?

Acknowledgements

This project uses:

  • OggVorbisEncoder to build Ogg Vorbis output streams.
  • NAudio.Core to do the same thing but for WAV files.
  • BitStreams for parsing vorbis header data.
  • IndexRange to make my life easier when supporting .NET Standard 2.0.

It also uses System.Text.Json.

About

Managed-Only C# Library for Decoding FMOD 5 sound banks (FSB or bank files)

Topics

audiofmodfsbfsb5reverse-engineering

Resources

Readme
MIT license
Activity

Stars

49 stars

Watchers

3 watching

Forks

19 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.