Fmod5Sharp 1.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Fmod5Sharp --version 1.1.1                
NuGet\Install-Package Fmod5Sharp -Version 1.1.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="1.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fmod5Sharp --version 1.1.1                
#r "nuget: Fmod5Sharp, 1.1.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=1.1.1

// Install Fmod5Sharp as a Cake Tool
#tool nuget:?package=Fmod5Sharp&version=1.1.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.

Notice (Additional Dependencies)

In order to restore ogg files from the Fmod sample data, this library uses libopus and libvorbis. These are not provided, and must be installed separately or shipped with your application. If on windows, they should be named opus.dll and vorbis.dll. On other platforms, installing libopus and libvorbis will suffice. Most linux distributions ship the required files under the package names libopus-dev and libvorbis-dev.

Regardless, the architecture of the native assemblies must match that of your application, or you will get a BadImageFormatException thrown by the system.

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
VAG
HEVAG
XMA
MPEG
CELT
AT9
XWMA
VORBIS ✔️ ogg Requires native libraries on user's system.
Product Compatible and additional computed target framework versions.
.NET 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. 
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 31,032 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