to Pieter's
software
index
Spectroscopic Toolkit
64 bit integer DSP kit for nanotonal synthesis
hammer and rainbow
Copyright © 2001-2002 Pieter Suurmond
Utrecht School of the Arts, faculty of Art, Media and Technology
PO box 2471, 1200 CL Hilversum, Netherlands
phone:  (+31) 35-6836464, fax: (+31) 35-6836480.     e-mail:  pieter@kmt.hku.nl

What is it?

Spectroscopic Toolkit provides 64 bit integer DSP for massive additive synthesis or granular synthesis. It generates audio files and graphic image files. It was not designed for realtime synthesis, and does not offer a graphical user interface. I developed it because other rendering software (like CSound) did no longer suffice my needs. These are:

Spectroscopic Toolkit software translates quantumphysical data to AIFF file. The process is alchemistic in file ST_c01_twoWeeks.c: atomic spectra of the seven metals Au, Ag, Fe, Hg, Sn, Cu, Pb, in that order, are transposed 40 octaves downwards. Frequencies are shaped into elongated, overlapping, Gaussian grains. This sequence is followed by 6 ions: Ag+, Fe+, Hg+, Sn+, Cu+, Pb+ (Au+ is missing because the database doesn't include gold-ions).


Who is it for?

Spectroscopic Toolkit is open source software for the public domain, for anyone interested in alchemy, electronic composition, nanotonality, etc.
The toolkit can be applied in electronic composition to generate sounds as alchemistic symbols.
The spectrum of iron (Fe) for example has an alchemistic link with the planet mars, the day tuesday and the masculine, contrary to copper (Cu) which stands for the feminine, venus and friday.
With a sound astrological-numerological basis one could even consider developing a new sound-therapy or virtual chemotherapy with this software. Imagine that iron-atoms in our bodies start to resonate while we carefully listen to the iron-spectrum, transposed exactly 40 (or 39) octaves downwards...  Of course this is all nonsense and speculation but I can assure you it is really fun to play with these ancient symbols, and their sounds.
Working with Spectroscopic Toolkit may be quite exciting!... also because it sometimes takes 9 days to render a small piece of nanotonal music (anno 2001 on a moderate-speed UNIX machine) and one may become very curious about results (seems like this software is for patient people only).

Notice you need a C-compiler as well as some basic knowledge about programming in C to use andadapt this toolkit for your own purposes.

In case you are interested in only parts of the software, go grab the sources and do with them whatever you like.
The only restrictions are that one may not sell this software (unmodified), one may not patent this software, and sounds that come out of it may never be sold (in unmodified form). For all this nanotonal work should remain in the public domain.
One final note about incorporating parts of the jpeg-library from the Independant JPEG Group: Please do not bother Tom Lane about this re-distribution of his software. Subdirectory "gt" namely contains only a part (the compression-part) of the original library sources.


How does it work?

ST works a bit like CSound: first a sorted score-list is generated, then so called instruments are allocated and played as long as they are active.
The differences with CSound are that instruments are called WAVELETS in ST, and they remain in memory rather than in a .sco-file. In ST, there is no separate sorting routine (as in CSound), the WAVELETS in the linked list structure maintain their order (based on starttimes) by using the addWAVELET()-function.

Apart from the simple c00_exampleX()-functions, ST tries to read the binary version of the spectroscopic database in subdirectory pconv. ST outputs a logfile, one or more graphic scorefiles, and an audiofile. Function c01_twoWeeks() can also output video in the form of a series of numbered JPG-frames in subdirecory "video").

  1. Initialization:
    The main() in source file ST.c starts with creating a logfile to write diagnostic messages to.
    It then creates a so called ENGINE which contains samplerate information, some samplerate-related constants as well as some wavetables.
  2. Algorithmic composition:
    A composition is created by putting wavelets into a linked list structure by some algorithm.
    See comp/c00_example.c for two simple examples, or comp/c01_twoWeeks.c for a more complicated example that uses Kurucz'z spectroscopic database (and also generates a large number of video frames). Composing basically consists in repeatedly calling the function addWAVELET(). Currently, 3 types of envelopes are supported, but it won't be too difficult to add more in sourcefile ST_wavelets.c. In main(), one may switch between the various cXX_xxxx()-composition algorithms.
  3. Score rendering:
    Graphic scores of the music are generated in JPG-format. These are basically sonograms, drawn from the linked list structure that was filled above.
    Within main(), function scoreWAVELETS() may be called several times to draw scores with various dimensions. With parameter envelopeTracking switched on, scoreWAVELETS() visualises envelope-shapes by greyscales. With envelopeTracking off, only the top-amplitude of an envelope is used as greyscale (no intensity change over time).
  4. Audio rendering:
    Finally, audio is calculated and saved to AIFF file (stereo, 8, 16 or 24 bit, whatever samplerate) by calling function playWAVELETS() from main(). Audio rendering will abort as soon as over- or underflow occurs, files thus far will however be saved.

ST uses 4 wavetables in total: 1 for audio and 3 for subaudio. The following 4 images were created by function visualiseTables():


  audio sinewave For audio, only a simple sinewave is used. In expontial envelopes (rise and fall) a sine is the only one that can be used. A cosine, for instance, might cause clicks when its' phase is aligned at the start or the end of the exponential.
  gaussian bell In calls to addWAVELET(), argument top specifies the center of the gaussian bell, dur specifies only 1/5th of the total (really calculated) duration.
Duration is measured here from inflection point at steepest ascend to inflection point at steepest descend, where amplitude is exp(-0.5), which is approximately 0.6065. Here argument sync may be 0 or 1.
  exponential decay In calls to addWAVELET(), argument top specifies the start of the exponential decay, dur specifies only 1/15th of the total (really calculated) duration.
Duration is measured here from start (top) to the -6.02 dB point, where amplitude is exactly 0.5. Here audio and subaudio tables need to be aligned to prevent 'clicks', argument sync must be 0.
  exponential rise In calls to addWAVELET(), argument top specifies the end of the exponential rise, dur specifies only 1/15th of the total (really calculated) duration.
Duration is measured here from the -6.02 dB point, where amplitude is exactly 0.5, to the end (top). Here audio and subaudio tables need to be aligned to prevent 'clicks', argument sync must be 0.

Anyway, the best documentation is the source itself...  read & click on!

Where to get it?

The latest version of Spectroscopic Toolkit may be downloaded from http://www.hku.nl/~pieter/SOFT/ST/html/.
Older versio may be still available in parent directory http://www.hku.nl/~pieter/SOFT/.
Below, one can download the complete ST-package as gzipped tar-file, containing all sources and documentation, except the large spectroscopic database. The database can be downloaded separately from subdirectory pconv.

download ST as gzipped tar-file   ST1.62.tar.gz 310 122 bytes   The latest Spectroscopic Toolkit version 1.62. Kurucz's database not included.

After unpacking, your source directory should look something like this (files can also be viewed and downloaded individually):

subdirectory   comp subdirectory  Composition sources and an example how to use function addWAVELET().
subdirectory   gt subdirectory  Minimal graphic toolkit to write (not read) JPG-files. Create 24 bit RGB images in memory, set and get individual pixels, draw lines, translate monochrome frequencies to RGB-values, draw texts, etc. Incorporates the compression-part of the JPEG-library from the Independent JPEG Group (version 6b, 27-Mar-1998). Include source gt/gt.c in the compiler-project.
subdirectory   html subdirectory  This very HTML documentation.
UNIX script   makefile  3 751 bytes  To compile ST under UNIX (LINUX, IRIX, OSX, etc.).
Binhexed self extracting archive for Mac   macCodeWarriorIDE4.0.sit.hqx  23 631 bytes  To compile ST with Metrowerks Codewarrior (IDE version 4.0 or higher) on Apple Macintosh.
subdirectory   pconv subdirectory  Containing spectroscopic database and the software to convert Kurucz's textfile to binary format. "pbin" stands for "Pieter's binary", to distinguish from the "bin"-format that Claas Heise (Hannover University) used and which is a different format. In case you're not interested in quantumphysics right now, but DO want to use 64 bit additive/granular synthesis, this part of ST is the easiest part to cut out.
ANSI C source   ST.c 6 453 bytes   Main source file, include it in the compiler-project.
ANSI C header   ST_aiff.h 1 386 bytes   Minimal source to write (not read) AIFF files to disk.
ANSI C source   ST_aiff.c 11 454 bytes  
ANSI C header   ST_engine.h 1 386 bytes   Private structure definitions, for internal use only.
ANSI C header   ST_score.h 1 169 bytes   To draws graphic scores of the music in JPEG-format.
ANSI C source   ST_score.c 14 331 bytes  
ANSI C header   ST_wavelets.h 5 474 bytes   64 bit integer DSP, wavetables, wavelet-management, overflow-handling.
ANSI C source   ST_wavelets.c 29 199 bytes  


How to install?

This software was developed on Silicon Graphics (IRIX 6.2 - 6.5 with MIPS and GCC compilers) and Apple Macintosh (OS7.6 - 9.1 with Metrowerks CodeWarrior version 4 - 6). I restrained to ANSI/ISO-C as much as possible so it should not be too hard to port to other platforms.
The code is supposed to work correctly on both little endians and big endians.
Notice your C-compiler needs a mathematical library with header <math.h>. Furthermore your C-compiler needs to support an integral 64 bit integer datatype, signed as well as unsigned, called long long and unsigned long long on most systems.

Unix:
linux penguin

Silicon Graphics
  After downloading, UNIX users may unzip the package and go to the source directory by typing:
  gunzip ST1.62.tar.gz
tar xf ST1.62.tar
cd ST1.62
Before invoking the supplied makefile, one may want to edit it (for example change gcc to cc, change CFLAGS, etc.). After manually configuring the makefile, compile and run ST by typing:
  make
./ST
This should yield a short AIFF-audiofile, two JPEG-scorefiles and an ASCII-logfile (not using any quantumphysical data yet). To run the spectroscopical examples, you should first get a correct binary version of Kurucz's database for your platform: go to the subdirectory pconv, perhaps make edits to the pconv/makefile, unzip Kurucz's textfile and compile and run pconv, remove pconv and pack the textfile again by typing:
  cd pconv
make
gunzip gfall.dat.gz
pconv
rm pconv
gzip gfall.dat
cd ..
When this all succeeds, ST can now access the database, and in its' main() you can now for instance call function c01_twoWeeks() instead of the simple c00_example1().
Apple:
Apple Macintosh   Use for example Stuffit Expander on the Macintosh to unzip and decode the downloaded package.
In case you have a Metrowerks CodeWarrior compiler (IDE version 4.0 or higher) at your disposal, you may use the supplied projectfiles in archive macCodeWarriorIDE4.0.sit.hqx to compile ST. Unpack the self extracting archive and leave the resulting directory in the same place.
To run the spectroscopical examples, you first have to build a binary version of Kurucz's database.
You may use the Metrowerks CodeWarrior projectfiles in archive pconv/codeWarriorIDE32.sea.hqx or pconv/codeWarriorIDE41.sea.hqx to compile the pconv program. After running pconv, ST can access the spectroscopic database.
On some Macintoshes I encountered the following problem:  file-type of the resulting AIFF-file appears to be set to "AIFC" by MacOS,... now SoundDesigner thinks it's a compressed file and cannot open it... hmmm,.. how annoying: I have to use ResEdit to change back the file-type to the intended "AIFF". Mac users may want to include a Macintosh-toolbox-call in the sourcecode to fix this.
Microsoft:
Microsoft   To run the spectroscopical examples, you first have to build a binary version of Kurucz's database. Get (and unpack) the text-version of Kurucz's file and compile and run the pconv program.
Notice binary ".pbin"-files may not be portable between big- and little endians. So don't throw away the text-version of Kurucz's file too soon, make a backup of it and you'll always be able to generate a new binary version of it (on a Mac :-).

Regardless of platform, only include the following sourcefiles in the compiler's ST-project:  ST.cST_aiff.cST_score.cST_wavelets.cgt/gt.cpconv/ST_more.pbin.c  and one or more composition sources from subdirectory comp
For the pconv-project only include sourcefile  pconv/pconv.c.


Some output examples:

Below, 13 nanotonal studies in soundscape-style are presented, all made with ST, and solely based on atomic spectra (they might thus as well be called spectroscopical studies). One can download the pieces, listen to them, and perhaps burn one's own audio-CD with them. These are all AIFF files, 16 bit, stereo, 44.1 KHz. On the right, one may recall some of the generated musical scores.


1   ST1.16HSmndljv   Mendelejev progression hydrogen to sulphur
(H He Li Be B C N O F Ne Na Mg Al Si P S)
6:30   65.7 MB   score
2   ST0.44twoWeeks   Alchemistic metals and ions
(Au Ag Fe Hg Sn Cu Pb -- Ag+ Fe+ Hg+ Sn+ Cu+ Pb+)
6:03   61.2 MB   score
3   ST1.14HOmndljv   Mendelejev progression hydrogen to oxygen
(H He Li Be B C N O)
3:42   37.4 MB   score
4   ST0.33AuGliss   Gold glissando  (Au) 1:13   12.4 MB   score
5   ST0.33AgGliss   Silver glissando  (Ag) 0:27   4.6 MB   score
6   ST0.33FeGliss   Iron glissando  (Fe) 0:33   5.7 MB   score
7   ST0.35energyH   Hydrogen horizontal smeared  (H) 1:00   10.1 MB   score
8   ST0.35togetherH   Hydrogen vertical  (H) 1:33   15.7 MB   (see energyH)
9   ST0.33AuAgGliss   Gold and silver glissandi  (Au Ag) 0:54   9.2 MB   score
10   ST0.07HOionErr   Hydrogen to oxygen staccato  (H He Li Be B C N O) 6:03   61.3 MB   (timing errors)
11   ST0.08HOionErr   Hydrogen to oxygen legato  (H He Li Be B C N O) 11:51   119.8 MB   (timing errors)
12   ST0.24week39   Week 39 octaves  (Au Ag Fe Hg Sn Cu Pb) 3:44   37.8 MB   (octave higher
  than ST0.26)
13   ST0.26week40   Week 40 octaves  (Au Ag Fe Hg Sn Cu Pb) 3:27   35.0 MB   score
   
 
 
    total:     47:00   474.4 MB  

Spectromorphological rules in studies ST0.07 and ST0.08 are the most fascinating. Listening to these pieces, one really feels submerged in the quantumphysical world. Actually these are 2 failures because in this early stage of the software timing-errors still occured. An unintended but beautiful morphology!
In studies ST1.14 and ST1.16, the periodic table is stepped through, element by element. In the last one, which continues up to sulphur, it becomes clear the applied morphology won't captivate when this process is continued - in the same manner - up to the 109th element. Almost terrifying sounds the transition nitrogen-oxygen-fluorine.
In ST0.24, ST0.26 and ST0.44 an alchemistic arrangement is chosen. (There exists a link between the 7 metals gold, silver, iron, mercury, tin, copper and lead, the 7 heavenly bodies sun, moon, mars, mercury, jupiter, venus and saturn, and the 7 days of the week.) The most complex and dense spectra come from iron and copper, exactly the 2 that respectively symbolize the masculine and the feminine.
The titles of the glissando-études (ST0.33xx) are deceptive because pitch-rise only occurs in discrete steps (quantum-leaps), so actually these are tone-scales. Remarkeble is the "cadence-quality" of these rising scales.

If you like these sounds, you may use them for your own purposes. It would then be nice if you credit me, but more important: please, never sell this music in unmodified form, nor include it in commercial software, CD-ROMs, DVDs, etc., for this quantumfysical music should remain free.
Give credit to Robert L. Kurucz who gathered and made available all this data!


To do:


Thanks to:


Pieter Suurmond, december 2, 2002