SoundSynth 1.1.1
A small compiled library with applications for C sound synthesis and playback functions. The library was compiled for Windows 64-bit and should work with 64- or 32-bit windows architectures.
Loading...
Searching...
No Matches
Sound Synthesizer

This is a small compiled library for C synthesizing simple sounds/tones and playing them. The library was compiled for Windows 64-bit and should work with 64- or 32-bit windows architectures.

(Return)


Contents

Compiling

Executables

To re-compile the executable bin/wplay.exe use the following command:

gcc src/wsoundsynth.c -o bin/wplay.exe -lwinmm

To re-compile the executable bin/wplay_ui.exe use the following command:

gcc src/wsoundsynth_ui.c -o bin/wplay_ui.exe -lwinmm -lgdi32

Dynamic Link Library

To re-compile the dynamic link library (.dll), use the following command:

gcc -shared -o bin/WSoundSynth.dll src/wsoundsynth.c -lwinmm
  • The -shared option creates a shared object.
  • The -o is what the output file is.
  • The -lwinmm option links against the windows multimedia library.

Static Library

To re-compile the static library (.lib), use the following command:

gcc -c src/wsoundsynth.c -o lib/wsoundsynth.o -lwinmm && ar rcs lib/WSoundSynth.lib lib/wsoundsynth.o

For External Use

Assume we have the following project folder structure:

(bash)
my_project
|--src
| |--my_code.c
| |--my_code.h
|
|--include
| |--wsoundsynth.h
|
|--bin
| |--WSoundSynth.dll

To compile, you would use the following command:

(bash)
gcc -o bin/my_executable.exe src/my_code.c -Lbin -Iinclude -lWSoundSynth

Note about gcc

Note that to use gcc on a Windows 64-bit architecture, the simplest way is to download `msys2`, which will allow you to use pacman from an msys2 terminal. You can first check to see if you already have gcc installed:

(bash)
pacman -Q | grep mingw-w64-x86_64-gcc

If you see anything in the terminal following this command, it means you already have gcc. Otherwise, you need to install it (and probably the rest of the toolchain, such as a linker etc.):

(bash)
pacman -S mingw-w64-x86_64-toolchain

This will give several options for what you can install. If you are unsure what to do, just install all of them.
Finally, you may also want a toolchain for compiling 32-bit applications from your 64-bit Windows operating system. In that case, you can try:

(bash)
pacman -S mingw-w64-i686-toolchain

The last step is to make sure the folder with the correct binaries are on your PATH environment variable. Probably the best strategy here, on a Windows device, is as follows:

  1. Open the Start menu and type Environment, this should bring up a Control Panel shortcut to "Edit the System Environment Variables." Click that.
  2. Click "Environment Variables..." at the bottom right.
  3. Under System Variables, click "New..." and define a new environment variable: MINGW_PATH. If you installed msys2 in the default location, then go to C:/mingw64. You will be looking for the sub-folder containing binaries. In my install, that is located at C:\msys64\mingw64\bin – so that is my MINGW_PATH environment variable.
  4. Under User Variables, find Path. Click Edit... with Path selected.
  5. In the new popup, click New to add a new Path value. Enter MINGW_PATH%. Now, you can add or remove MINGW_PATH% from the user Path variable depending on what compiler needs you have. Click on the newly added value, and click Move Up until it is at the top of the list. This ensures we don't accidentally find gcc somewhere else and use a different unintended version. Note that if you want to switch between i.e. C:\msys64\mingw32\bin and C:\msys64\mingw64\bin it might just be easiest to change the value of MINGW_PATH environment variable.