Algorithms

No posts found.

Csound argument mapping

Performing a qua­drat­ic map­ping using 3 points: how can we make sure that the func­tion will be monotonous?

This is part of doc­u­ment “Check of Bol Processor ‘BP3’ with PHP inter­face” on the “Bol Processor” web­site.

The algo­rithm is imple­ment­ed in func­tion Findabc() of "CsoundMaths.c".


When three pairs of input/output val­ues are sup­plied, BP2 attempts to define a qua­drat­ic map­ping from the input (x) to out­put (y).

This is an exam­ple of a suc­cess­ful mapping: 

BP2 expects the map­ping func­tion to be monot­o­nous, i.e. the three val­ues (x1, x2, x3) sup­plied as the input and the ones sup­plied as the out­put (y1, y2, y3) must be strict­ly ordered. Even in this case a prop­er qua­drat­ic map­ping may not be pos­si­ble. See for instance: 

Here the qua­drat­ic func­tion is not monot­o­nous even though the input val­ues are ordered prop­er­ly. In this case, BP2 replaces the incor­rect part (the one con­tain­ing an extremum) with a lin­ear func­tion, and changes the oth­er part to make the curve tan­gent to the lin­ear part. This yields the graph shown below: 


Bol Processor BP3

BP3 is the multi-platform ver­sion of the Bol Processor that has been in devel­op­ment since 2020. It con­sists of two modules:

  • A con­sole writ­ten in C lan­guage for cross-platform com­pi­la­tion, con­tain­ing the core algo­rithms of the Bol Processor
  • An inter­face that allows non-technical users to edit or cre­ate spe­cif­ic mate­r­i­al (gram­mars, sound-objects, Csound instru­ments) and inter­act with the con­sole to pro­duce Bol Processor scores, MIDI files, Csound scores and real-time MIDI output/input.

Currently, the inter­face has been built in the HTML5/JavaScript/PHP envi­ron­ment which makes it pos­si­ble to work with the Bol Processor on any web brows­er. The set­up works in dif­fer­ent envi­ron­ments (MacOS X, Windows, Linux, etc.) but it requires the instal­la­tion of a local Apache/PHP serv­er.

Follow the instruc­tions on the Bol Processor ‘BP3’ and its PHP inter­face page to install the lat­est version.

stand­alone ver­sion com­piled from the PHP/JavaScript pack­age is about to be released.

No posts found.

Two algorithms

Two algo­rithms for the instan­ti­a­tion of struc­tures of musi­cal objects

This is an extend­ed and revised ver­sion of the paper: Symbolic and Sonic Representations of Sound-Object Structures pub­lished in M. Balaban, K. Ebcioglu & O. Laske (Eds.) “Understanding Music with AI: Perspectives on Music Cognition”, AAAI Press (1992, p. 64-109).

A rep­re­sen­ta­tion­al mod­el of dis­crete struc­tures of musi­cal objects at the sym­bol­ic and sono­log­i­cal lev­els is intro­duced. This mod­el is being used to design com­put­er tools for rule-based musi­cal com­po­si­tion, where the low-level musi­cal objects are not notes, but “sound-objects”, i.e. arbi­trary sequences of mes­sages sent to a real-time dig­i­tal sound processor.

“Polymetric expres­sions” are string rep­re­sen­ta­tions of con­cur­rent process­es that can be eas­i­ly han­dled by for­mal gram­mars. These expres­sions may not con­tain all the infor­ma­tion need­ed to syn­chro­nise the whole struc­ture of sound-objects, i.e. to deter­mine their strict order in (sym­bol­ic) time. In response to this, the notion of “sym­bol­ic tem­po” is intro­duced: the order­ing of all objects in a struc­ture is pos­si­ble once their sym­bol­ic tem­pos are known. Rules for assign­ing sym­bol­ic tem­pos to objects are there­fore pro­posed. These form the basis of an algo­rithm for inter­pret­ing incom­plete poly­met­ric expres­sions. The rel­e­vant fea­tures of this inter­pre­ta­tion are commented.

An exam­ple is giv­en to illus­trate the advan­tage of using (incom­plete) poly­met­ric rep­re­sen­ta­tions instead of con­ven­tion­al music nota­tion or event tables when the com­plete descrip­tion of the musi­cal piece and/or its vari­ants requires dif­fi­cult cal­cu­la­tions of durations.

Given a strict order­ing of sound-objects, sum­marised in a "phase table" rep­re­sent­ing the com­plete poly­met­ric expres­sion, the next step is to com­pute the times at which mes­sages should be sent. This requires a descrip­tion of "sound-object pro­to­types" with their metric/topological prop­er­ties and var­i­ous para­me­ters relat­ed to musi­cal per­for­mance (e.g. "smooth" or "stri­at­ed" time, tem­po, etc.). These prop­er­ties are dis­cussed in detail, and a time-polynomial con­straint sat­is­fac­tion algo­rithm for the time-setting of sound objects in a poly­met­ric struc­ture is intro­duced. Typical exam­ples com­put­ed by this algo­rithm are shown and discussed.

Download this paper (PDF)

Presentations

No posts found.

Cambridge poster

Is text an ade­quate tool for mod­el­ling musi­cal analy­sis, com­po­si­tion and performance?

This poster was pre­sent­ed at the con­fer­ence Language and Music as Cognitive Systems in Cambridge (UK), on 11-13 May 2007.

Download the poster (20 Mb PDF)

Shapes in Rhythm

This com­po­si­tion was part of the chore­o­graph­ic work CRONOS cre­at­ed by Andréine Bel and per­formed at the National Centre for the Performing Arts (Mumbai, India) and the Shri Ram Center (Delhi) in October 1994.

The fol­low­ing gram­mar "-gr.ShapesInRhythm" was writ­ten (in about 2 days) by Andréine and Bernard Bel.

There were six dancers on the stage: Smriti Mishra, Olivier Rivoirard, Vijayshree Chaudhary, Arindam Dasgupta, Somenath Chatterjee and Suresh Shetty.

The musi­cal struc­ture con­sists of 9 parts using very dif­fer­ent sound patch­es played on Roland D-50 syn­the­sis­er with a Musitronics exten­sion card. Each part is based on the rhyth­mic struc­ture of a tihai: three equal rep­e­ti­tions of a rhyth­mic pat­tern, inter­spersed with two equal rests, with the con­straint that the last unit must fall on the first beat of the rhyth­mic cycle. The cycle has 16 beats, or tin­tal in North-Indian music/dance. Tihais are basic fig­ures of Kathak dance and tabla drumming.

On an old Mac IIci, this would take 14 min­utes to pro­duce and time! For this rea­son, sub­gram­mar instruc­tions have been opti­mised: instead of the stan­dard "RND" mode, "ORD" has been used wher­ev­er pos­si­ble, oth­er­wise "SUB1", whose process is a unique "par­al­lel" rewrite of the work string.

Playing the piece required a 30-millisecond quan­ti­za­tion set­ting which reduced the size of the phase table by a fac­tor of 222. See Complex ratios in poly­met­ric expres­sions for a detailed explanation.

At the time this gram­mar was writ­ten, BP2 did not sup­port artic­u­la­tion or glos­saries. This gram­mar has high­light­ed the need for such features.

Smooth time and time pat­terns (with time-objects t1, t2 and t3) were used because the dancers expect­ed the first sec­tions to start slow­ly and speed up. Thus, the com­po­si­tion starts at metronome 60, con­tin­ues at metronome 80 and ends at 88. In this com­po­si­tion, how­ev­er, stri­at­ed time would be a much bet­ter option because speed changes can be man­aged using the "_tempo()" tool: for­get time pat­terns, set the metronome to 88 and insert _tempo(60/88) then _tempo(80/88) and final­ly _tempo(1) to change speeds. This work was an incen­tive to imple­ment the "_tempo()" per­for­mance tool…

Click this link to dis­play the score of this piece. 
“Shapes in Rhythm” com­posed by Andréine Bel and played by the Bol Prorcessor on a Roland D-50 syn­the­sis­er (1994)

Video at the bot­tom of this page.

TIMEPATTERNS:
t1 = 88/60 t2 = 88/80 t3 = 1/1

ORD
_mm(88.0000) _smooth
GRAM#1[1] S --> Route script(Beep) _script(Wait for space) Part1 Gap12 Part2 Gap23 Part3 Gap34 Part4 Gap45 Part5 Gap56 Part6 Gap67 Part7 Gap78 Part8 Gap89 Part9
GRAM#1[2] Part1 --> _script(Tick cycle OFF) Route - _vel(127) _script(Tick cycle ON) _script(Reset tick cycle) {Tp1 Tp1 Tp1 Tp1 Tp1 Tp1 Tp1 Tp1, P1} {Tp1,Accord5,sol4 15}
GRAM#1[3] Part2 --> Sablier _vel(127) {Tp2 Tp2 Tp2 Tp2 Tp2, P2}{Tp3,Dha1 15} GRAM#1[4] Part3 --> Maison _vel(35) {Tp3 Tp3 Tp3 Tp3, P3}_vel(45){Tp3,Dha5} GRAM#1[5] Part4 --> Toit _vel(127){Tp3 Tp3 Tp3 Tp3 Tp3 Tp3, P4}
GRAM#1[6] Part5 --> Drapeau _vel(70){Tp3 Tp3 Tp3 Tp3, P5}{Tp3,Chhe 15}
GRAM#1[7] Part6 --> CerfVolant _vel(127){Tp3 Tp3 Tp3 Tp3, P6}{Tp3,Tin ---}
GRAM#1[8] Part7 --> Guimbarde _vel(127){Tp3 Tp3 Tp3 Tp3, P7} PedalOn {Tp3,Dha4 15}
GRAM#1[9] Part8 --> Hippocampe _vel(90){Tp3 Tp3 Tp3, P8}{Tp3,la5 31} GRAM#1[10] Part9 --> VaisseauVolant _vel(90) {Tp3 Tp3 Tp3 Tp3 Tp3 Tp3 Tp3 Tp3 Tp3 Tp3 Tp3 Tp3 Tp3 Tp3 Tp3 Tp3 t3 t3 t3 t3, P9}
GRAM#1[11] Gap12 --> _vel(80) Conque {Tp2,- _pitchbend(0) _pitchcont _mod(0) _modcont si3____ mod(16383) _pitchbend(8192) Sablier -} _mod(0)
GRAM#1[12] Gap23 --> Maison {Tp3,16,_vel(2) _velcont - fa3 _ mi3 fa#3 fa3 mi3 sol3 fa3 sol#3 do3 _ _ _ _ vel(40)}
GRAM#1[13] Gap34 --> Toit _vel(100) {Tp3,- sol#2 sol#2 sol#2 }
GRAM#1[14] Gap45 --> Toit _vel(100) {Tp3 Tp3, - sol2 - sol2 sol2 - sol2 Drapeau -}
GRAM#1[15] Gap56 --> CerfVolant _vel(60) {Tp3,- {6,do4,- do5} -}[{Tp3,PedalOn _vel(50) _velcont do2 sol#2 fa#2 do#3 PedalOff - _vel(90)}]
GRAM#1[16] Gap67 --> Guimbarde {Tp3,{_vel(40) do3__,vel(40) _velcont -fa3 fa3 vel(60), ---fa2}}
GRAM#1[17] Gap78 --> {Tp3,7 PedalOff -}
GRAM#1[18] Gap89 --> _vel(110) Michiko {Tp3, - PedalOn _press(0) _presscont _pitchbend(8192) _pitchcont re5_____ _press(127) _pitchbend(12000) - PedalOff}_pitchbend(8192)_press(0)
// Here we used the real val­ues of pitch­bend. Usually it is eas­i­er to use cent val­ues but this wasn't yet imple­ment­ed.

SUB1
GRAM#2[1] P1 --> {16,8 Vi4,Accord1} {16,{8,So8} {8,Ar12},Accord2} {16,{8,Sm16}{8,Su24}} {16,{8,Ol32}{8,An48}
GRAM#2[2] Accord1 --> do2
GRAM#2[3] Accord2 --> do2
GRAM#2[4] Accord5 --> do2

SUB1
GRAM#3[1] P2 --> Down12345 S5 Up12345 S5 Down12345 S5 Up12345 S5 Down12345 S3 Up12345 S3 Down12345 S3 Up12345 S3 Down12345 - Up12345 - Down12345 - Up12345 - Down12345 Up12345 Down12345 Up12345 Dha1 - Down12345 Up12345 Down12345 Up12345 Dha1 - Down12345 Up12345 Down12345 Up12345
GRAM#3[2] Down12345 --> si5 sol5 fa#5 mi5 re#5
GRAM#3[3] Up12345 --> si4 re#5 mi5 fa#5 sol5
GRAM#3[4] S5 --> -----
GRAM#3[5] S3 --> ---

SUB1
GRAM#4[1] P3 --> P3T1 Dha3 P3T2 Dha4 {P3T1,P3T3}
GRAM#4[2] P3T1 --> {3,do4 do5 do3 do3 do3 do3} {3, do#3 re3 la3 la#4 sol3 sol#4 do#4 do5 do3}{3,do#3 fa3 re#4 la#4 fa#3 sol4 mi4 la4 la#3 do5 re3 fa#3}{1,sol4 fa4}
GRAM#4[3] Dha3 --> sol#4
GRAM#4[4] P3T2 --> {3,do#4 do5 do#3 fa3 mi4 la4} {3,si3 do5 do3 do#3 re#3 si3 do5 do#3 re3}{3,sol#3 la#4 sol#3 la4 la#3 si4 re3 sol#3 la#4 sol#3 la#4 sol#3}{1,la#4 la4}
GRAM#4[5] Dha4 --> do5
GRAM#4[6] P3T3 --> {3,sol#3 la4 la#3 do5 re3 fa#3} {3,fa#4 fa4 sol4 re#4 do5 fa#3 fa#4 la4 do4}{3,do5 do3 do3 re#3 re#4 do5 re#3 do4 do5 do3 re#3 do4}{1,do5 do3}
GRAM#4[7] Dha5 --> sol#4

SUB1
GRAM#5[1] P4 --> {12,Trio Trio Trio Trio} {12,Trio Trio Trio Trio,Quatuor Quatuor Quatuor Quatuor} {24,Trio Trio Trio Trio Trio Trio Trio Trio,Quatuor Quatuor Quatuor Quatuor Quatuor Quatuor Quatuor Quatuor,OlSeul32}
GRAM#5[2] Trio --> {1,Sm,An,So} Tik Tik
GRAM#5[3] Quatuor --> {1,Ar,Ol,Su,Vi} {1,mi6---,do6---}
GRAM#5[4] OlSeul32 --> OlSeul4 OlSeul4 OlSeul4 OlSeul4 OlSeul4 OlSeul4 OlSeul4 OlSeul4
GRAM#5[5] OlSeul4 --> Ol Ol Ol Ol

SUB1
GRAM#6[1] P5 --> {Tick32,Tihai5 Chhe Tihai5 Chhe Tihai5}
GRAM#6[2] Tihai5 --> {4,Cinq2 Chhe Cinq2 Chhe} {6,Cinq2 Cinq2 Cinq2}

SUB1
GRAM#7[1] P6 --> {Tick32,Tihai6 Tin Tihai6 Tin Tihai6}
GRAM#7[2] Tihai6 --> {2,Huit}{2,Six}{2,Cinq}{2,Quatre}{2,- - Ek - - Do - -}

SUB1
GRAM#8[1] P7 --> {Tick32,Tihai7 Dha4 Tihai7 Dha4 Tihai7}
GRAM#8[2] Tihai7 --> {2,Huit2}{2,Sept2}{2,Six2}{2,Cinq2}{2,Quatre2}

SUB1
GRAM#9[1] P8 --> Tihai8 Gap8 Tihai8 Gap8 Tihai8
GRAM#9[2] Tihai8 --> {fa4,do5} - fa5 do6 la5 la#5 sol5 do6 la5 - {fa4,do5} fa5 - do6 la5 la#5 sol5 do6 la5 - {fa4,do5} fa5 do6 - la5 la#5 sol5 do6
GRAM#9[3] Gap8 --> la5 - - - - -

SUB1
GRAM#10[1] P9 --> {M1 M1 M1 M1 M2 M2 M2 M2 M2 M2 M2 M2 M3 M3 M3 M3 M3 M3 M3 M3 M4 M4 M4 M4 M4 M4 M4 M4 M5 M5 M5 M5 M5 M5 M5 M5 M6 M6 M6 M6 M6 M6 M6 M6,_vel(10){re3,mi3,fa3}}
GRAM#10[2] M1 --> Smriti
GRAM#10[3] M2 --> {Smriti,Olivier}
GRAM#10[4] M3 --> {Smriti,Olivier,Vijayshree}
GRAM#10[5] M4 --> {Smriti,Olivier,Vijayshree,Arindam}
GRAM#10[6] M5 --> {Smriti,Olivier,Vijayshree,Arindam,Somenath}
GRAM#10[7] M6 --> {Smriti,Olivier,Vijayshree,Arindam,Somenath,_vel(127) Suresh}

ORD [Setting ratios with time pat­terns]
GRAM#11[1] Tp1 --> t1 t1 t1 t1 t1 t1 t1 t1
GRAM#11[2] Tp2 --> t2 t2 t2 t2 t2 t2 t2 t2
GRAM#11[3] Tp3 --> t3 t3 t3 t3 t3 t3 t3 t3

SUB1
GRAM#12[1] Vi4 --> {4,Vi1 Vi1 Vi1 Vi1}
GRAM#12[2] So8 --> {8,So1 So1 So1 So1 So1 So1 So1 So1}
GRAM#12[3] Ar12 --> {12,Ar1 Ar1 Ar1 Ar1 Ar1 Ar1 Ar1 Ar1 Ar1 Ar1 Ar1 Ar1}
GRAM#12[4] Sm16 --> {16,Sm1 Sm1 Sm1 Sm1 Sm1 Sm1 Sm1 Sm1 Sm1 Sm1 Sm1 Sm1 Sm1 Sm1 Sm1 Sm1}
GRAM#12[5] Su24 --> {24,Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1 Su1}
GRAM#12[6] Ol32 --> {32, Ol4 Ol4 Ol4 Ol4 Ol4 Ol4 Ol4 Ol4}
GRAM#12[7] An48 --> An16 An16 An16
GRAM#12[8] An16 --> An4 An4 An4 An4
GRAM#12[9] An4 --> {4, An1 An1 An1 An1}
GRAM#12[10] Ol4 --> Ol1 Ol1 Ol1 Ol1
GRAM#12[11] Vi1 --> fa3 -
GRAM#12[12] So1 --> {mi3,fa#3} -
GRAM#12[13] Ar1 --> {sol3,la#3} -
GRAM#12[14] Sm1 --> do4 -
GRAM#12[15] Su1 --> {do#4,fa4} -
GRAM#12[16] Ol1 --> sol3 -
GRAM#12[17] An1 --> sol4 -

SUB1
GRAM#13[1] Smriti --> {3,Sm Sm Sm}
GRAM#13[2] Olivier --> {5,Ol Ol Ol Ol Ol}
GRAM#13[3] Vijayshree --> {2,Vi Vi}
GRAM#13[4] Arindam --> {4,Ar Ar Ar Ar}
GRAM#13[5] Somenath --> {6,So So So So So So}
GRAM#13[6] Suresh --> {12,Su Su Su Su Su Su Su Su Su Su Su Su}

SUB1
GRAM#14[1] Huit --> BigTik Tik Tik Tik Tik Tik Tik Tik
GRAM#14[2] Six --> BigTik Tik Tik Tik Tik Tik
GRAM#14[3] Cinq --> BigTik Tik Tik Tik Tik
GRAM#14[4] Cinq2 --> BigTik Tik3 Tik3 Tik3 Tik3
GRAM#14[5] Quatre --> BigTik Tik Tik Tik
GRAM#14[6] Huit2 --> BigTik2 Tik2 Tik2 Tik2 Tik2 Tik2 Tik2 Tik2
GRAM#14[7] Sept2 --> BigTik2 Tik2 Tik2 Tik2 Tik2 Tik2 Tik2
GRAM#14[8] Six2 --> BigTik2 Tik2 Tik2 Tik2 Tik2 Tik2
GRAM#14[9] Cinq2 --> BigTik2 Tik2 Tik2 Tik2 Tik2
GRAM#14[10] Quatre2 --> BigTik2 Tik2 Tik2 Tik2
GRAM#14[11] Ek --> Tik
GRAM#14[12] Do --> Tik
GRAM#14[13] Tin --> Tik
GRAM#14[14] Chhe --> BigTik

SUB1
// The eight fol­low­ing rules are typ­i­cal cas­es in which _staccato() should be used.
GRAM#15[1] Dha1 --> {1,{si3,si4}---}
GRAM#15[2] Su --> do6---
GRAM#15[3] Sm --> fa5---
GRAM#15[4] Ol --> mi6---
GRAM#15[5] So --> la5---
GRAM#15[6] Vi --> re6-
GRAM#15[7] Ar --> mi5---
GRAM#15[8] An --> fa6---
GRAM#15[9] Dha4 --> {fa2,do4}
GRAM#15[10] Tick32 --> _vel(40) do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3 do3
GRAM#15[11] Tik --> do7
GRAM#15[12] Tik2 --> {do5,do6}
GRAM#15[13] Tik3 --> {_vel(15) sol6,_vel(110) do7}
GRAM#15[14] BigTik --> {do6,do8}
GRAM#15[15] BigTik2 --> {fa3,fa4}

SUB1
GRAM#16[1] Route --> X87
GRAM#16[2] Sablier --> X76
GRAM#16[3] Maison --> C13
GRAM#16[4] Toit --> X76
GRAM#16[5] Drapeau --> X36
GRAM#16[6] CerfVolant --> X63
GRAM#16[7] Guimbarde --> X86
GRAM#16[8] Hippocampe --> X72
GRAM#16[9] VaisseauVolant --> X36
GRAM#16[10] Conque --> I66
GRAM#16[11] Michiko --> X75

ORD
[D-50 stuff]
GRAM#17[1] Xcard --> _script(MIDI con­troller #98 = 1 chan­nel 1)
GRAM#17[2] Internal --> _script(MIDI con­troller #98 = 0 chan­nel 1)
GRAM#17[3] X13 --> Xcard _script(MIDI pro­gram 5)
GRAM#17[4] X24 --> Xcard _script(MIDI pro­gram 12)
GRAM#17[5] X26 --> Xcard _script(MIDI pro­gram 14)
GRAM#17[6] X27 --> Xcard _script(MIDI pro­gram 15)
GRAM#17[7] X36 --> Xcard _script(MIDI pro­gram 22)
GRAM#17[8] X63 --> Xcard _script(MIDI pro­gram 43)
GRAM#17[9] X68 --> Xcard _script(MIDI pro­gram 48)
GRAM#17[10] X72 --> Xcard _script(MIDI pro­gram 50)
GRAM#17[11] X75 --> Xcard _script(MIDI pro­gram 53)
GRAM#17[12] X76 --> Xcard _script(MIDI pro­gram 54)
GRAM#17[13] X83 --> Xcard _script(MIDI pro­gram 59)
GRAM#17[14] X85 --> Xcard _script(MIDI pro­gram 61)
GRAM#17[15] X86 --> Xcard _script(MIDI pro­gram 62)
GRAM#17[16] X87 --> Xcard _script(MIDI pro­gram 63)
GRAM#17[17] I42 --> Internal _script(MIDI pro­gram 26)
GRAM#17[18] I62 --> Internal _script(MIDI pro­gram 42)
GRAM#17[19] I66 --> Internal _script(MIDI pro­gram 46)
GRAM#17[20] C13 --> Internal _script(MIDI pro­gram 67)
GRAM#17[21] C42 --> Internal _script(MIDI pro­gram 90)
GRAM#17[22] C56 --> Internal _script(MIDI pro­gram 102)
GRAM#17[23] C23 --> Internal _script(MIDI pro­gram 75)
GRAM#17[24] PedalOn --> _switchon(64,1)
GRAM#17[25] PedalOff --> _switchoff(64,1)

An extract of this work is shown in the fol­low­ing video from 3mn 36s to 3mn 48s:

References

Related work

No posts found.