First steps with OMDE/pmask

Here you can learn how to face simple problems with OMDE/pmask.

Some of the examples in this chapter are so simple that I probably would't use OMDE/pmask myself in real life if that was the only problem. Their aim is just to illustrate some basic operations and concepts.

A trivial cloud

Althought the term "cloud" is never used in the original Cmask documentation, using Cmask you just make clouds of sound events. This mean that you create a group of sound events controlling their parameters globally. You don't even control exactly the number of events in the cloud but only the cloud temporal extension.

Traditional configuration of events can be considered as special cases of stocastic clouds, where the parameters of single events are exactly specified. If fact we are going to build a sequence of identical events.

Let's say we have a simple Csound orchestra like this:

; trivialcloud.orc


giSinusoid	ftgen	0,	0, 8192, 10,	1

instr 1

	iDuration	=	p3
	iAmplitude	=	ampdb(p4)
	iFrequency	=	p5

	kAmplitude	linen	iAmplitude, 0.1, iDuration, 0.1	
	aSignal		oscil	iAmplitude, iFrequency, giSinusoid

			out	aSignal


then, this is the python code (using OMDE/pmask) needed to generate a 10 second long sequence of beeps at 1 second interval. Each sound is a 261 Hz, 0.4 seconds, 60 dB beep.

import pmask, omde.csound

score =, 10, 1, 1.0, 0.4, 60, 261)'trivialcloud.sco', score)

The most interesting line of this simple snippet is the second one

score = cloud(0, 10, 1, 1.0, 0.4, 60, 261)

The first two parameters passed to are the start time and the end time of the cloud: our cloud starts at zero seconds and ends at 10 seconds.

The third parameter is the instrument number: instr 1. cloud() is not limited to generate csound I-statements but if the third parameter is a integer, it is exacly what it does.

The fourth parameter is the dispacement of successive events on the time axis (1 sec in our example). Pmask's documentation refer to this parameter as "density" but it is not a density at all. A temporal density is the frequence which is dimensionally the inverse of a time. This parameters is a time interval and the OMDE/pmask documentation refers to it as dt.

From the fifth parameter on we have the same parameters as we would pass them to instr 1: duration (0.4 seconds), level (60 dB), frequency (261 Hz).

With this line we created our trivial cloud and stored it in the object score. We can use this object to operate further transformations on the cloud but now we just want to get a standard numeric score file so that we can render it with Csound. The third line in the script does it:'trivialcloud.sco', score)

By running our OMDE/pmask script we'll get a trivialcloud.sco file, containing the Csound scorefile, in the current directory. This file will be something like:

i 1 0 0.4 60 261 i 1 1.0 0.4 60 261 i 1 2.0 0.4 60 261 i 1 3.0 0.4 60 261 i 1 4.0 0.4 60 261 i 1 5.0 0.4 60 261 i 1 6.0 0.4 60 261 i 1 7.0 0.4 60 261 i 1 8.0 0.4 60 261 i 1 9.0 0.4 60 261


Even if you are accustomed to writing Csound score using an auxiliary language, it's worth to remember that if you change something in the script you have to run it to affect the real score file. This may sound like a pedantic warning but it's too much easy to forget it. At least, I do it sometimes.

Before we leave the trivial cloud example, let's say something about the first line in our script:

import pmask, omde.csound

it says to Python that we'll soon need the specified external components pmask and omde.csound. In the Python's lingo they are called "modules" and are containers of classes, objects and functions that are not part of the core of the language. A module (omde or pmask) may also contain other sub-modules: in this case it is called "package".

In general each module is dedicated to a specific service. Here we are loading pmask, which is the package dedicated to the algorithmic composition la Cmask, and omde.csound, including Csound specific services in OMDE.

If you want to read more about Python module and packages go to the appendix A or directly to the Python language documentation.