Awesome Open Source
Awesome Open Source



Synaesthesia is a program for representing sounds visually. It goes beyond the usual oscilliscope style program by combining an FFT and stereo positioning information to give a two dimensional display. Some of the shapes I have observed are:

  • Drums: clouds of color, fairly high
  • Clean guitar: several horizontal lines, low down
  • Rough guitar: a cloud, low down
  • Trumpet: Lots of horizontal lines everywhere
  • Flute: A single horizontal line, low down
  • Voice: A vertical line with some internal structure
  • Synthesizer: All kinds of weird shapes!

Synaesthesia represents frequency as the vertical position on screen, and stereo position as the horizontal position. It can also understand surround sound encoded music, and shows ambient noise in a different color.

Synaesthesia uses Simple DirectMedia Layer (SDL), which supports many different output methods. Direct support for X11 and SVGAlib has been removed. Both are supported via SDL.

It can take input from a CD, line input, EsounD, or piped from another program. As of version 2.2, EsounD support is much improved. For example, Synaesthesia works well with XMMS if both use EsounD.


Synaesthesia should work on Linux and BSD systems. (Note: I don't have access to a BSD system myself, I have to rely on patches -- if it doesn't work, please tell me!)

For best results, first make sure you have installed the libraries and the header files for these: (on most systems, this means installing the appropriate "dev" packages)

  • Simple DirectMedia Layer (SDL)
  • EsounD (ESD)

Compile Synaesthesia by typing

./configure make

then install it by typing

make install

then you should be able to type


to run the program.

You will need to run Synaesthesia as root to run it full screen with SVGAlib. Other varieties can be run by any user providing you provide permissions on /dev/dsp, /dev/cdrom, and /dev/mixer.

Synaesthesia creates a configuration file named ~/.synaesthesia to store settings such as brightness, color, and window size, as well as which devices to use to control sound input.

BSD users will have to edit this file to set the CD-ROM device name before using Synaesthesia in order to control the CD.

Run Synaesthesia with no parameters for further information on how to use it.

Notes for code rippers

This program contains code that you may wish to use in your own projects. If you want to, please do. (For example, you might want to add some snazzy visual effects to your favourite MP3 or CD player)

The actual code to do the mapping from sound to visual display is all in, it should be fairly easy to disentangle from other parts of the program. It does make reference to some globals defined in syna.h, namely the #defines LogSize (log2 of the sample size for each frame) and Brightness, data (which stores the sound input), outputBmp, lastOutputBmp and lastLastOutputBmp (which hold the output), outWidth and outHeight (size of the bitmaps), and fadeMode, brightnessTwiddler, starSize and pointsAreDiamonds (various parameters affecting the display).

The normal way to use it would be:

Call coreInit() to set up some look-up tables Call setStarSize(starSize) to set up some more look-up tables Loop Put data into the data array Call fade() to apply the fade/wave/heat effect to the output Call coreGo() to add the next fragment of sound input to the output Display contents of outputBmp to screen

There is a simple anti-aliased polygon drawing engine in the file polygon.h. contains code for driving the CD. xlib.c and contain code for setting up a window under X (originally ripped from the Xaos fractal viewer program :-) ).


Feel free to email me me (Paul Harrison) at [email protected] with any suggestions, bug-reports, or better yet, patches.

A number of other people have contributed to Synaesthesia:

Thanks to Asger Alstrup Nielsen for many great suggestions, and for writing optimized 32 bit loops for fading and drawing to screen.

Thanks to Roger Knobbe for porting Synaesthesia to FreeBSD.

Thanks to Ben Gertzfield and Martin Mitchell for some small fixes to the CD controlling code.

Thanks to Simon Budig for an improvement to the X code.

Thanks to Devin Carraway for fixing Synaesthesia to work with non-32-bit word machines.

Synaesthesia is distributed under the GPL.


1.1 - Added surround sound decoding. 1.2 - Fixed a bug in the ioctl calls to /dev/dsp. 1.3 - Asger Alstrup Nielsen's optimizations added. Added X-Windows support. More options, redesigned interface. 1.4 - Bug fixes, including a great reduction in "Sound: Recording overrun" warnings. New command line options: play lists and piping. Support for SDL. 2.0 - Bug fixes: Fixed problem in xlib.c that caused occasional segfaults, several endianness problems fixed. New effects: Wave, heat, diamond shaped points. Piping sound now longer requires the twiddle factor. Yet another interface redesign. Partial support for LinuxPPC (pipe mode only) 2.1 - Autoconf support. Esd support. Some code cleanup, now only makes one binary. SDL version now sets title. Bug fixes: Old versions of gcc can't cope with some of the stuff I was doing with templates. 2.2 - Works on machines with non-32-bit words (patch by Devin Carraway) Pipe and ESD modes greatly improved: it now syncs properly to the music with ESD Resizable window with SDL Fixes to autoconf of SDL Clicking on window toggles full screen in SDL Automatic brightness compensation 2.3 - Compiles with g++ 3.4 Tweaked sound code, should now work on fast computers 2.4 - Applied a patch by Aurelien Jarno that fixes some FreeBSD problems

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
C (276,169
Emscripten (418
Music Visualizer (157
Related Projects