ManagedBass.ReplayGain
0.2.0
See the version list below for details.
dotnet add package ManagedBass.ReplayGain --version 0.2.0
NuGet\Install-Package ManagedBass.ReplayGain -Version 0.2.0
<PackageReference Include="ManagedBass.ReplayGain" Version="0.2.0" />
paket add ManagedBass.ReplayGain --version 0.2.0
#r "nuget: ManagedBass.ReplayGain, 0.2.0"
// Install ManagedBass.ReplayGain as a Cake Addin #addin nuget:?package=ManagedBass.ReplayGain&version=0.2.0 // Install ManagedBass.ReplayGain as a Cake Tool #tool nuget:?package=ManagedBass.ReplayGain&version=0.2.0
BASS_REPLAY_GAIN
A replay gain calculator for BASS which uses IIR stereo filters similar to libavfilter.
bass.dll is required for native projects. ManagedBass is required for .NET projects.
A simple example;
int Main()
{
//Load as a plugin if you like, or use Loader.Load("bass_replay_gain")
BassReplayGain.Load();
var handle = Bass.CreateStream("test.mp3", Flags: BassFlags.Decode | BassFlags.Float);
var info = new ReplayGainInfo();
if (!BassReplayGain.Process(handle, out info))
{
Console.WriteLine("Failed to process stream: {0}", Bass.LastError);
return 1;
}
Console.WriteLine("Gain: {0}", info.gain);
Console.WriteLine("Peak: {0}", info.peak);
}
#include <stdio.h>
#include "../bass_replay_gain/bass_replay_gain.h"
int main(int argc, char** argv) {
DWORD handle;
REPLAY_GAIN_INFO info;
if (!BASS_Init(0, 44100, 0, 0, NULL)) {
printf("Failed to initialize BASS: %d\n", BASS_ErrorGetCode());
return 1;
}
handle = BASS_StreamCreateFile(FALSE, "test.mp3", 0, 0, BASS_STREAM_DECODE | BASS_SAMPLE_FLOAT);
if (!BASS_REPLAY_GAIN_Process(handle, &info)) {
printf("Failed to process stream: %d\n", BASS_ErrorGetCode());
return 1;
}
printf("Gain: %f\n", info.gain);
printf("Peak: %f\n", info.peak);
BASS_Free();
}
Using BASS_SAMPLE_FLOAT
is recommended but not required.
BASS_REPLAY_GAIN_Process
is quite fast, less than a second for a 30MB track. It could be used for playback on the fly (just reset the stream position).
If you wish to apply a volume effect with BASS_FX
the calculation is pow(10, gain / 20)
.
A batch mode is also available to calculating album gain: BASS_REPLAY_GAIN_ProcessBatch
. It accepts set of channel handles (up to 256) and returns a REPLAY_GAIN_BATCH_INFO
containing information for both individual tracks and the entire batch.
BASS_REPLAY_GAIN_Process
and BASS_REPLAY_GAIN_ProcessBatch
are thread safe.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.