Thursday, July 27, 2006
heres a little bit of a reference for pmask for using csound with python beta copy of a refrence that is
I started to look into pmask to see if there are any worthwhile routines
first thing about the requirements In order to use OMDE/pmask you need Python 2.0 or higher.
In order to use omde.plot you need PIDDLE. I don't know that I want to mess around
with graphing with piddle but I will look into it to see if it is worthwhile.
looks like the routines in csound.py require omde and in the notes are not refered to as
piddle for the mapping routines and there is alot of mention of spots.. Also generation
or orc files. (this makes alot more sence then the combined .csd files for building
aplications). Clearly the pmask reference by itself leaves alot to be desired here is a little bit in a disorganised unedited way to get you started
PMASK Library
The example makes it a little easier to see how to use the library than the pmask library.
from omde.csound import read_score, save, Tempo
score = read_score('trivialcloud2.sco')
score.timewarp(Tempo((0, 60), (5, 60), (5, 320), (10, 120)))
save('timewarped.sco', score)
there doesn't appear to be a trivialcloud2.sco in the folder first steps you will need to run
trivialcloud2.py to get the .sco file used for trivialcloud1.py strange enough.
read_score(FILENAME) reads a .sco file (filename can be defined with quotes or with a variable)
save(filename,file)
The usage of tempo is not so certain so we will skip it for now.
OMDE LIBRARY
import omde.pmask, omde.csound
score = omde.pmask.cloud(0, 10, 1, 1.0, 0.4, 60, 261)
omde.csound.save('trivialcloud.sco', score)
Another short example
# trivialcloud2
import omde.pmask, omde.csound
from omde.bpf import LinearSegment
begin, end = 0, 10
level = LinearSegment((begin, 40), (end, 80))
frequency = LinearSegment((begin, 261), (end, 261*2))
score = omde.pmask.cloud(begin, end, 1, 1.0, 0.4, level, frequency)
omde.csound.save('trivialcloud2.sco', score)
This example is called example1 and it is in the main example folder
#!/usr/bin/env python
# Copyright (C) 2001, Maurizio Umberto Puxeddu
from omde.csound import I, ScoreSection, save, stdout
n1 = I(1, 5.0, 3.0)
n2 = I(2, 3.3, 18.8)
a1 = ScoreSection(n1, n2)
stdout.write(a1)
n1.onset(5.1)
stdout.write(a1)
save('pippo.sco', a1)
This is an example called read_score in the examples folder
#!/usr/bin/env python
import sys
import omde.csound
if len(sys.argv) != 2:
print 'Usage: read_score [score file name]'
sys.exit(1)
a = omde.csound.read_score(sys.argv[1])
print a
omde.csound.stdout.write(a)
This is another short example called bells3.py
#!/usr/bin/env python
import omde.pmask, omde.csound
from omde.miscellaneous import Accumulator, Range
density = Accumulator(Range(-0.2, 0.2), 'limit', 0.01, 1.0)
duration = Accumulator(Range(-0.1, 0.1), 'reflect', 0.1, 1.5, 0.5)
frequency = Accumulator(Range(-50, 100), 'wrap', 200, 2000, 300)
panorama = Range(0, 1)
score = omde.pmask.cloud(0.0, 10.0, 1, density, duration, frequency, 3.0, panorama)
omde.csound.save('bells3.sco', score)
this has the omde library that requires piddle.
score= omde.pmask.cloud(0,10,1,1.0,0.4,60,261)
score = omde.pmask.cloud(begin, end, 1, 1.0, 0.4, level, frequency) ( a little more obvious hopefully)
score = omde.pmask.cloud(0.0, 10.0, 1, density, duration, frequency, 3.0, panorama)
import omde.csound
omde.csound.save(filename,file)
inport from omde.csound save
save(filename, file)
import omde.csound
Usage: read_score [score file name]
a = omde.csound.read_score(sys.argv[1])
from omde.miscellaneous import Mask
density = Mask(UniformRandom(), PS((0.0, 0.03), (20.0, 0.5), exp=3.0), PS((0.0, 0.08), (20.0, 1.0), exp=3.0)) (ps is powersement)
from omde.csound ScoreSection
ScoreSection.add(line of .sco file) // this line was score ScoreSection() so the line may be wrong
a1 = ScoreSection(n1, n2)
(this is from bells 2)
score = ScoreSection()
score.add(cloud(0.0, 10.0, 1, density, duration, frequency, 3.0, panorama))
a1 = ScoreSection(n1, n2)
import I
not realy clear what this does in the example. I defines the score
n1 = I(1, 5.0, 3.0)
n2 = I(2, 3.3, 18.8)
inport score section
a1 = ScoreSection(n1, n2)
this is not realy that clear either. looks like the lines are combined for a .sco file
stdout.write(a1)
This comand writes a .sco file to something
first thing about the requirements In order to use OMDE/pmask you need Python 2.0 or higher.
In order to use omde.plot you need PIDDLE. I don't know that I want to mess around
with graphing with piddle but I will look into it to see if it is worthwhile.
looks like the routines in csound.py require omde and in the notes are not refered to as
piddle for the mapping routines and there is alot of mention of spots.. Also generation
or orc files. (this makes alot more sence then the combined .csd files for building
aplications). Clearly the pmask reference by itself leaves alot to be desired here is a little bit in a disorganised unedited way to get you started
PMASK Library
The example makes it a little easier to see how to use the library than the pmask library.
from omde.csound import read_score, save, Tempo
score = read_score('trivialcloud2.sco')
score.timewarp(Tempo((0, 60), (5, 60), (5, 320), (10, 120)))
save('timewarped.sco', score)
there doesn't appear to be a trivialcloud2.sco in the folder first steps you will need to run
trivialcloud2.py to get the .sco file used for trivialcloud1.py strange enough.
read_score(FILENAME) reads a .sco file (filename can be defined with quotes or with a variable)
save(filename,file)
The usage of tempo is not so certain so we will skip it for now.
OMDE LIBRARY
import omde.pmask, omde.csound
score = omde.pmask.cloud(0, 10, 1, 1.0, 0.4, 60, 261)
omde.csound.save('trivialcloud.sco', score)
Another short example
# trivialcloud2
import omde.pmask, omde.csound
from omde.bpf import LinearSegment
begin, end = 0, 10
level = LinearSegment((begin, 40), (end, 80))
frequency = LinearSegment((begin, 261), (end, 261*2))
score = omde.pmask.cloud(begin, end, 1, 1.0, 0.4, level, frequency)
omde.csound.save('trivialcloud2.sco', score)
This example is called example1 and it is in the main example folder
#!/usr/bin/env python
# Copyright (C) 2001, Maurizio Umberto Puxeddu
from omde.csound import I, ScoreSection, save, stdout
n1 = I(1, 5.0, 3.0)
n2 = I(2, 3.3, 18.8)
a1 = ScoreSection(n1, n2)
stdout.write(a1)
n1.onset(5.1)
stdout.write(a1)
save('pippo.sco', a1)
This is an example called read_score in the examples folder
#!/usr/bin/env python
import sys
import omde.csound
if len(sys.argv) != 2:
print 'Usage: read_score [score file name]'
sys.exit(1)
a = omde.csound.read_score(sys.argv[1])
print a
omde.csound.stdout.write(a)
This is another short example called bells3.py
#!/usr/bin/env python
import omde.pmask, omde.csound
from omde.miscellaneous import Accumulator, Range
density = Accumulator(Range(-0.2, 0.2), 'limit', 0.01, 1.0)
duration = Accumulator(Range(-0.1, 0.1), 'reflect', 0.1, 1.5, 0.5)
frequency = Accumulator(Range(-50, 100), 'wrap', 200, 2000, 300)
panorama = Range(0, 1)
score = omde.pmask.cloud(0.0, 10.0, 1, density, duration, frequency, 3.0, panorama)
omde.csound.save('bells3.sco', score)
this has the omde library that requires piddle.
score= omde.pmask.cloud(0,10,1,1.0,0.4,60,261)
score = omde.pmask.cloud(begin, end, 1, 1.0, 0.4, level, frequency) ( a little more obvious hopefully)
score = omde.pmask.cloud(0.0, 10.0, 1, density, duration, frequency, 3.0, panorama)
import omde.csound
omde.csound.save(filename,file)
inport from omde.csound save
save(filename, file)
import omde.csound
Usage: read_score [score file name]
a = omde.csound.read_score(sys.argv[1])
from omde.miscellaneous import Mask
density = Mask(UniformRandom(), PS((0.0, 0.03), (20.0, 0.5), exp=3.0), PS((0.0, 0.08), (20.0, 1.0), exp=3.0)) (ps is powersement)
from omde.csound ScoreSection
ScoreSection.add(line of .sco file) // this line was score ScoreSection() so the line may be wrong
a1 = ScoreSection(n1, n2)
(this is from bells 2)
score = ScoreSection()
score.add(cloud(0.0, 10.0, 1, density, duration, frequency, 3.0, panorama))
a1 = ScoreSection(n1, n2)
import I
not realy clear what this does in the example. I defines the score
n1 = I(1, 5.0, 3.0)
n2 = I(2, 3.3, 18.8)
inport score section
a1 = ScoreSection(n1, n2)
this is not realy that clear either. looks like the lines are combined for a .sco file
stdout.write(a1)
This comand writes a .sco file to something