Lightweight ATRAC3/AT3plus/aac/mp3 decoder for .NET. No external ffmpeg required.
$ dotnet add package LightCodecLightCodec is a lightweight ATRAC3/AT3plus/MP3/AAC audio decoder for .NET, designed to work without external dependencies like FFmpeg.
dotnet add package LightCodec
using Lightcodec;
ILightCodec codec;
byte[] data = new byte[Format.BytesPerFrame];
short[] audioBuf = new short[8192];
codec = CodecFactory.Get(AudioCodec.AT3plus);
codec.init(Format.BytesPerFrame, Format.Channels, Format.Channels, 0);
while (!DataStream.Eof())
{
DataStream.Read(data, 0, Format.BytesPerFrame);
int len = 0;
fixed (byte* ptr = data)
{
fixed (short* outPtr = audioBuf)
{
int result = codec.decode(ptr, Format.BytesPerFrame, outPtr, out len);
}
}
}
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GPL-2.0 license.