Sound2Header (sound to header) is a little and simple C program that I have written using the libsndfile library to convert any sound file supported by libsndfile to an array of samples in a range given in the command line and write the result to a header file.

The generated header file can be included in any C/C++ souce code file. It is intended for embedded projects where it is not possible to open files like when there is an operative system in place.

Sound2Header is free software licensed under the GNU/GPL version 3 or later license. It can be easily compiled with make if you download the tarball from Github with:


or executing:

gcc -lsndfile sound2header.c -o sound2header

(you need to have the libsndfile library installed, libsndfile-dev package in ubuntu)

Many thanks to Erik de Castro Lopo for creating and mantaining the libsndfile library.

Source code

Repository on Github: here