This branch, contains functions to read, simulate and output wav audio files.

The origin of the code stems from
http://gareus.org/oss/spicesound/start
http://gareus.org/oss/spicesound/examples
and has been made by Robin Gareus, enhanced by Hannu Vuolasaho at
https://sourceforge.net/p/ngspice/patches/13/,
compatibility and integration into ngspice-46 by Holger Vogt.

It uses the external libraries libsndfile and libsamplerate.

The current setup (ngspice.exe) has been tested with MSVC 2022 and CYGWIN on Windows 11.
A setup for KiCad (MS Windows) is available.

64 bit libsndfile has been downloaded from https://github.com/libsndfile/libsndfile/releases/

64 bit libsamplerate has been downloaded from https://github.com/libsndfile/libsamplerate/releases

The usage is described in
http://gareus.org/oss/spicesound/start

Example files are available at \examples\wave

Compiling for MS Windows, 64 bit, with VS2022 or VS2026:
Download https://github.com/libsndfile/libsndfile/releases/download/1.2.2/libsndfile-1.2.2-win64.zip
Expand libsndfile-1.2.2-win64 into same level as ngspice, rename the directory to libsndfile.
Download https://github.com/libsndfile/libsamplerate/releases/download/0.2.2/libsamplerate-0.2.2-win64.zip
Expand libsamplerate-0.2.2-win64 into same level as ngspice, rename the directory to libsamplerate.

Compiling for macOS M2 requires installing libsndfile and libsamplerate from Homebrew.
compile_macos_clang_M2.sh has been enhanced by adding
-I/opt/homebrew/opt/libsndfile/include -I/opt/homebrew/opt/libsamplerate/include
to CFLAGS and
-L/opt/homebrew/opt/libsndfile/lib -L/opt/homebrew/opt/libsamplerate/lib
to LDFLAGS

Linux Ubuntu 24.04 has the libraries libsndfile0 and libsamplerate0 available automatically.
You may need to install (with apt) the development header files libsndfile0-dev and libsamplerate0-dev.

If libsndfile or libsamplerate are not available, ngspice will compile without wave support. ngspice
will emit an error message if soundfile handling is requested.
