Sarasvati vina

Sarasvati vīna. Source: Wikipedia

The following is an example of successful combination of Bol Processor and Csound. Both music creation software packages are still in development after four decades… Csound was originally written by Barry Vercoe at MIT in 1985, while Bol Processor dates back to 1981.

Short musical phrases were composed in 1995 by Srikumar Karaikudi Subramanian, an accomplished practitioner of Carnatic music with deep understanding of mathematics and physics — read his blog, PhD thesis (2013) and list of patents.

Listen to the result:

"Pallavi" of song "Maayaatiita Svaruupini, Nannu brovave" in raga "mayamaalavagaula". (The fadeout is post-produced.)

The making of this example requires a 33-millisecond waveform sample of Sarasvati vīna (vina-wave-table.aif) and a grammar (-gr.vina3) associated with a Csound instrument description (-cs.Vina). All this is handled by the Bol Processor in both BP2 and BP3 versions. This process produces a Csound score which Csound converts into a sound file using a Csound orchestra file (new-vina.orc).

The demo was initially developed on Bol Processor BP2, the standalone application still available for Mac computers. In October 2020, it was repeated on BP3, the multi-platform version, to check the validity of Csound procedures in the new environment.

The grammar

The grammar "-gr.vina3" is available with all the necessary ingredients in the example set bp3-ctests-main.zip shared on GitHub. Follow the instructions on the Bol Processor ‘BP3’ and its PHP interface page to install BP3 and learn its basic operation. Download and install Csound as instructed.

The grammar "-gr.vina3" is shown below.

-se.Vina3
-cs.Vina
-to.Vina

// "Pallavi" of song "Maayaatiita Svaruupini, Nannu brovave" in raga "mayamaalavagaula"
// scale - C, C#, E, F, G , G#, B
// Note phrase variations given.

// Terms:
// Spuritam - Quick (discrete) two note succession.
// Taalam - Measure of time (played on vina using the 3 sympathetic strings tuned to C-G-C).
// Gamaka - Smooth motion between two pitches (usually pull of string).
// Pallavi - Theme of composition

ORD

gram#1[1] S --> _ins(Vina) _scale(just intonation,0) {Taalam4 Taalam4, Pallavi Pallavi} Taalam

gram#1[2] Pallavi --> {Maa Yaa Tii • Ta {2, Sva Ruu Pi}•{2, Ni} {1, Nan Nu}• Bro {2, Va Ve}}
gram#1[3] Maa --> C3
gram#1[4] Yaa --> LongSpuritam C3 Slide1
gram#1[5] Tii --> {1, StartSlidePull C3 Slide1 _ _ Slide1 Pull0 _ Slide4 • Pull1 _ Pull0 •Pull0 Pull1 - StopSlidePull }
gram#1[6] Ta --> F3
gram#1[7] Sva --> {3, G3}
gram#1[9] Ruu --> {3, StartSlidePull G3 SlideBack2 _ SlideBack3 _ SlideBack2 _ SlideBack3 Pull0 _ Pull1 - StopSlidePull}
gram#1[10] Pi --> {2, F3}
gram#1[11] Ni --> G3
gram#1[12] Nan --> G3
gram#1[13] Nu --> {1, StartPull Pull1 G3 Pull0 _ Pull1 - StopPull}
gram#1[14] Bro --> {1, StartSlide F3 Slide2 _ _ _ StopSlide} /slideVa/
gram#1[15] Bro --> {1, GamakaHold F3 Pull2} /pullVa/
gram#1[16] /slideVa/ Va --> StartSlide G3 SlideBack2 StopSlide
gram#1[17] /pullVa/ Va --> StartPull Pull2 F3 Pull0 StopPull
gram#1[18] Ve --> {3, Ve1 Ve2 Ve3}
gram#1[19] Ve1 --> {5, GamakaOscil E3 Pull1}
gram#1[20] Ve2 --> StartSlide C#3 SlideBack1 _ StopSlide
gram#1[21] Ve3 --> StartPull B2 Pull1 StopPull

RND
gram#2[1] Taalam4 --> Taalam Taalam Taalam Taalam
gram#2[2] Taalam --> {3, C3, G3, C4}

SUB1

gram#3[1] LongSpuritam ?1 ?2 --> {1, StartSlide ?1 _ Slide0 _ ?2 }
gram#3[2] GamakaOscil ?1 ?2 --> {StartPull ?1 ?2 Pull0 _ ?2 _ Pull0 _ ?2 StopPull}
gram#3[3] GamakaHold ?1 ?2 --> {1, StartPull ?1 ?2 _ _ _ StopPull}

SUB1

gram#4[1] StartSlidePull --> StartSlide StartPull
gram#4[2] StopSlidePull --> StopSlide StopPull

SUB1

// Lowest level structures

gram#5[1] Pull0 --> _pitchbend(0)
gram#5[2] Pull1 --> _pitchbend(100)
gram#5[3] Pull2 --> _pitchbend(200)

gram#5[4] Slide0 --> _value(slide, 0)
gram#5[5] SlideBack1 --> _value(slide, -101)
gram#5[6] SlideBack2 --> _value(slide, -201)
gram#5[7] SlideBack3 --> _value(slide, -301)
gram#5[8] Slide1 --> _value(slide, 101)
gram#5[9] Slide2 --> _value(slide, 201)
gram#5[10] Slide4 --> _value(slide, 401)

gram#5[11] StartSlide --> _cont(slide) _value(slide, 0)
gram#5[12] StopSlide --> _fixed(slide)
gram#5[13] StartPull --> _pitchcont _pitchrange(500) _pitchbend(0)
gram#5[14] StopPull --> _pitchfixed

This grammar is exemplary for its use of variables that represent "musical gestures" before their sound representation. For example, "Pull0", "Pull1" and "Pulll2" are different ways of pulling the string to raise its pitch. This is reflected by changing the value of a pitchbender, which is a MIDI standard and has been reproduced in the Csound orchestra.

Another gesture is named "slide", which is the movement from one fret to the next one. It also affects the frequency of the note, but in a discontinuous way, because the movement is a rapid change.

A more sophisticated model might include the strength of the plucking of a note, which could be mapped to a parameter similar to the velocity parameter in MIDI.

The Csound score

Once the grammar is open in the BP3/PHP interface environment, clicking on "Produce item(s)" will (by default) create a Csound score named "vina3.sco", as shown below.

; Csound score
f1 0 256 1 "vina-wave-table.aiff" 0 4 0

t 0.000 60.000
i1 0.000 1.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
f101 1.000 512 -7 0.000 256 -101.000 128 101.000 128 101.000
i1 1.000 1.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 101.000 101.000 ; C3
f102 2.000 256 -7 0.000 76 0.000 25 100.000 51 0.000 51 0.000 53 100.000
f103 2.000 256 -7 0.000 25 101.000 51 101.000 25 401.000 155 0.000

i1 2.000 0.833 7.00 90.000 90.000 0.000 0.000 100.000 102.000 0.000 0.000 103.000 ; C3
i1 0.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 0.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 0.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
i1 3.000 1.000 7.05 90.000 90.000 0.000 0.000 0.000 0.000 401.000 401.000 0.000 ; F3
i1 4.000 0.750 7.07 90.000 90.000 0.000 0.000 0.000 0.000 401.000 401.000 0.000 ; G3
f104 4.750 1024 -7 0.000 877 0.000 147 100.000
f105 4.750 1024 -7 0.000 146 -201.000 146 -301.000 146 -201.000 438 -301.000 148 0.000
i1 4.750 0.656 7.07 90.000 90.000 0.000 0.000 100.000 104.000 0.000 0.000 105.000 ; G3
i1 3.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 3.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 3.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
i1 5.500 0.500 7.05 90.000 90.000 0.000 0.000 0.000 0.000 -345.444 -345.444 0.000 ; F3
i1 6.000 2.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 -345.444 -345.444 0.000 ; G3
i1 8.000 0.500 7.07 90.000 90.000 0.000 0.000 0.000 0.000 -345.444 -345.444 0.000 ; G3
f106 8.500 256 -7 100.000 128 0.000 128 100.000
i1 8.500 0.333 7.07 90.000 90.000 0.000 100.000 100.000 106.000 -345.444 -345.444 0.000 ; G3
i1 6.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 6.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 6.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
f107 9.000 512 -7 0.000 128 201.000 384 201.000
i1 9.000 1.000 7.05 90.000 90.000 0.000 0.000 0.000 0.000 0.000 201.000 107.000 ; F3
f108 10.000 1024 -7 0.000 256 -201.000 768 -201.000
i1 10.000 0.500 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 -201.000 108.000 ; G3
f109 10.500 1024 -7 0.000 204 100.000 204 0.000 204 100.000 204 0.000 208 100.000
i1 10.500 0.937 7.04 90.000 90.000 0.000 0.000 100.000 109.000 -201.000 -201.000 0.000 ; E3
f110 11.437 512 -7 0.000 256 -101.000 256 0.000
i1 11.437 0.375 7.01 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 110.000 ; C#3
i1 9.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 9.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 9.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
i1 11.812 0.188 6.11 90.000 90.000 0.000 0.000 33.333 0.000 -101.000 -101.000 0.000 ; B2
i1 12.000 1.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 -101.000 -101.000 0.000 ; C3
f111 13.000 512 -7 0.000 256 -101.000 128 101.000 128 101.000
i1 13.000 1.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 101.000 111.000 ; C3
f112 14.000 256 -7 0.000 76 0.000 25 100.000 51 0.000 51 0.000 53 100.000
f113 14.000 256 -7 0.000 25 101.000 51 101.000 25 401.000 155 0.000

i1 14.000 0.833 7.00 90.000 90.000 0.000 0.000 100.000 112.000 0.000 0.000 113.000 ; C3
i1 12.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 12.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 12.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
i1 15.000 1.000 7.05 90.000 90.000 0.000 0.000 0.000 0.000 401.000 401.000 0.000 ; F3
i1 16.000 0.750 7.07 90.000 90.000 0.000 0.000 0.000 0.000 401.000 401.000 0.000 ; G3
f114 16.750 512 -7 0.000 472 0.000 40 100.000
f115 16.750 512 -7 0.000 236 -201.000 236 -301.000 40 0.000

i1 16.750 0.468 7.07 90.000 90.000 0.000 0.000 100.000 114.000 0.000 0.000 115.000 ; G3
i1 15.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 15.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 15.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
i1 17.500 0.500 7.05 90.000 90.000 0.000 0.000 0.000 0.000 -351.000 -351.000 0.000 ; F3
i1 18.000 2.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 -351.000 -351.000 0.000 ; G3
i1 20.000 0.500 7.07 90.000 90.000 0.000 0.000 0.000 0.000 -351.000 -351.000 0.000 ; G3
f116 20.500 256 -7 100.000 128 0.000 128 100.000
i1 20.500 0.333 7.07 90.000 90.000 0.000 100.000 100.000 116.000 -351.000 -351.000 0.000 ; G3
i1 18.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 18.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 18.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
f117 21.000 512 -7 0.000 128 201.000 384 201.000
i1 21.000 1.000 7.05 90.000 90.000 0.000 0.000 0.000 0.000 0.000 201.000 117.000 ; F3
f118 22.000 1024 -7 200.000 256 0.000 768 0.000
i1 22.000 0.500 7.05 90.000 90.000 0.000 200.000 0.000 118.000 0.000 0.000 0.000 ; F3
f119 22.500 1024 -7 0.000 204 100.000 204 0.000 204 100.000 204 0.000 208 100.000
i1 22.500 0.937 7.04 90.000 90.000 0.000 0.000 100.000 119.000 0.000 0.000 0.000 ; E3
f120 23.437 512 -7 0.000 256 -101.000 256 0.000
i1 23.437 0.375 7.01 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 120.000 ; C#3
i1 21.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 21.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 21.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
i1 23.812 0.188 6.11 90.000 90.000 0.000 0.000 33.333 0.000 -101.000 -101.000 0.000 ; B2
i1 24.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 24.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 24.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
s
e


Settings of "slide" in "vina"

Note that the first line of this score — table "f1" — contains the link to the sampled waveform "vina-wave-table.aiff" and the Csound orchestra file "new-vina.orc" located in the same folder. The value "1" in the fourth argument indicates that data from a sound file will be transferred into a function table (see documentation).

Lines starting with "i1" are note instructions submitted to the instrument "vina" to produce notes 'C3', 'G3', 'F4' etc. The second and third arguments are the start time and duration respectively (see documentation). The fourth argument is the pitch, expressed as "octave.note": for example, "7.05" means the 7th note of octave 7, which is F3. The pitch could also be given in Herz with respect to 'A4' = 440Hz — see Csound tuning in BP3.

Instructions "f102", "f103" etc. describe tables used for the interpolation of pitchbend and "slide" parameters associated with the "vina" instrument. In the "slide" parameter settings, the table index is the 13th argument. In fact, the 13th parameter of the "i1" instructions contains "101", "103" etc. In each of these tables, the fourth argument indicates the GEN routine that Csound will use for its interpolation. The value "-7" means "GENO7" (linear interpolation) with no post-normalization (see documentation).

Pitchbender settings of instrument "vina"

Instructions "f102", "f104" etc. are tables for interpolating pitchbender values. These are referenced in the 10th argument of "i1" events, as shown in the picture. We see that the range of MIDI values [0 .. 16383] is mapped to the [-500 .. +500] interval used by the Csound instrument, both being logarithmic scales. The central mapping of 8191.50 to 0 is used to construct this interpolation with a quadratic regression. See the Csound argument mapping page for a detailed explanation.

For example, in this event:

i1 4.750 0.656 7.07 90.000 90.000 0.000 0.000 100.000 104.000 0.000 0.000 105.000 ; G3

the table "f104" (10th argument) is invoked to interpolate pitchbend values between 0.000 and 100.000 (the 8th and 9th arguments). In event:

i1 21.000 1.000 7.05 90.000 90.000 0.000 0.000 0.000 0.000 0.000 201.000 117.000 ; F3

the table "f117" (13th argument) is used to interpolate the "slide" parameter between 0.000 and 201.000 (the 11th and 13th arguments). However, in the orchestra file "new-vina.orc", this parameter is not treated as continuous because it represents a quick move from one fret to the next. Therefore, the _cont(slide) instruction is irrelevant for this version of the grammar. It could be deleted or replaced by _step(slide).

Making the sound file

Open a Unix console and go to the folder containing "vina3.sco" and "new-vina.orc".

Type :

csound -o Vina3.aif new-vina.orc out.sco

Running Csound on a console: the termination of a successful process

If the operation is successful — as confirmed by messages on the console — the desired sound file "Vina3.aif" has been created.

WAV format, 24-bit resolution etc. are also available with Csound. Just type "csound" to see some options, or "csound --help" to see the full list.

By default, Csound displays messages that mimic the graphical representation of all tables used in the score. This option can be turned off.

This whole process of converting a Csound score into a sound file has been made automatic on the Bol Processor BP3 interface. If Csound is installed and responding, it will be called to do the conversion. The sound file it is instructed to create is in WAV format.

Microtonal intonation

An important feature of this example is the choice of a microtonal scale to replace the equal tempered 12 tone scale commonly used on electronic or modern keyboard instruments. The scale is defined in the tonal resource "-to.Vina" and is set by the instruction _scale(just intonation,0).

In BP3 it is possible to define microtonal scales and use them either in the MIDI or the Csound environment. (Read the MIDI microtonality page.) Csound uses function tables, which are automatically superimposed on the Csound score. For example, a "just intonation" scale can be defined as follows:

f2 0 128 -51 12 2 264 60 1 1.066 1.125 1.2 1.25 1.333 1.42 1.5 1.6 1.666 1.777 1.875

Numbers in red indicate frequency ratios. For example, the size of the fifth (C - G) is 1.333 = 4/3, which makes it "perfect". Listen to both interpretations in just intonation and equal temperament:

Just intonation
Equal-tempered intervals

Discussion

This detailed interpretation of a musical phrase in Carnatic music was just an early demonstration of Bol Processor + Csound features. In 2013, Srikumar Karaikudi Subramanian submitted his PhD thesis to the National University of Singapore entitled Modeling Gamakās of Carnatic Music as a Synthesizer for Sparse Prescriptive Notation. He went on to develop the Pāṭāntarā system of high-quality Carnatic music notation.

Apart from using a sample of the real Sarasvati vīna sound to create the musical piece, is it worth using the Csound environment instead of MIDI on the Bol Processor? After all, any MIDI sampler could handle the waveform and produce the same sound as Csound…

We do not have a MIDI sampler to reproduce the sound of a Sarasvati vīna, but "-gr.vina3" can be played on a MIDI device, either in real time or via a MIDI file. The following is a rendering on PianoTeq:

(Dreadful) rendering of -gr.vina3 on a MIDI device. Sorry Srikumar! 😀

Listening to this version, it is clear that the pitchbend instructions have been partially interpreted, while the "slide" parameter specific to the "vina" Csound instrument has been ignored. This confirms that Csound offers the possibility of enriching the description of any piece of music with performance parameters that do not belong to the standard MIDI categories: pitchbend, modulation, pressure, etc.

We have documented all the features of the Csound implementation on the Csound checkup and Csound objects page, showing examples that can be checked with BP3. More details on the handling of continuous parameters can be found on the page Continuous parameters in Csound scores.

A call for participation

We invite musicians who are familiar with Csound to create examples of the full use of Csound on Bol Processor. This will increase our confidence that none of the implemented Csound features are incomplete or erroneous.

 The development of Csound beyond our initial work on the subject (in 1995) is expected to stimulate new ideas for more advanced integration in future versions of BP3.

Leave a Reply

Your email address will not be published. Required fields are marked *