Fmod5Sharp 3.0.0
See the version list below for details.
dotnet add package Fmod5Sharp --version 3.0.0
NuGet\Install-Package Fmod5Sharp -Version 3.0.0
<PackageReference Include="Fmod5Sharp" Version="3.0.0" />
paket add Fmod5Sharp --version 3.0.0
#r "nuget: Fmod5Sharp, 3.0.0"
// Install Fmod5Sharp as a Cake Addin #addin nuget:?package=Fmod5Sharp&version=3.0.0 // Install Fmod5Sharp as a Cake Tool #tool nuget:?package=Fmod5Sharp&version=3.0.0
Fmod5Sharp
Managed decoder for FMOD 5 sound banks (FSB files).
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].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.
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:
- 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.
Product | Versions 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. |
-
.NETStandard 2.0
- IndexRange (>= 1.0.2)
- NAudio.Core (>= 2.1.0)
- OggVorbisEncoder (>= 1.2.0)
- System.Text.Json (>= 6.0.5)
-
net6.0
- IndexRange (>= 1.0.2)
- NAudio.Core (>= 2.1.0)
- OggVorbisEncoder (>= 1.2.0)
- System.Text.Json (>= 6.0.5)
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
|