Csound
Csound | |
---|---|
Basic data
|
|
Publishing year | 1986 |
Current version | 6.14.0 (January 27, 2020) |
operating system | GNU / Linux , Mac OS X , Windows , Android |
programming language | C. |
License | LGPL |
German speaking | No |
csound.github.io |
Csound is a Audio - programming . It was developed in the 1980s by Barry Vercoe at MIT's Electronic Music Studio , based on Max Mathews ' Music-N systems . The first publication is from 1986.
As an audio programming language, Csound is used both for sound synthesis (therefore also called a software synthesizer ) and for the modification of sounds (for example using filters, modulation, granulation or Fourier transformation). In the 1980s and 90s, Csound was mostly used to generate audio files; since the 2000s, csound has also been used for live electronics. The control signals required for real-time application are transmitted via MIDI , Open Sound Control (OSC) or the computer keyboard.
Compilation and execution
Written in the C programming language, Csound handles the compilation and execution sequence. The program written in Csound is first compiled. If the compilation is successful, the program can be executed.
The basic units of a Csound program are called "instruments" (denoted by numbers or names). Once compiled, they can be started or stopped at any time. Traditionally, this is done using an instruction list ("score" = score), but can just as easily be done in real time (via MIDI , OSC , keyboard), or by generating it within the program itself.
Examples
The following Csound instrument generates a sine tone of 415 Hertz with -12 dB and writes it to the output:
instr Sinus ; Beginn einer Instrumenten-Definition (Schlüsselwort 'instr')
aSinus poscil ampdbfs(-12), 415 ; Oszillator 'poscil' mit Argumenten rechts und Ergebnis links
out aSinus ; die Variable 'aSinus' wird als Audio-Signal herausgegeben
endin ; Ende der Instrumenten-Definition (Schlüsselwort 'endin')
Instead of this traditional notation, since Csound 6 it is also possible to write functionally (similar to Python and other languages):
instr Sinus
out(poscil(ampdbfs(-12), 415))
endin
To call this instrument one usually uses an XML -like file, which consists of three sections:
- the <CsOptions> options , which specify, for example, whether a sound is desired in real time or an audio file is to be written
- the instruments <CsInstruments>, i.e. the actual program text
- the score <CsScore>, i.e. calling up instances of the defined instruments.
The following file writes the output in real time (option '-o dac') to the audio card and calls the instrument "Sinus" twice:
<CsoundSynthesizer>
<CsOptions>
; Getestet mit: Csound version 6.07 (double samples) Mar 5 2016 unter Debian Linux
-o dac ; Output auf den Digital-to-Analog-Converter schreiben
</CsOptions>
<CsInstruments>
sr = 44100 ; Samplerate 44100 Hz (Signalrate für die Ausgabe)
ksmps = 32 ; Anzahl von Samples in einem Audio-Array (Blockgröße)
nchnls = 1 ; Anzahl der Ausgabekanäle (1 bedeutet Mono, 2 Stereo)
instr Sinus
out(poscil(ampdbfs(-12), 415))
endin
</CsInstruments>
<CsScore>
i "Sinus" 0 2 ; Instrument "Sinus" wird mit Startzeit 0 und Dauer 2 (Sekunden) gerufen
i "Sinus" 3 1 ; Instrument "Sinus" wird mit Startzeit 3 und Dauer 1 gerufen
</CsScore>
</CsoundSynthesizer>
If you want to activate this instrument via a MIDI keyboard instead, the score is released so that Csound runs after compilation and waits for real-time events. The following code determines the amplitude and frequency of the Csound instrument from the velocity and key number of the MIDI keyboard. In addition, an envelope curve is inserted so that the sound does not generate artifacts (clicks) at the beginning and end:
<CsoundSynthesizer>
<CsOptions>
-o dac ; Live Audio
-M a ; alle MIDI-Geräte benutzen / lesen
--midi-velocity-amp=4 ; Umformung der Velocity in Amplitude und Übergabe als Parameter 4 (p4) an das Instrument
--midi-key-cps=5 ; Umformung der Tasten-Nummer (MIDI Key) in Frequenz und Übergabe als Parameter 5 (p5)
</CsOptions>
<CsInstruments>
instr Sinus
aSinus = poscil(p4, p5) ; Anwendung der MIDI-Werte
out(linenr(aSinus,.1,.5,.01)) ; Hüllkurve mit 0.1 Sekunden Einblende und 0.5 Sekunden Ausblende
endin
</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>
Real-time events can also be generated from a Csound instrument itself. In the following example, each called instance calls a new instance of the instrument "Sinus", resulting in an endless chain. The independent generation of the start and duration results in some small overlays and some pauses.
<CsoundSynthesizer>
<CsOptions>
-o dac
</CsOptions>
<CsInstruments>
seed 0 ; Zufallszahlen werden bei jedem Durchlauf neu generiert
instr Sinus
aSinus = poscil(ampdbfs(random:i(-30,-6)), cpsoct(random:i(8,10))) ; Lautstärken -30..-6 dB, Tonhöhen Oktave 8..10
out(linen(aSinus,p3/10,p3,p3/2)) ; Ton wird mit Hüllkurve herausgegeben
schedule("Sinus",random:i(1,3),random:i(1,5)) ; neue Instanz wird gerufen (Start 1..3, Dauer 1..5 Sekunden)
endin
schedule("Sinus",0,3) ; erster Aufruf des Instruments, danach Selbstgenerierung
</CsInstruments>
</CsoundSynthesizer>
Front ends
Various frontends are available today to write Csound code, to compile it, to call an instance of Csound and to manage real-time events. Calling Csound on the command line is classic . If, for example, the last example is saved as a plain text file under the name "endlos.csd", it can be executed in a terminal on Linux, Mac or Windows as follows:
csound endlos.csd
There are also integrated development environments that offer syntax highlighting and graphic user interfaces. The most common is currently CsoundQt, but Cabbage and Blue also show their own environments for specific alignments. For Android , Csound is offered with a slim GUI and options for integrating HTML5 widgets . There are various apps for iOS that use Csound or enable Csound programs to be played.
The most flexible integration of Csound offers the API . The Csound Engine (essentially an audio library ) is called and controlled via a different programming language. There are bindings for C , C ++ , Python , Java (including Scala and Clojure ), JavaScript , C # , Common Lisp and others.
Web links
- csound.github.io - official community website with links to downloads, documentation, fontends etc.
- CsoundQt - graphical front end developed in Qt
- Blue - Java-based graphic development and composition environment
- Cabbage - a graphical development environment designed to generate VST plugins
- en.flossmanuals.net - Csound in the FLOSS Manuals collection
- Csound: A C-Based Audio Programming Language - old community site with FAQ , manuals, programming examples and additional programs; currently no longer maintained
- Csound project on SourceForge .net with download files
- Richard Boulanger: the csound TOOTorials (English)
- Richard Boulanger: Introduction to Sound Design in Csound . The Csound Book, Chapter 1 (English)
- Michael Gogins »Csound Downloads - PDF tutorials on CSound and algorithmic composition with CSound and the extension CsoundAC Python
- The Csound Tutorials . Beginners seminar, starts with A Beginning Tutorial by Barry Vercoe the inventor of Csound
- Jens Groh: What is Csound? Introduction to the forum for experimental music and computers
- Peter Kiethe: What is Csound . In: ZeM , issue No. 23, spring 2000, p. 4 ff. (Center for Electronic Music e.V. )
- csconf2011 - Videos from the 1st International Csound Conference in Hanover, 2011
- csconf2015 - Videos from the 3rd International Csound Conference in St. Petersburg, 2015
Individual evidence
- ↑ Csound 6.14.0 Csound Community
- ^ Richard Boulanger: The Csound Book. MIT Press, 2000, pp. Xxix.
- ↑ Recompiling an instrument while Csound is running is also possible since Csound 6 ("Live Coding")
- ↑ CsoundQt
- ↑ Cabbage
- ^ Blue
- ↑ csound.github.io
- ↑ http://csound.github.io/docs/api/index.html