to Pieter's
software
index
Spectroscopic Toolkit
64-bit phase oscillators for nanotonal synthesis
hammer and rainbow
Pieter Suurmond
Utrecht School of the Arts,
faculty of Art, Media and Technology
PO box 2471, 1200 CL Hilversum, Netherlands
e-mail:  pieter.suurmond@kmt.hku.nl


Spectroscopic Toolkit offers 64-bit integer-DSP for massive additive synthesis. The software is not designed for realtime use, and it offers no graphical user interface. It produces audio files and graphic images - at its' own pace - and is therefore highly portable.

Spectroscopic Toolkit is open-source software for anyone interested in alchemy, electronic music composition and nanotones. The software translates spectroscopic data of atoms and ions to audio file. It can be applied in computer music composition to generate sounds as alchemistic symbols. Iron (Fe), for example, has an alchemistic link with the planet mars, the day tuesday and the masculine. Copper (Cu), on the contrary, is associated with the feminine, venus and friday. Remarkably, precisely these 2 metals (Fe and Cu) exhibit a very dense spectrum, as opposed to the other 5 (Au, Ag, Hg, Sn and Pb). One can observe this contrast in the studies twoWeeks and in Boog.

The software is written in platform-independant C. To use it, all you need is a C compiler. You may use the software to
  1. regenerate some of the musical studies invented by the author.
  2. develop your own nanotonal compositions / sounds.

Motivation and objectives

One-dimensional oscillating systems dominate music: string-instruments, wind-instruments, electronically repeated waveforms, etc., they all produce the natural overtones (approximate frequency ratios 1, 2, 3, 4, 5, etc.). Even Western theory of harmony is based on the first five prime numbers: 1, 2, 3, 5, 7 (where the latter (7) may be questionable).
An evenly 'natural' music can be derived from more complex oscillating systems in nature, like atoms and ions!

I developed this toolkit because other synthesis software (like CSound) did no longer suffice my needs. These requirements were:

How it works

ST works a bit like CSound: first a sorted score-list is generated, then the so called instruments are allocated and played, as long as they are active. The differences with CSound are that instruments are called WAVELETS and that they remain in memory rather than in a .sco file. In ST, there is no separate sorting routine (as in CSound), WAVELETS in the linked list structure maintain their order - based on starttimes - by use of the addWAVELET() function.
ST outputs a logfile, one or more graphic scorefiles, and an audiofile.
  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 and some wavetables.
  2. Algorithmic composition:
    A composition is created by putting wavelets into a linked list structure by some algorithm.
    See c00_example.c for 4 simple examples, or 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.
  3. Score rendering:
    Graphic scores of the music are generated in JPEG 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 only 4 wavetables: 1 for audio and 3 for subaudio. The following images were created by the visualiseTables() function:
  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 phase may be -1 (oscill sync), 0 (aligned sine) or 1 (aligned cosine).
  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 phase 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 phase must be 0.

Download

The latest version of Spectroscopic Toolkit may be downloaded from http://kmt.hku.nl/~pieter/SOFT/.
Click below, to download the gzipped tar file, containing all sourcefiles and documentation, as well as a copy of Kurucz' large spectroscopic database.
Download gzipped tar file...   ST1.86.tar.gz 18 MB   Spectroscopic Toolkit version 1.86, including Kurucz' database.

Unpack

After downloading, the package needs to be unzipped and untarred.
On Mac OS 7, 8 or 9, you can unpack with Stuffit Expander.
On Unix (including Mac OSX), one can unpack by typing:
        gunzip ST1.86.tar.gz
        tar xf ST1.86.tar
A new directory named ST1.86 should have been created by now.
In there, you find a fairly large textfile, which is Kurucz' spectroscopic database; a small README; and 2 subdirectories for documentation and C sources:
        ls -ls ST1.86

        8 -rw-r--r--  1 pieter user     3499 Sep 19 03:30 README
   171064 -rw-r--r--  1 pieter user 87582045 Jul 14  2002 gfall.dat
        8 drwxr-xr-x  2 pieter user     4096 Sep 22 02:27 html
        8 drwxr-xr-x  4 pieter user     4096 Sep 21 05:45 src

Configure

On Unix (Linux, OSX, Irix, etc), one may use the provided makefile to compile.
But before doing that, you may want to edit it: choose a different compiler (CC), change optimization flags (CFLAGS), etc.
On other platforms, where you cannot use makefiles (Mac OS 7, 8 or 9; MS Windows), put together a standard C project containing:

Compile

On Unix, change to the source directory and compile by typing:
        cd ST1.86/src
        make
When this succeeded, a binary executable named ST should have been created in the parent directory.
Notice your C compiler needs a mathematical library with header <math.h>. Furthermore, your C compiler needs to support 64-bit integers (signed as well as unsigned) as integral datatype (they are called long long and unsigned long long on most systems).

Run

Assuming you're still in the source directory, return to the parent directory and start the program by typing:
        cd ../
        ./ST 1000
This should yield a short AIFF file, two JPEG files and a logfile.
Samplesize and samplerate options may preceed the number. For example, command
        ./ST 24 48000 1002
instructs ST to generate a 24-bit output file with a samplerate of 48 kHz, rendering number 1002.
Ommiting the number or supplying invalid numbers prints usage and lists all valid numbers:
        ./ST

    Version ST1.86 by Pieter Suurmond, october 16, 2004.
    Parameter(s) missing!
    USAGE:  ST [bits] [samplerate] number 
    Bits may be 8, 16 or 24. Samplerate must be in Hertz.
    Use one of the following numbers as (last) parameter:
             0: Print usage and list numbers.
          1000: Example 0: Gaussians (using no database)     00:21.
          1001: Example 1: Clip test (using no database)     00:04.
          1002: Example 2: Overtones (using no database)     00:23.
          1003: Example 3: Phase test (using no database)    00:19.
          1004: Example 4: Exponent test (using no database) 01:31.
          1301: 'Mendelejev progression H to S' (study 2001) 06:55.
          1302: 'Two Weeks - alchemist metals' (study 2001)  06:03.
          1307: 'Hydrogen horizontally smeared' (study 2001) 01:04.
      20030001: 'Boog' (composition 2003 part 1)             05:09.
      20030002: 'Vogelbellen' (composition 2003 part 2)      07:59.
      20030102: 'Hydrogen Birds' (2002)                      08:10.
      20030202: 'Hydrogen and Helium+ Bells' (2003)          02:43.
Example numbers 1000 to 1004 don't need any quantumphysical data. But the first time ST does need it (when you supply numbers above 1300), it will pack textfile gfall.dat to binary format, creating a file named gfall.pbin.
Notice binary .pbin files may not be portable between platforms (especially not between big- and little endians).

Lossless compression ratio 1:22

Downloading 18 MB of source and then rendering all numbers locally yields in approximately 39 minutes of high quality audio on your harddisk. Even at CD-quality (but you can go beyond, with 24-bit 48kHz for example), this means you've accomplished a lossless compression ratio of 390/18 = 22 times! Much better than MP3, which is lossy anyway.

Some (older) 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!

Future work


Thanks to


License

Spectroscopic Toolkit version 1.86, october 18, 2004.
Latest version available at http://kmt.hku.nl/~pieter/SOFT/

Copyright (c) 2000-2004 - Pieter Suurmond

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Any person wishing to distribute modifications to the Software is requested to send the modifications to the original developer so that they can be incorporated into the canonical version.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Pieter Suurmond, october 18, 2004