Skip to content

hosackm/minimp3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minimp3

zig bindings for minimp3.

NOTE: This project is based on zig version 0.13.0. Other versions of zig are not guaranteed to work and may require modifications.

Install it

First, run:

zig fetch --save git+https://github.com/hosackm/minimp3

Next, update your build.zig:

const minimp3 = b.dependency("minimp3", .{});
exe.root_module.addImport("minimp3", minimp3.module("minimp3"));

Example

There's an example in the example directory. It shows you how you can decode an mp3 to PCM and access some information about each of the frames within it.

You can copy this code directly into your src/main.zig.

Run the example

An example.mp3 is provided in the example directory.

zig build run -- example/example.mp3 output.pcm

Test the example

The example writes an audio file as raw pcm. Use ffplay to play it:

Note: At the time of writing the current version of ffmpeg is 7.1.4. The options I'm providing may not work for your version of ffplay.

ffplay -f s16le -ch_layout stereo -sample_rate 44100 output.pcm

About

Zig bindings to the minimp3 decoder library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published