Skip to content

synesthesiam/flac-decoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FLAC Decoder

Port of: https://www.nayuki.io/res/simple-flac-implementation/simple-decode-flac-to-wav.py

Uses some small parts from: https://github.com/schreibfaul1/ESP32-audioI2S/

Building and Running

make
./main < input.flac > output.raw

FLAC data is read from stdin and raw audio samples are written to stdout.

Audio samples are always 16-bit signed integers, but you need to know the sample rate and number of channels from the FLAC file in order to play the raw audio. For example:

ffprobe input.flac

[lots of info]
Stream #0:0: Audio: flac, 48000 Hz, stereo, s16

With this information, you can convert the raw audio to a WAV file:

sox -r 48000 -c 2 -b 16 -e signed-integer -t raw output.raw output.wav

Customizing

Adjust the code in fill_buffer() to get data from the appropriate source (currently stdin).

Make sure to keep the same logic of copying the unread chunk at the end of the buffer to the beginning before filling the rest with new FLAC data.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published