2008/05/12

The Labs.Com Sound Lab SoundArt
Last update 2006/10/10
The Labs - Design & Functionality For The Net

Package to Design and Compose Sounds

In the tradition of PicArt we present SoundArt, a script-based sound-design language which is meant design and compose simple sounds, not music.
  1. Introduction
  2. Interpreter
  3. Examples
  4. Download
  5. Tones & Frequencies
  6. Samples & Loops
SoundArt
1. Introduction
SoundArt is meant as package to write a small codebase to define a sound, a tone. It is not meant to compose music-pieces, but solely to design a sound. The approach taken is a simple stack-oriented language alike PostScript or PicArtScript.

This example illustrates SoundArt quite well, on the left the "eletrical/symbolic" approach, two oscillators whereas one is scaled, and then both signals added; SoundArtScript in white letters, and the resulting analog signal.

SoundArt
2. Interpreter

Language
 The SoundArtScript language is based on a very simple stack-based interpreter language, it is parsed and converted in a fast format which then is called 44,100 times a second to construct the tone you defined with various oscillators.

Tokens:

  • Operands: <float>, e.g. 2.1, 1, 1e3
  • Operators: +, * etc.
  • Oscillators: sine, pulse etc.
  • Effects: delay etc.
  • Comment: # which indicates a comment til end-of-line

Oscillators
 

In:Command:Out:Description:
freqsinevsine-oscillator
freqpulsevpulse-oscillator
freqsawvsaw-oscillator

The output of all oscillators are values between -1.0 .. +1.0. freq is in Hz, or a note: C, C#, D, D#, E, F, F#, G, G#, A, A#, B (default octave 4): A is equal A4 which is 440Hz, or C#3, A2, etc. (see section below on Tones & Frequencies).

More oscillators to come, also WAV files to include.

Filters & Effects
 

In:Command:Out:Description:
 noisevnoise
timedelayvdelay (time in secs)

More effects and filters to come.

Numerical Functions
 

In:Command:Out:Description:
a b+cadd two numbers c=a+b
a b-csubstract two numbers c=a-b
a b*cmultiply two numbers c=a*b
a b/cdivide two numbers c=a/b
a=ba=a*.5+.5 (convert -1..+1 -> 0..1)
adupa aduplicate one number
a bexchb aexchange two numbers on stack

SoundArt
3. Examples

Simple Tone
 

 400 sine 

creates a 400Hz sine tone, try this code:

 echo "400 sine" | ./soundart - 

Pulsating Tone
 

 10 pulse =    
    400 sine * 

The first line defines a 10Hz pulse, the = is required to convert the -1..+1 to 0..-1 (the same as 0.5 * 0.5 +). The 2nd line defines again the 400Hz sine tone, and the last * mixes (multiplies) the pulse with the 400Hz tone, result is a 400Hz busy-phone-line like tone.

Octave
 

 C4 sine   D4 sine   E4 sine   F4 sine  
 G4 sine   A4 sine   B4 sine   C5 sine  

This runs 8 oscillators, soundart automatically sums them up and rescales them.

Pulsating Tone with Echo
 

 10 pulse =                             # pulsation 
     1 sine 400 * 100 + 400 + pulse *  # varying pitch 
        .5 *                            # half amplitude 
             dup .05 delay .6 * +       # add 0.05s delayed 
             dup .03 delay .6 * +       # add 0.03s delayed 

the indentation is just done for viewability, you could just make it an one-liner as well.

More complex examples to come.

SoundArt
4. Download

soundart.tar.gz Version 0.004 (May 9, 2001).

Supported platforms: FreeBSD, Linux, check the README

This is a very early state software (considered ALPHA), so don't expect too much about stability.

Usage
 

 USAGE: [-trace] [-duration <secs>] [-wav <filename>] <file> 

If file is defined as '-' then stdin the source-code should be provided:

    echo "400 sine" | ./soundart -  

With an existing source-code (test.sa):

    ./soundart test.sa 

To write a WAV-file:

    ./soundart -wav test.wav test.sa 

SoundArt
5. Tones & Frequencies

Since the input for oscillators are in Hz, you may want to know about how notes relate to frequencies. one octave: C, D, E, F, G, A, B

A4 has been adapted as 440Hz.

Pythagorean Scale
 C=f, D=9/8f, E=81/64f, F=4/3f, G=3/2f, A=27/16f, B=243/128f

By Backus, John. The Acoustical Foundations of Music. 2nd ed. New York: W.W. Norton and Co., 1977 *)

therefore C4 = A4*16/27 = 260.740Hz, C1 = 260.740Hz / 8 = 32.592 (division by 8 means minus 3 octaves (23 = 8)), fbase = C1 = 32.592Hz

For several octaves this gives:

xoct = ratio[x] * fbase * (1<<(oct-1))
whereas x = { C, D, E, F, G, A, B }, oct = { 1..n },
ratio = { 1., 9./8., 81./64., 4./3., 3./2., 27./16., 243./128. }

Well Tempered
 
xoct = 2 (x / 12) * fbase * (1<<(oct-1))
whereas x = { C = 0, C# = 1, D = 2, D# = 3, E = 4, F = 5, F# = 6, G = 7, G# = 8, A = 9 , A# = 10, B = 11 }, oct = { 1..n },

More Infos
 
Mathematics of Music by Jack H. David Jr.
Excellent overview
Making Music by Brian Lukoff
Good intro with excellent bibliography

Additional to freq you also can use the tones with octave (default octave 4) like:

 A sine 

which is the same as "A4 sine" which corresponds to "440 sine" then.

SoundArt
6. Samples & Loops

OpenDirectory: Sample & Loops
List of sites providing samples

                                                                                                                                   

Raw Sound Studio Sound LabViaVoice

Last update 2006/10/10

All Rights Reserved - (C) 1997 - 2008 by The Labs.Com

Top of Page

The Labs.Com