Basic Fortran module for reading .WAV file samples and metadata.
If you want the defaults (library installed in /usr/local/lib/ and mod file in /usr/local/include/) just:
$ git clone https://github.com/SarKing/wavMF
$ cd wavmf
$ make
$ sudo make install
You can change the installation folder by editing the firsts lines of the Makefile
If you installed with the defaults just:
$ sudo make uninstall
Change the Makefile accordingly with your installation path.
There is no error handling and it (natively) only works with 2-channel 16-bit .WAV files. This is one of my first attempts at coding with Fortran, so don't expect much.
If you installed the library (using the Makefile) you can compile your code indicating the path of the .mod file, i.e. (using gfortran)
$ gfortran -c foo.f90 -I /usr/local/include/
And then link indicanting the lib path
$ gfortran foo.o -L /usr/local/lib -lwavmf
Note tha you can also skip the installation and use the .mod and .o files located in the mod/ and /obj folder after compilation with the Makedile.
All the functions in the library are documented in the source code, here is just an overview:
openwav(filename) -> Open the wav file.
getnchannels(fileunit) -> Reads the number of channels.
getfs(fileunit) -> Reads the sampling frequency.
getbitspersample(fileunit) -> Reads the bits per sample of the recording.
getdatasize(fileunit) -> Calculates the number of samples that each channels has.
readwavdata(fileunit) -> Reads the samples as they are in the file.
audioread(fileunit) -> IDEM as readwavdata but returns the samples as normalized reals.
Raul Estevez Gomez. Contact email: estevezgomezraul@gmail.com
Please feel free to contact me if you have any type of correction or question.
You can read the license here