Fmod5Sharp 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Fmod5Sharp --version 2.0.1                
NuGet\Install-Package Fmod5Sharp -Version 2.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fmod5Sharp" Version="2.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fmod5Sharp --version 2.0.1                
#r "nuget: Fmod5Sharp, 2.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Fmod5Sharp as a Cake Addin
#addin nuget:?package=Fmod5Sharp&version=2.0.1

// Install Fmod5Sharp as a Cake Tool
#tool nuget:?package=Fmod5Sharp&version=2.0.1                

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

FmodSoundBank bank = FsbLoader.LoadFsbFromByteArray(rawData);

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].Channels; //2 for stereo, 1 for mono.

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.

If the user's system does not have libopus or libvorbis, and the data is vorbis-encoded, this will throw a DllNotFoundException.

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
PCM32 ✔️ wav
PCMFLOAT
GCADPCM ✔️ wav Tested with single-channel files. Not tested with stereo, but should work in theory.
IMAADPCM ✔️ wav
VAG
HEVAG
XMA
MPEG
CELT
AT9
XWMA
VORBIS ✔️ ogg

Acknowledgements

This project uses:

It also uses System.Text.Json.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Fmod5Sharp:

Repository Stars
AssetRipper/AssetRipper
GUI Application to work with engine assets, asset bundles, and serialized files
nesrak1/UABEA
c# uabe for newer versions of unity
Version Downloads Last updated
3.0.1 30,857 7/22/2022
3.0.0 647 7/20/2022
2.0.2 495 7/19/2022
2.0.1 833 7/4/2022
2.0.0 438 7/4/2022
1.2.0 8,787 9/20/2021
1.1.1 369 9/19/2021
1.1.0 356 9/19/2021
1.0.1 679 8/15/2021
1.0.0 352 8/15/2021