Just intonation: a general framework

This article discusses the intricate concept of just intonation in music, exploring its historical interpretations and practical applications within the Bol Processor. It contrasts the "Greek" or Pythagorean approach, which emphasizes integer ratios and perfect fifths, with the ancient Indian grama-murcchana model, notable for its flexible, ear-based tuning system and avoidance of numerical ratios in its original formulation. The text explains how this Indian framework can be extended to Western harmony, creating optimally consonant 12-tone scales with subtle differences in enharmonic positions. Ultimately, the author suggests that while mathematical precision can define just intonation, artistic and perceptual experience often guides its most effective implementation, acknowledging that "perfection" might not always be the primary musical goal.

Just intonation (intonation pure in French) is a word used by composers, musicians and musicologists to describe various aspects of composition, performance and instrument tuning. They all point to the same goal of "playing/singing in tune" — whatever that means. Implementing a generic abstract model of just intonation in the Bol Processor is a challenge beyond our current competence… We approach it pragmatically by looking at some musical traditions that pursue the same goal with the help of reliable theoretical models.

A complete and consistent framework for the construction of just-intonation scales - or "tuning systems" - was the grama-murcchana model elaborated in ancient India. This theory has been extensively commented on and (mis)interpreted by Indian and Western scholars: for a detailed review see Rao & van der Meer 2010. We will show that an arguably acceptable interpretation yields a framework of chromatic scales that can be extended to Western classical harmony and easily handled by the Bol Processor — either producing Csound scores or real-time MIDI microtonality.

This page is a continuation of Microtonality but can be read independently.

All examples shown on this page are available in the sample set bp3-ctests-main.zip shared on GitHub. Follow instructions on Bol Processor ‘BP3’ and its PHP interface to install BP3 and learn its basic operation.

Historical background

Methods of tuning musical instruments have been documented in various parts of the world for over 2000 years. For practical and personal reasons we will concentrate on work in Europe and the Indian subcontinent.

Systems described as "just intonation" are attempts to create a tuning in which all tonal intervals are consonant. There is a large body of theoretical work on just intonation - see Wikipedia for links and abstracts.

Models are amenable to Hermann von Helmholtz's notion of consonance which deals with the perception of the pure sinusoidal components of complex sounds containing multiple tones. According to the theory of consonance, the frequencies of these upper partials are integer multiples of the fundamental frequency of the vibration. In mechanical musical instruments, this is close to reality when long strings are gently struck or plucked. However, this harmony is lacking in many wind instruments, especially reed instruments such as the saxophone or the Indian shehnai, and even less in percussion instruments or bells which combine several modes of vibration.

Therefore, if just intonation is invoked to tune a musical instrument, it must be analogous to a zither, a swara mandal, a harpsichord, a piano or a pipe organ, including electronic devices that produce similar sounds.

Perhaps because of their late "discovery" of calculus — actually "borrowed" from Indian, Persian and Arabic sources — Europeans cultivated a fascination with numbers strongly advocated by the Church as an image of "God's perfection". We may recall Descarte's claim that the length of a curve is "beyond human understanding" because π cannot be written as an integer ratio…

In the 17th century, the German mathematician Leibniz set forth the theory of "subconscious evaluation", defining music as "the pleasure of the soul that counts without knowing it". This was followed by the French musical theorist Jean-Philippe Rameau affirming that melody arises from harmony, making it possible "to perceive the relationships between numbers, as they arise throughout the universe".

Regardless of these speculations, musicians in real life had developed procedures for tuning their instruments by listening to intervals and selecting the ones that sounded right to them — see The two-vina experiment page.

After the development of musical acoustics, attempts were made to describe tuning schemes in terms of frequency ratios. This was a risky venture, however, because the dream of perfection led to the simplistic promotion of "perfect ratios". Seeking the kind of perfection embodied in numbers is the best way to produce bland music.

Although just intonation — intervals without beats — is now possible on electronic instruments, it is based on a narrow concept of tonality. This can be verified by listening to ancient Western music performed using different ear-based temperaments — see page Comparing temperaments — and even to Indian classical music — see page Raga intonation.

The “Greek” approach

Greek women playing ancient Harp, Cithara and Lyre musical instruments (source)

Models of vibrating strings attributed to the "ancient Greeks" suggest that frequency ratios of 2/1 (the octave), 3/2 (the major fifth) and 5/4 (the major third) produce consonant intervals, while other ratios produce a certain degree of dissonance.

The practice of polyphonic music on fixed-tuned instruments has shown that this perfect consonance is never achieved with 12 notes in an octave — the conventional chromatic scale. In Western classical harmony, it would require retuning the instrument according to the musical genre, the piece of music and the harmonic context of each melodic phrase or chord.

Imperfect tonal intervals produce unwanted beats because their frequency ratio cannot be reduced to simple 2, 3, 4, 5 fractions. A simple thought experiment, mythically attributed to Pythagoras of Samos, shows that this is inherent in arithmetic and not a defect in instrument design. Imagine the tuning of ascending fifths (ratio 3/2) by successive steps on a harp with octave shifts to keep the resulting note within the original octave. The frequency ratios would be 3/2, 9/4, 27/16, 81/64 and so on. At this stage, the note appears to be a major third although its actual ratio (81/64 = 1.265) is higher than 5/4 (1.25). The 81/64 interval is called the Pythagorean major third, which may sound "out of tune" in a conventional harmonic context. The frequency ratio (81/80 = 1.0125) between the Pythagorean and harmonic major thirds is called the syntonic comma.

Whoever devised the so-called "Pythagorean tuning" went further in their intention to describe all musical notes by cycles of fifths. Going further up, 243/128, 729/512… etc. effectively produces a full chromatic scale: C - G - D - A - E - B - F♯ - C♯ - G♯… etc. But in addition to the harsh sound of some of the resulting intervals, things get bad if one hopes to end the cycle on the initial note. If the series started on 'C', it will end on 'C' (or 'B#'), but with a ratio of 531441/524288 = 1.01364, slightly higher than 1. This gap is called the Pythagorean comma, which is conceptually different from the syntonic comma (1.0125), although their sizes are almost identical. This paradox is a matter of simple arithmetic: powers of 2 (octave intervals) never match powers of 3.

The attribution of this system to the "ancient Greeks" is, of course, pure fantasy, since they (unlike the Egyptians) didn't have any use for fractions!

A 19-key per octave (from "A" to "a") keyboard designed by Gioseffo Zarlino (1517-1590) (source)

Despite the comma problem, tuning instruments by series of perfect fifths was common practice in medieval Europe, following the organum which consisted of singing/playing parallel fifths or fourths to enhance a melody. One of the oldest treatises on "Pythagorean tuning" was published around 1450 by Henri Arnault de Zwolle (Asselin 2000 p. 139). In this tuning, major "Pythagorean" thirds sounded harsh, which explains why the major third was considered a dissonant interval at the time.

Because of these limitations, Western fixed-pitch instruments using chromatic (12-tone) scales never achieve the pitch accuracy dictated by just intonation. For this reason, just intonation is described in the literature as "incomplete" (Asselin 2000 p. 66). Multiple divisions (more than 12 per octave) are required to produce all "pure" ratios. This has been unsuccessfully attempted on keyboard instruments, although it remains possible on a computer.

The Indian approach

Bharata Muni's "Natya Shastra"

The grama-murcchana model was described in the Natya Shastra, a Sanskrit treatise on the performing arts written in India some twenty centuries ago. Chapter 28 contains a discussion of the "harmonic scale", which is based on a division of the octave into 22 shruti-s, while only seven swara-s (notes) are used by musicians: "Sa", "Re", "Ga", "Ma", "Pa", "Dha", "Ni". These can be mapped onto conventional Western music notation "C", "D", "E", "F", "G", "A", "B" in English, or "do", "re", "mi", "fa", "sol", "la", "si" in Italian/Spanish/French.

This 7-swara scale can be extended to a 12-degree (chromatic) scale by means of diesis and flat alterations, which raise or lower a note by a semitone. Altered notes in the Indian system are commonly called "komal Re", "komal Ga", "Ma tivra", "komal Dha" and "komal Ni". The word "komal" can be translated as "flat" and "tivra" as "diesis".

The focus of 20th century research in Indian musicology has been to 'quantify' shruti-s in a systematic way and to assess the relevance of this quantification to the performance of classical raga.

Presentation of the S52 in November 1980 during the Sigma festival in Bordeaux. In the presence of Alain Daniélou, André Kudelski and Claude Cellier. Source: Semantic Daniélou

A striking point in the ancient Indian theory of musical scales is that it does not rely on numerical ratios, be they frequencies or lengths of vibrating strings. This point was overlooked by "colonial musicologists" because of their lack of insight into Indian mathematics and their fascination with a mysticism of numbers inherited from Neopythagoreanism.

In the mid-20th century, the French musicologist Alain Daniélou described "the Indian scale" as a set of 53 intervals per octave based on integer frequency ratios of 2, 3, and 5. His demonstration of raga phrases played on the S52 electronic keyboard instrument, built by Kudelski to this specification, was a painful experience for a musically trained audience — I attended it in Paris in 1980…

As reported by Jonathan Barlow (personal communication, 3/9/2013, links my own):

The ustads in India from way back considered that they followed Pythagoras, but early on they made the discovery that trying to tune by numbers was a losing game, and Ibn Sina (Avicenna) (980-1037 AD), who was their great philosopher of aesthetics, said in plain terms that it was wiser to rely on the ears of the experts. Ahobala tried to do the numbers thing (and Kamilkhani) but they are relegated to a footnote of 17th C musicology.

Bharata Muni, the author(s) of the Natya Shastra, may have heard of "Pythagorean tuning", a theory that Indian scientists could have expanded considerably, given their expertise in the use of calculus. Despite this, not a single number is quoted in the entire chapter on musical scales. This paradox is discussed on my page The Two-vina experiment. In A Mathematical Discussion of the Ancient Theory of Scales according to Natyashastra, I showed a minimal reason: Bharata's description leads to an infinite set of solutions, which should be formalised with some algebra, rather than a set of integer ratios.

How (and why) should the octave be divided into 22 (or 23) micro-intervals when most Indo-European musical systems only name 5 to 12 notes? Some naive ethnomusicologists have claimed that Bharata's model must be a variant of a presumed Arabic "quartertone system", or even a tempered scale with 22 intervals… If so, why not 24 shruti-s? Or any arbitrary number?

The two-vina experiment produces shruti-s of unequal sizes for a simple reason: No sum of microtones of 54.5 cents (1200 / 22) in a 22-degree equal tempered scale would produce an interval close to 702 cents — the perfect fifth that gives consonance (samvadi) to musical scales. (Read below for the definition of the cent as a logarithmic unit.)

In the (thought?) experiment described in Bharata's Natya Shastra (chapter 28), two vina-s — stringed instruments similar to zithers — are tuned identically. The author suggests lowering all the notes of one instrument by "one shruti" and they give a list of notes that will match between the two instruments. The process is repeated three more times until all the matches have been made explicit. This gives a system of equations (and inequations) for the 22 unknown variables.

Additional equations can be derived from a preliminary statement that the octave and the major fifth are "consonant" (samvadi), thus fixing frequency ratios close to 2/1 and 3/2. (Read the detailed procedure on my page The Two-vina Experiment and the mathematics in A Mathematical Discussion of the Ancient Theory of Scales according to Natyashastra.)

However, a new equation is needed, which Bharata's model does not provide. Interestingly, in Natya Shastra the major third is classified as "assonant" (anuvadi). Setting its frequency ratio to 5/4 (harmonic major third) is therefore a reduction of this model. In fact, the harmonic major third is a discovery of European musicians in the early 16th century, when fixed-pitch keyboard instruments had become popular (Asselin 2000 p. 139). Nonetheless, many musicologists take it for granted in their interpretation of the Indian model. […] thirds were considered interesting and dynamic consonances along with their inverse, sixths, but in medieval times they were considered dissonances unusable in a stable final sonority (Wikipedia).

The reduction of Bharata's model to a Pythagorean/harmonic tuning scheme, as proposed by E. James Arnold (1985), does not fit with the flexibility of intonation schemes in Indian music — see page Raga intonation. Experimental work on musical practice is not "in tune" with this interpretation of the ancient shruti system. In fact, it should be interpreted as a "flexible" framework in which the variable parameter is the syntonic comma, namely the difference between a Pythagorean major third and a harmonic major third. Adherence to the two-vina experiment only implies that the comma takes its value anywhere between 0 and 56.8 cents (Bel 1988a).

Building tonagrams on the Apple II from tonal data collected by Bel's MMA (1982)

➡ Measurements in cents refer to a logarithmic scale. Given a frequency ratio 'r', its cent value is 1200 x log(r) / log(2). The octave (ratio 2/1) is 1200 cents, and each semitone (in equal temperament) is 100 cents.

The construction and evaluation of raga scale types based on this flexible model is explained on my page Raga intonation.

Extending the Indian model to Western harmony

One incentive for applying the Indian framework to Western classical music is that both traditions have given priority to the consonance of perfect fifths associated with a 3/2 frequency ratio. In line with the Western approach, let us define the harmonic major third as an interval of 5/4 (384 cents). This results in a syntonic comma of 81/80 (close to 21.5 cents). The system of equations derived from the two-vina experiment is complete, and it yields two additional sizes of shruti-s: the Pythagorean limma (256/243 = about 90 cents) and the minor semitone (25/24 = about 70 cents).

These intervals were known to Western musicologists who were trying to find just intonation scales that could be played on keyboard instruments (12 degrees per octave). Gioseffo Zarlino (1517-1590) is a well-known contributor to this theoretical work. His "natural scale" was an arrangement of the three natural intervals yielding the following chromatic scale — named "just intonation" in "-to.tryScales":

A "just intonation" chromatic scale derived from Zarlino's model of "natural scale"
(Image created by Bol Processor)

This should not be confused with Zarlino's meantone temperament (image), read pages Microtonality and Comparing temperaments.

In 1974, E. James Arnold, inspired by the French musicologist Jacques Dudon, designed a circular model to illustrate the transposition of scales (murcchana) in Bharata's model. Below is the sequence of intervals (L, C, M…) over an octave as derived from the two-vina experiment.

The outer crown of Arnold's model for his interpretation of the grama-murcchana system. The Pythagorean series of perfect fifths is drawn in red and the harmonic series of perfect fifths is drawn in green. The dotted blue line is a harmonic major third.

Positions R1, R2 etc. are labelled with abbreviations of names Sa, Re, Ga, Ma, Pa, Dha, Ni. For example, Ga ("E" in English) can have four positions, G1 and G2 being enharmonic variants of komal Ga ("E flat" = "mi bémol"), while G3 and G4 are the harmonic and Pythagorean positions of shuddha Ga ("E"= "mi") respectively.

The notes of the chromatic scale have been labelled using the Italian/Spanish/French convention "do", "re", "mi", "fa"… rather than the English convention to avoid confusion: "D" is associated with Dha ("A" in English, "la" in Italian/French) and not with the English "D" ("re" in Italian/French).

Frequency ratios are illustrated by pictograms showing how each position can be derived from the base note (Sa). For example, the pictogram near N2 ("B flat" = "si bémol") shows 2 ascending perfect fifths and 1 descending major third.

Cycles of perfect fifths have been marked with red and green segments. The red series is generally called "Pythagorean" — containing G4 (81/84) — and the green one "harmonic" — containing G3 (5/4). The blue arrow shows a harmonic major third going from S ("C" = "do") to G3. Both cycles are identical, with the harmonic and Pythagorean positions differing by 1 syntonic comma.

Theoretically, the harmonic series could also be constructed in a "Pythagorean" way, by extending the cycles of perfect fifths. Thus, after 8 descending fifths, G3 ("E" = "mi") would be 8192/6561 (1.248) instead of 5/4 (1.25). The difference is a schisma (ratio 1.001129), an interval beyond human perception. It is therefore more convenient to show simple ratios.

The framework implemented in Bol Processor deals with integer ratios, which allows for high accuracy. Nevertheless, it deliberately erases schisma differences. This is the result of approximating certain ratios, e.g. replacing 2187/2048 with 16/15.

Note that there is no trace of schisma in the classical Indian theory of musical scales; there wouldn't be even if Bharata's contemporaries had constructed them via series of rational numbers, because of their decision to disregard infinitesimals as "non-representable" entities (cf. Nāgārjuna's śūniyavāda philosophy, Raju 2007 p. 400). If 2187/2048 and other complex ratios of the same series were deemed impractical, the Indian mathematician/physicist (following the Āryabhaţīya) would replace them all with "16/15 āsanna (near value)"… This is an example of Indian mathematics designed for calculation rather than proof construction. In the Western Platonic approach, mathematics aimed at "exact values" as a sign of perfection, which led its proponents to face serious problems with "irrational" numbers and even with the logic underlying formal proof procedures (Raju 2007 p. 387-389).

This diagram, and the moving grama wheel that will be introduced next, could be built with any size of the syntonic comma in the range 0 to 56.8 cents (Bel 1988a). The two-vina experiment implies that L = M + C. Thus, the syntonic comma is also the difference between a limma and a minor semitone. To build a framework for the flexible model, simply allow all harmonic positions to move by the same amount in the direction of their Pythagorean enharmonic variants.

While major thirds would be 1 comma larger if a Pythagorean interval (e.g. G4, ratio 81/64) were chosen instead of a harmonic one (G3, ratio 5/4), major fifths also differ by 1 comma, but the Pythagorean fifth (P4, ratio 3/2) is larger than the harmonic one (P3, ratio 40/27). The latter has been called the wolf fifth because its use in melodic phrases or chords is said to sound "out of tune", with a negative/evil magical connotation.

No position on this model requires more than 1 ascending or descending major third. This makes sense to instrument tuners who know that tuning perfect fifths by ear is an easy task that can be repeated in several steps — here a maximum of 5 or 6 up and down. Tuning a harmonic major third, however, requires a little more attention. It would therefore be unrealistic to imagine a precise tuning procedure based on a sequence of major thirds — although this can be achieved with the aid of electronic devices.

At the top of the picture (position "fa#") we notice that neither of the two cycles of fifths closes on itself due to the presence of a Pythagorean comma. The tiny difference (schisma, ratio 1.001129) between Pythagorean and syntonic commas is illustrated by two pairs of positions: P1/M3 and P2/M4.

Another peculiarity at the top of the picture is the apparent disruption of the sequence L-C-M. However, remembering that L = M + C, the regularity is restored by choosing between P1/M3 and P2/M4.

Approximations have no effect on the sound of musical intervals, since no human ear would appreciate a schisma difference (2 cents). However, other differences must remain explicit, since integer ratios indicate the tuning procedure by which the scale can be constructed. Thus the replacement integer ratio may be more complex than the "schismatic" one, as in the case of R1, ratio 256/243 instead of 135/128, because the latter is built with a simple major third above D4 instead of belonging to the Pythagorean series.

Tuning Western instruments

The problem of tuning fixed pitch instruments (harpsichord, pipe organ, pianoforte…) has been well documented by the organ/harpsichord player, builder and musicologist Pierre-Yves Asselin (2000). In his practical approach, just intonation is a background model that can only be approximated on 12-degree scales by temperamentcompromising the pure intervals of just intonation to meet other requirements. Temperament techniques applied to the Bol Processor are discussed on the Microtonality and Comparing temperaments pages.

Source: Pierre-Yves Asselin (2000 p. 61)

The column at the centre of this picture, with notes within ellipses, is a series of perfect fifths which Asselin called "Pythagorean".

Series of fifths are infinite. Selecting seven of them (in the middle column) creates a scale called the "global diatonic framework" (milieu diatonique global, see Asselin 2000 p. 59). In this example, the frameworks are those of "C" and "G" ("do" and "sol" in French).

Extending series of perfect fifths beyond the sixth step produces complicated ratios that can be approximated (with a schisma difference) to those produced by harmonic major thirds (ratio 5/4). Positions on the right (major third up, first order) are one syntonic comma lower than their equivalents in the middle series, and positions on the left (major third down, first order) are one syntonic comma higher.

It is possible to create more columns on the right ("DO#-2", "SOL#-2" etc.) for positions created by 2 successive jumps of a harmonic major third, and in the same way on the left ("DOb#+2", "SOLb#+2" etc.), but these second-order series are only used for the construction of temperaments — see page Microtonality.

This model produces 3 to 4 positions for each note, a 41-degree scale, which would require 41 keys (or strings) per octave on a mechanical instrument! This is one reason for the tempering of intervals on mechanical instruments, which amounts to selecting the most appropriate 12 positions for a given musical repertoire.

This tuning scheme is displayed on scale "3_cycles_of_fifths" in the "-to.tryTunings" tonality resource of Bol Processor.

Series of names have been entered, together with the fraction of the starting position, to produce cycles of perfect fifths in the scale. Following Asselin's notation, the following series have been created (trace generated by the Bol Processor):

  1. From 4/3 up: FA, DO, SOL, RE, LA, MI, SI, FA#, DO#, SOL#, RE#, LA#
  2. From 4/3 down: FA, SIb, MIb, LAb, REb, SOLb
  3. From 320/243 up: FA-1, DO-1, SOL-1, RE-1, LA-1, MI-1, SI-1, FA#-1, DO#-1, SOL#-1, RE#-1, LA#-1
  4. From 320/243 down: FA-1, SIb-1, MIb-1, LAb-1, REb-1, SOLb-1
  5. From 27/20 up: FA+1, DO+1, SOL+1, RE+1, LA+1, MI+1, SI+1, FA#+1, DO#+1, SOL#+1, RE#+1, LA#+1
  6. From 27/20 down: FA+1, SIb+1, MIb+1, LAb+1, REb+1, SOLb+1

This was more than enough to determine the 3 or 4 positions of each note, since several notes can reach the same position at a schisma distance. For example, "REb" is in the same position as "DO#-1". The IMAGE link shows this scale with (simplified) frequency relationships:

The "3_cycles_of_fifths" scale: a graphical representation of three series of perfect fifths used to perform Western music in "just intonation" according to Asselin (2000).
(Image created by Bol Processor)

Compared to the model advocated by Arnold (1974, see figure above), this system accepts harmonic positions on either side of the Pythagorean positions, which means that Sa ("C" or "do"), like all unaltered notes, can take three different positions. In Indian music, Sa is unique because it is the fundamental note of every classical performance of a raga, fixed by the drone (tanpura) and tuned to suit the singer or instrumentalist. However, we will see that transpositions (murcchana-s) of the basic Indian scale(s) produce some of these additional positions.

A tuning scheme based on three (or more) cycles of perfect fifths is a good grid for constructing basic chords in just intonation. For example, a "C major" chord is made up of its tonic "DO", its dominant "SOL" a perfect fifth higher, and "MI-1" a major harmonic third above "DO". The first two notes can belong to a Pythagorean series (blue marks on the graph) and the last one to a harmonic series (green marks on the graph). Minor chords are constructed in a similar way, which will be explained later.

This does not completely solve the problem of playing tonal music with just intonation. Sequences of chords must be correctly aligned. For example, should one use the same "E" in "C major" and in "E major"? The answer is "no", but the rule must be made explicit.

How is it possible to choose the right one among the 37 * 45 = 2 239 488 chromatic scales shown in this graph?

In the approach of Pierre-Yves Asselin (2000) — inspired by the work of Conrad Letendre in Canada — rules were derived from options validated by listeners and musicians. Conversely, the grama framework exposed below is a "top-down" approach — from a theoretical model to its evaluation by practitioners.

The grama framework

Using Bharata's model — see page The two-vina experiment — we can construct chromatic (12-degree) scales in which each tonal position (out of 11) has two options: harmonic or Pythagorean. This is one reason to say that the framework is based on 22 shruti-s. In Indian musicological literature, the term shruti is ambiguous, as it can mean either a tonal position or an interval.

In Bol Processor BP3 this "grama" framework is edited as follows in "-to.12_scales":

The 22-shruti framework as per Bharata's model with a syntonic comma of 22 cents (see full image)

We use lower-case labels for R1, R2 etc. and append a '_' after labels to distinguish enharmonic positions from octave numbers. So, "g3_4" means G3 in the fourth octave.

Two options for each of the 11 notes yields a set of 211 = 2048 chromatic scales. Of these, only 12 are "optimally consonant", i.e. they contain only one wolf fifth (smaller by 1 syntonic comma). These 12 scales are the ones used in harmonic or modal music to experience maximum consonance. The author(s) of Naya Shastra had this intention in mind when they described a basic 12-tone "optimal" scale called "Ma-grama". This scale is called "Ma_grama" in tonality resource "-to.12_scales":

The "Ma-grama" basic chromatic scale built on the 22-shruti framework (see full image)

Click on the IMAGE link on the "Ma_grama" page to obtain a graphical representation of this scale:

The Ma-grama chromatic scale, Bol Processor graphic display

In this picture the perfect fifths are blue lines and the (unique) wolf fifth between C and G is a red line. Note that positions marked in blue ("Db", "Eb" etc.) are Pythagorean and harmonic positions ("D", "E" etc.) appear in green. Normally, a "Pythagorean" position on this framework is one where neither the numerator nor the denominator of the fraction is a multiple of 5. Multiples of 5 indicate jumps of harmonic major thirds (ratio 5/4 or 4/5). This simple rule is broken, however, when complex ratios are replaced by simple equivalents at a distance of one schisma. Therefore, the blue and green markings on the Bol processor images are mainly used to facilitate the identification of a position: a note appearing near a blue marking could as well belong to the harmonic series with a more complex ratio, bringing it close to the Pythagorean position.

It will be important to remember that all the notes of the Ma-grama scale are in their lowest enharmonic positions. Other scales are created by raising a few notes by a comma.

This Ma-grama is the starting point for the generation of all "optimally consonant" chromatic scales. This is done by transposing perfect fifths (upwards or downwards). The visualisation of transpositions becomes clear when the basic scale is drawn on a circular wheel which is allowed to move within the outer crown shown above. The following is Arnold's complete model, showing the Ma-Grama in the basic position, producing the "Ma01" scale:

The fixed (outer) and movable (inner) shruti wheels in position for the "M1" transposition of Ma-grama, which produces the "Ma01" scale

This positioning of the inner wheel on top of the outer wheel is called a "transposition" (murcchana).

Intervals are shown on the graph. For example, R3 ("D" = "re") is a perfect fifth to D3 ("A" = "la").

The "Ma01" scale produced by this M1 transposition produces the "A minor" chromatic scale with the following intervals:

CDb c+m D c+l Eb c+m E c+l F c+m F# c+l GAb c+m A c+l Bb c+m B c+l C

  • m = minor semitone = 70 cents
  • l = limma = 90 cents
  • c = comma = 22 cents
The "A minor" chromatic scale produced by the M1 transposition of Ma-grama (i.e. "Ma01")

This construction of the "A minor" scale corresponds to the Western scheme for the production of just intonated chords: the fundamental "A" (ratio 5/3) is "LA-1" on the "3_cycles_of_fifths" scale, which is in the "major third upwards" series as well as its dominant "MI-1", while "C" (ratio 1/1) belongs to the "Pythagorean" series.

At first sight, the scale constructed by this M1 transposition also resembles a "C major" scale, but with a different choice of R3 (harmonic "D" ratio 10/9) instead of R4 (Pythagorean "D" ratio 9/8). To produce the "C major" scale, "D" should be raised to its Pythagorean position, which amounts to R4 replacing R3 on Bharata's model. This is done by using an alternative root scale called "Sa-Grama" in which P4 replaces P3.

P3 is called "cyuta Pa" meaning "Pa lowered by one shruti" — here a syntonic comma. The wheel representation suggests that other lowered positions may later be highlighted by the transposition process, namely cyuta Ma and cyuta Sa.

At the bottom of the "Ma01" page on "-to.12_scales", all the intervals of the chromatic scale are listed, with the significant intervals highlighted in colour. The wolf fifth is coloured red. Note that when the scale is optimally consonant, only one cell is coloured red.

Harmonic structure of the "Ma01" transposition of Ma-grama, as displayed by the Bol Processor
Ma01 tuning scheme, displayed by the Bol Processor

A tuning scheme is suggested at the bottom of page "Ma01". It is based on the (purely mechanical) assumption that perfect fifths are tuned first within the limit of 6 steps. Then harmonic major thirds and minor sixths are highlighted, and finally Pythagorean thirds and minor sixths can also be taken into account.

Exporting a major chromatic scale with the sensitive note raised by 1 comma

We can use "Ma01" as a 23-degree microtonal scale in Bol Processor productions because all the notes relevant to the chromatic scale have been labelled. However it is more practical to extract a 12-degree scale with only labelled notes. This can be done on the "Ma01" page. The image shows the exportat of the "Cmaj" scale with 12 degrees and a raised position of D.

Using "Cmaj" for the name makes it easy to declare this scale in its specific harmonic context. In the same way, a 12-degree "Amin" can be exported without raising the "D".

"D" ("re") is therefore the sensitive note when switching between the "C major" scale and its relative "A minor".

In all 12-degree exported scales it is easy to change the note convention — English, Italian/Spanish/French, Indian or key numbers. It is also possible to select diesis in replacement of flat and vice versa, as the machine recognises both options.

Producing the 12 chromatic scales

A PowerPoint version of Arnold's model can be downloaded here and used to check the transpositions produced by the Bol Processor BP3.

Creating "Ma02" as a transposition of "Ma01"

To create successive "optimally consonant" chromatic scales, the Ma-grama should be transposed by descending or ascending perfect fifths.

For example, create "Ma02" by transposing "Ma01" from a perfect fourth "C to F" (see picture). Nothing else needs to be done. All the transpositions are stored in tonality resource "-to.12_scales". Each of these scales can then be used to export a minor and a major chromatic scale. This procedure is explained in detail on the page Creation of just-intonation scales.

Enharmonic shift of the tonic

An interesting point raised by James Arnold in our paper L'intonation juste dans la théorie ancienne de l'Inde : les applications aux musiques modale et harmonique (1985) is the comparison of minor and major scales of the same tonic, for example moving from "C major" to "C minor".

To get the "C minor" scale, we need to create "Ma04" by using four successive descending fifths (or ascending fourths). Note that writing "C to F" on the form does not always produce a perfect fourth transposition because the "F to C" interval may be a wolf fifth! This happens when going from "Ma03" to "Ma04". In this case, select, for example, "D to G".

From "Ma04" we export "Cmin". Here comes a surprise:

(See full image)
The "C minor" scale derived from the "Ma04" transposition of Ma-grama

The intervals are those predicted (see "A minor" above), but the positions of "G", "F" and "C" have been lowered by one comma. This was expected for "G" because of the replacement of P4 by P3. The bizarre situation is that both 'C' and 'F' are one comma lower than what seemed to be their lowest (or only) position in the 22-shruti model. The authors of Natya Shastra had anticipated a similar process when they invented the terms "cyuta Ma" and "cyuta Sa"

This shifting of the base note can be seen by moving the inner wheel. After 4 transpositions, the position M1 of the inner wheel will correspond to the position G1 of the outer wheel, giving the following configuration:

The "Ma04" transposition of Ma-grama showing lowered C, F and G

This shift of the tonic was presented as a challenging finding in our paper (Arnold & Bel 1985). Jim Arnold had done experiments with Pierre-Yves Asselin playing Bach's music on the Shruti Harmonium and both liked the shift of the tonic on minor chords.

Two options for tuning a "C minor" chord. Source: Asselin (2000)

Pierre-Yves himself mentions a one-comma lowering of "C" and "G" in the "C minor" chord. However, this was one of two options predicted by his theoretical model. He tested it by playing the Cantor electronic organ at the University, and reports that musicians found this option to be more pungent"déchirant" — (Asselin 2000 p. 135-137).

The other option (red on the picture) was that each scale be "aligned" in reference to its base note "C" ("DO"). This alignment (one-comma raising) can be done clicking button "ALIGN SCALE" on scale pages wherever the basic note ("C") is not at position 1/1. Let us listen to the "C major"/ "C minor" / "C major" sequence, first "non-aligned" then "aligned":

"C major"/ "C minor" / "C major" sequence, first non-aligned then aligned

Clearly, the "non-aligned" version is more pungent than the "aligned" one.

This choice is based on perceptual experience, or "pratyakṣa pramāṇa" in Indian epistemology — see The two-vina experiment. We take an empirical approach rather than seeking an "axiomatic proof". The question is not which of the two options is true, but which one produces music that sounds right.

Checking the tuning system

Checking a chord sequence

The construction of just intonation using the grama-murcchana procedure needs to be checked in typical chord sequences such as the "I-IV-II-V-I" series discussed by Pierre-Yves Asselin (2000 p. 131-135):

After trying out five options suggested by his theoretical model, the author chose the one preferred by all the musicians. This is the intonation they spontaneously choose when singing, without any special instruction. This version also corresponds to Zarlino's "natural scale".

The best option for a just-intonation rendering of the
"I-IV-II-V-I" harmonic series (Asselin 2000 p. 134)

In the preferred option, the tonics "C", "F" and "G" belong to the Pythagorean series of perfect fifths, except "D" in the "D minor" chord which is one comma lower than in "G major".

In the picture, the triangles with the top pointing to the right are major chords, and the one pointing to the left is the "D minor" chord.

Asselin (2000 p. 137) concludes that the minor mode is one syntonic comma lower than the major mode. Conversely, the major mode should be one syntonic comma higher than the minor mode.

This is fully consistent with the model constructed by grama-murcchana. Since minor chromatic scales are exported from transpositions of Ma-grama with all its degrees in the lowest position, their base notes are also driven to the lowest positions. However this requires a scale "adjustment" in the cases of "Ma10", "Ma11" and "Ma12" so that no position is created outside the basic Pythagorean/harmonic scheme of the Indian system. Looking at Asselin's drawing (above), this means that no position would be picked up in the 2nd-order series of fifths in the rightmost column with two successive ascending major thirds resulting in a lowering of 2 syntonic commas. This process is explained in more detail on the page Creation of just-intonation scales.

Let us listen to the production of the "-gr.tryTunings" grammar:

S --> Temp - Just
Temp --> Cmaj Fmaj Dmin Gmaj Cmaj
Just --> _scale(Cmaj,0) Cmaj _scale(Fmaj,0) Fmaj _scale(Dmin,0) Dmin _scale(Gmaj,0) Gmaj _scale(Cmaj,0) Cmaj
Cmaj --> {C3,C4,E4,G4}
Fmaj --> {F3,C4,F4,A4}
Dmin --> {D3,D4,F4,A4}
Gmaj --> {G3,B3,D4,G4}

First we hear the sequence of chords in equal temperament, then in just intonation.

The "I-IV-II-V-I" harmonic series in equal-tempered and just-intonation

The identity of the last occurrence with Asselin's favourite choice is marked by frequencies in the C-sound score: "D4" in the third chord (D minor) is one comma lower than "D4" in the fourth chord (G major), while all other notes (e.g. "F4") have the same frequencies in the four chords.

; I - Cmaj
i1 6.000 1.000 130.815 90.000 90.000 0.000 0.000 0.000 0.000 ; C3
i1 6.000 1.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 6.000 1.000 327.038 90.000 90.000 0.000 0.000 0.000 0.000 ; E4
i1 6.000 1.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 ; G4

; IV - Fmaj
i1 7.000 1.000 174.420 90.000 90.000 0.000 0.000 0.000 0.000 ; F3
i1 7.000 1.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 7.000 1.000 348.840 90.000 90.000 0.000 0.000 0.000 0.000 ; F4
i1 7.000 1.000 436.050 90.000 90.000 0.000 0.000 0.000 0.000 ; A4

; II - Dmin
i1 8.000 1.000 145.350 90.000 90.000 0.000 0.000 0.000 0.000 ; D3
i1 8.000 1.000 290.700 90.000 90.000 0.000 0.000 0.000 0.000 ; D4
i1 8.000 1.000 348.840 90.000 90.000 0.000 0.000 0.000 0.000 ; F4
i1 8.000 1.000 436.050 90.000 90.000 0.000 0.000 0.000 0.000 ; A4

; V - Gmaj
i1 9.000 1.000 196.222 90.000 90.000 0.000 0.000 0.000 0.000 ; G3
i1 9.000 1.000 245.278 90.000 90.000 0.000 0.000 0.000 0.000 ; B3
i1 9.000 1.000 294.334 90.000 90.000 0.000 0.000 0.000 0.000 ; D4
i1 9.000 1.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 ; G4

; I - Cmaj
i1 10.000 1.000 130.815 90.000 90.000 0.000 0.000 0.000 0.000 ; C3
i1 10.000 1.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 10.000 1.000 327.038 90.000 90.000 0.000 0.000 0.000 0.000 ; E4
i1 10.000 1.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 ; G4
s

To summarise, the tonic and dominant of each minor chord belong to the "lower" harmonic series of perfect fifths appearing in the right-hand column of Asselin's drawing reproduced above. Conversely, the tonic and dominant of each major chord belong to the "Pythagorean" series of perfect fifths in the middle column.

Checking note sequences

Switches for (programmable) enharmonic adjustments on Bel's Shruti Harmonium (1980)

The rules for determining the relative positions of major and minor modes (see above) deal only with the three notes that define a major or minor chord. Transpositions (murcchana-s) of the Ma-grama produce basic notes in the same positions, but these are also chromatic (12-degree) scales. Therefore, they also establish the enharmonic positions of all the notes that would be played in that harmonic context.

Do these comply with just intonation? In theory, yes, because the 12 chromatic scales obtained by these transpositions are "optimally consonant": each of them contains no more than a wolf fifth.

In 1980, James Arnold conducted experiments to verify this theoretical model using my Shruti harmonium, which produced programmed intervals to an accuracy of 1 cent. Pierre-Yves Asselin played classical pieces while Jim manipulated switches on the instrument to select enharmonic variants.

Listen to three versions of an improvisation based on Mozart's musical dice game. The first one is equal-tempered, the second one uses Serge Cordier's equal-tempered scale with an extended octave (1204 cents, see Microtonality) and the third uses several different scales to reproduce a just intonation. To this end, variables pointing to scales based on the harmonic context have been inserted in the first grammar rules:

S --> _vel(80) Ajust Bjust
Ajust --> Cmaj A1 A2 Gmaj A3 Cmaj A4 Dmaj A5 Cmaj A6 Gmaj A7 A8 Cmaj A1 A2 Gmaj A3 Cmaj A4 Dmaj A5 Cmaj A6 Gmaj A7 A'8
Bjust --> Gmaj B1 Cmaj B2 Dmaj B3 Cmaj B4 Fmaj B5 B6 Gmaj B7 Cmaj B8 Gmaj B1 Cmaj B2 Dmaj B3 Cmaj B4 Fmaj B5 B6 Gmaj B7 Cmaj B8
Cmaj --> _scale(Cmaj,0)
Dmaj --> _scale(Dmaj,0)
Fmaj --> _scale(Fmaj,0)
Gmaj --> _scale(Gmaj,0)
… etc.

An example of Mozart's musical dice game, equal-tempered
The same example, equal-tempered scale with octave stretched at 1204 cents
The same example in just intonation

Scale comparison

At the bottom of the pages "-to.12_scales" and "-to.Mozart", all scales are compared for their intervalic content. The comparison is based on fractions where these have been declared, or on floating-point frequency ratios otherwise.

The comparison confirms that the "Amin" chromatic scale is identical to "Fmaj".

By raising "D" in "Ma01" we have created "Sa01", the first transposition of the Sa-grama scale. From "Sa01" we can make "Sa02" etc. by successive transpositions (one fourth upwards). But the comparator shows that "Sa02" is identical to "Ma01".

Similarly, the transpositions "Ma13", "Ma14" etc. are identical to "Ma01", "Ma02" etc. The series of chromatic scales is (as expected) circular, since "Ma13" returns to "Ma01".

Comparison of scales stored in "-to.12_scales"

For more details on frequencies, block keys, etc., see the Microtonality page.

Is this perfect?

This entire page is devoted to tonal systems defined in terms of whole-numbered ratios (i.e. rational numbers) measuring tonal intervals. There were at least two strong incentives for the idea that any "pure" tonal interval should be treated as a ratio of two whole numbers, such as 2/1 for the octave, 3/2 for a "perfect" fifth, 5/4 for a "harmonic" major third, etc.

The history of music (in the West) goes back to ideas attributed to the Greek philosopher "Pythagoras" (see above) , who believed that all things were made of [rational] numbers. This approach stumbled upon the impossibility of making the octave correspond to a series of "perfect fifths"…

As we found out — read above and The Two-vina experiment — this approach was not followed in India despite the fact that Indian scientists were significantly more advanced than the Greeks in the field of calculus (Raju C.K., 2007).

Another incentive to the use of rational numbers was Hermann von Helmholtz's notion of consonance (1877) which became popular after the period of Baroque music in Europe, following the initial claim of a "natural tonal system" by Jean-Philippe Rameau in his Traité de l'harmonie réduite à ses principes naturels (1722). The development of keyboard stringed instruments such as the pipe organ and the pianoforte had made it necessary to develop a tuning system that met the requirements of (approximately) tuneful harmony and transposition to support other instruments and the human voice. It was therefore logical to abandon a wide variety of tuning systems, especially those based on temperament, and to adopt equal temperament as the standard. By this time, composers were no longer exploring the subtleties of melodic/harmonic intervals; harmony involving groups of singers and/or orchestra paved the way for musical innovation.

Looking back to the Baroque period, many musicologists tend to believe that the tuning system advocated by J.S. Bach in The Well-tempered Clavier must have been equal temperament… This belief can be disproved by a systematic analysis of this corpus of preludes and fugues on an instrument using all the tuning systems en vogue during the Baroque period — read the page The Well-tempered Clavier.

Composers and instrument makers did not tune "by numbers", as tuning procedures were not documented (see Asselin P-Y., 2000). Rather, they tuned "by ear" in order to achieve a perceived regularity of sets of intervals: the temperament in general. This was indeed a break with the "Pythagorean" mystique, because these temperaments cannot be reduced to frequency intervals based on integer ratios.

For instance, Zarlino’s meantone temperament — read this page — is made of 12 fifths starting from “E♭” (“mi♭”) up to “G#” (“sol#”) diminished by 2/7 of a syntonic comma (ratio 81/80). The frequency ratio of each fifth is therefore

which cannot be reduced to an integer ratio. In the same way, the twelve intervals of the equal temperament scale are expressed in terms of irrational frequency ratios.

Overture

The goal of just intonation is to produce "optimally consonant" chords and sequences of notes, a legitimate approach when consonance is the touchstone of the highest achievement in art music. This was indeed the case in sacred music, which aimed for a "divine perfection" guaranteed by the absence of "wolf tones" and other oddities. In a broader sense, however, music is also the field of expectation and surprise. In an artistic process, this can mean departing from "rules" — just as poetry requires breaking the semantic and syntactic rules of a language…

Even when chords are perfectly consonant and conform to the rules of harmony (as perceived by the composer), note sequences may deviate from their theoretical positions in order to create a certain degree of tension or to make a better transition to the next chord.

When the Greek-French composer Iannis Xenakis - known for his formalised approach to tonality - heard Bach's First Prelude for Well-Tempered Clavier played on the Shruti Harmonium in just intonation, he declared his preference for the equal-tempered version! This made sense for a composer whose music had been praised by Tom Service for its "deep, primal rootedness in richer and older phenomena even than musical history: the physics and patterning of the natural world, of the stars, of gas molecules, and the proliferating possibilities of mathematical principles" (Service T, 2013).

Bernard Bel — Dec. 2020 / Jan. 2021

References

Arnold, E.J. L’intonation juste dans la théorie ancienne de l’Inde : ses applications aux musiques modale et harmonique. Revue de musicologie, JSTOR, 1985, 71e (1-2), p.11-38.
👉  Download an English translation

Asselin, P.-Y. Musique et tempérament. Paris, 1985, republished in 2000: Jobert. Soon available in English.

Bel, B. A Mathematical Discussion of the Ancient Theory of Scales according to Natyashastra. Note interne, Groupe Représentation et Traitement des Connaissances (CNRS), March 1988a.

Bel, B. Raga : approches conceptuelles et expérimentales. Actes du colloque "Structures Musicales et Assistance Informatique", Marseille 1988b.
👉  Download an English translation

Rao, S.; Van der Meer, W. The Construction, Reconstruction, and Deconstruction of Shruti. Hindustani music: thirteenth to twentieth centuries (J. Bor). New Delhi, 2010: Manohar.

Raju, C. K. Cultural foundations of mathematics : the nature of mathematical proof and the transmission of the calculus from India to Europe in the 16th c. CE. Delhi, 2007: Pearson Longman: Project of History of Indian Science, Philosophy and Culture : Centre for Studies in Civilizations.

Service, T. A guide to Iannis Xenakis's music. The Guardian, 23 April 2013.

Microtonality

This article focuses on the Bol Processor as a tool for creating and manipulating musical scales beyond the standard twelve-tone equal temperament. It details how the software handles real-time MIDI and Csound for microtonal tuning, explaining concepts like just intonation and various historical temperaments such as Zarlino's and BACH temperament. The article also discusses the implementation of scales with more than 12 degrees, referencing ancient Indian musicology’s grama-murcchana model and demonstrating how to compare different tunings. Ultimately, the document showcases the software's flexibility in manipulating scales, and its utility for both musical composition and musicological research.

A just-intonation tuning scheme (presumably) used in Western harmony
(Image created by Bol Processor)

Microtonality is a topic addressed by many musical systems that deal with tonal intervals: the use of microtones — intervals smaller than a semitone, also called "microintervals". It can also be extended to include any music that uses intervals not found in the common Western tuning of twelve equal intervals per octave. In other words, a microtone can be thought of as a note that falls between the keys of a piano tuned to equal temperament (Wikipedia).

All examples shown on this page are available in the sample set bp3-ctests-main.zip, which is shared via GitHub. Follow the instructions on page Bol Processor ‘BP3’ and its PHP interface to install BP3 and learn its basic operation.

👉  BP3 is able to handle microtonality in real-time MIDI as well as in Csound. — read the Check MIDI microtonality page for practical details.

A brief presentation

On electronic instruments such as the Bol Processor, microtonality is a matter of "microtonal tuning", here meaning the construction of musical scales alien to the conventional one(s).

Equal temperament is an intuitive model that divides the octave (frequency ratio 2/1) into 12 "equal" intervals called semitones. Each semitone has a frequency ratio of 2 1/12 = 1.059. Tonal intervals are generally expressed on a logarithmic scale, which gives the ratio 2/1 a value of 1200 cents. Each semitone is therefore worth 100 cents in a conventional scale system.

An equal tempered scale is useful for making a piece of music sound the same when transposed to another key. However, its intervals do not correspond to the (presumably) "natural" intervals constructed from whole-number frequency ratios using the numbers 3, 4, 5. These simple ratios give the impression of consonance because the frequencies of the upper partials (harmonics) can coincide: if two strings vibrate at a frequency ratio of 3/2 (a "perfect fifth"), the 3rd harmonic of the lowest vibration is at the same frequency as the 2nd harmonic of the higher vibration.

In an equal tempered scale, the harmonic major third (C-E) of 400 cents has a ratio of 1.26 instead of 1.25 (5/4). The major fifth (C - G) also sounds slightly "out of tune" with a ratio of 1.498 instead of 1.5 (3/2). These mismatches can produce beats that are considered unpleasant in harmonic contexts.

When tuning stringed instruments (such as the piano), octaves can be stretched a little to compensate for a slight inharmonicity of the upper partials produced by vibrating strings (in higher octaves), as advocated by Serge Cordier. A value of 1204 cents sounds fair, with the added advantage of making fifths sound "perfect" in a 3/2 ratio. With this setting, the frequency ratio of the stretched octaves is 2(1204/1200) = 2.0046. This effect can be reproduced in electronic instruments such as digital pianos that imitate mechanical ones. We will see how it can be implemented in the Bol Processor BP3.

Cembalo Cromatico (University of the Arts Bremen). A 19-key-per-octave instrument with electromechanical commands.

Musicologists agree that equal temperament was never exactly achieved on classical instruments such as pipe organs and harpsichords. Rather, instrument tuners have developed rules for reproducing the most pleasing intervals in particular musical contexts. In other words, a mechanical instrument should be tuned according to a style and repertoire of music. Pierre-Yves Asselin (2000) has published a detailed compilation of tuning techniques used by European musicians and instrument makers over the past centuries — listen to examples on the page Comparing temperaments. The same flexibility can be achieved with sounds produced by "algorithms".

Outside of Western classical music, a wide variety of tonal systems deliberately reject 12-tone-per-octave tonality. Arabic-Andalusian music is often described as a "quartertone" system, which divides the octave into 24 intervals. Equal tempered scales of 7 degrees have been identified on various traditional African instruments. The grama-murcchana theoretical model of tonal music in India claims the use of 22 shruti-s, presumably microintervals of unequal size (see below).

Many unconventional systems have been invented and applied to contemporary music, often departing from octave-repeating scales. See for, example, the Bohlen-Pierce scale, which is based on a 3/1 interval (a "tritave") divided into 13 grades/notes — see the MIDI microtonality page. All these scales can be implemented in the Bol Processor.

The scale() operator in Bol Processor BP3

We'll be discussing the use of scales in the context of Csound, although the same is possible in the real-time MIDI and MIDI file environment — read this page. When using MIDI, the machine recognises that MIDI microtonality mode is required as soon as it sees a "scale()" operator. If a tonal resource (a "-to" file) is specified in the grammar or data, all scales listed in the resource will be accessible.

For geeks: Csound scores are flexible in the way they represent tonal positions. A common convention is the octave point pitch class. For example, the note "A4" would be assigned the tonal position "8.09", meaning that it is the 9th note in the 8th octave (in the English convention). This value produces a note at the diapason frequency (usually 440 Hz) on a Csound instrument.
It is also possible to specify the note position by its frequency in cycles per second (cps mode). This allows a high level of accuracy as frequencies are expressed in floating point format. For example, "A4" is equivalent to "440.0". Accuracy better than 1‰ is not noticeable.
As explained on page Csound tuning in BP3, it is possible to send notes in both the octave point pitch class and cps formats to the same Csound instrument.
In fact, microtonal scores will only use cps. The cps mode is also used by BP3 whenever the diapason frequency is not exactly 440 Hz. To make all frequencies visible on Csound scores, for example, set the diapason to "400.01"…

Let us take a simple example to demonstrate the use of multiple scales. The grammar is:

-se.tryScales
-cs.tryScales
-to.tryScales
ORD
S --> _scale(0,0) C4 E4 A4 {8,{C4,E4,G4,C5}} {8,{C4,Eb4,G4,C5}} - _scale(piano,C4) C4 E4 A4 {8,{C4,E4,G4,C5}}{8,{C4,Eb4,G4,C5}} - _scale(just intonation,C4) C4 E4 A4 {8,{C4,E4,G4,C5}} {8,{C4,Eb4,G4,C5}}

In this grammar, the same sequence is repeated three times in different tunings:

  • _scale(0,0) is the default tuning = 12-degree equal-tempered
  • _scale(piano, C4) refers to the "piano" scale
  • _scale(just intonation, C4) refers to a (so-called) "just-intonation" scale

Note "C4" appearing in these operators is the block key, here meaning the key that must correspond to its equal temperament value in the tuning set by the scale.

It may be necessary to listen several times to notice subtle differences:

A musical sequence repeated 3 times in equal-tempered, stretched octave ("piano") and "just intonation"

The sound is produced by the Csound instrument "new-vina.orc" designed by Srikumar Karaikudi Subramanian to imitate the Sarasvati vina, a long-stringed instrument played in South India — listen to his demo: Sarasvati vina. This type of instrument is capable of highlighting the finest tonal subtleties.

Beats are audible in the equal-tempered version, but slightly less so in the piano version, and almost absent in the just-intonation rendering. Looking at the Csound score makes it easy to check theoretical models:

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

t 0.000 60.000
i1 0.000 1.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 1.000 1.000 8.04 90.000 90.000 0.000 0.000 0.000 0.000 ; E4
i1 2.000 1.000 8.09 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 3.000 8.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 3.000 8.000 8.04 90.000 90.000 0.000 0.000 0.000 0.000 ; E4
i1 3.000 8.000 8.07 90.000 90.000 0.000 0.000 0.000 0.000 ; G4
i1 3.000 8.000 9.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C5
i1 11.000 8.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 11.000 8.000 8.03 90.000 90.000 0.000 0.000 0.000 0.000 ; Eb4
i1 11.000 8.000 8.07 90.000 90.000 0.000 0.000 0.000 0.000 ; G4
i1 11.000 8.000 9.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C5

i1 20.000 1.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; dop3
i1 21.000 1.000 329.915 90.000 90.000 0.000 0.000 0.000 0.000 ; mip3
i1 22.000 1.000 440.585 90.000 90.000 0.000 0.000 0.000 0.000 ; lap3
i1 23.000 8.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; dop3
i1 23.000 8.000 329.915 90.000 90.000 0.000 0.000 0.000 0.000 ; mip3
i1 23.000 8.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 ; solp3
i1 23.000 8.000 524.463 90.000 90.000 0.000 0.000 0.000 0.000 ; dop4
i1 31.000 8.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; dop3
i1 31.000 8.000 311.340 90.000 90.000 0.000 0.000 0.000 0.000 ; mibp3
i1 31.000 8.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 ; solp3
i1 31.000 8.000 524.463 90.000 90.000 0.000 0.000 0.000 0.000 ; dop4

i1 40.000 1.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj4
i1 41.000 1.000 327.038 90.000 90.000 0.000 0.000 0.000 0.000 ; Ej4
i1 42.000 1.000 436.137 90.000 90.000 0.000 0.000 0.000 0.000 ; Aj4
i1 43.000 8.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj4
i1 43.000 8.000 327.038 90.000 90.000 0.000 0.000 0.000 0.000 ; Ej4
i1 43.000 8.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 ; Gj4
i1 43.000 8.000 523.260 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj5
i1 51.000 8.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj4
i1 51.000 8.000 313.956 90.000 90.000 0.000 0.000 0.000 0.000 ; Dj#4
i1 51.000 8.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 ; Gj4
i1 51.000 8.000 523.260 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj5
s

In the Csound score, note names have been automatically replaced with their translations in the definitions of scales piano and just intonation (see below). For example, in the piano scale of this example, 'C4', 'D4', 'E4'… have been replaced by 'do3', 're3', 'mi3' with an additional 'p' marker: 'dop3', 'rep3', 'mip3'…
In the same way, just intonation notes are labelled 'Cj4', 'Dj4', 'Ej4' etc. This renaming is optional since all these scales are made up of 12 degrees with identical key positions, but it is used here to make the Csound score more explicit.

The use of "C4" as a block key means that it is always played at a frequency of 261.630 Hz. Consequently, "A4" is at 440 Hz in the first occurrence and a little higher in the piano version due to the octave stretching with a ratio of 524.463 / 261.630 = 2.0046, which is 1204 cents.

Finally, we notice that, as predicted by the model, the perfect major fifth (C - G) produces the same positions (392.445 Hz) in the piano and just intonation scales.

In reality, the "just intonation" fragment in this example would be out of tune if we follow the framework of tonality proposed by Asselin (2000) and confirmed by an extension of the ancient grama-murcchana system in India. In the last "C minor" chord {C4, Eb4, G4, C5}, the notes "C4", "C5" and "G4" should be lowered by a syntonic comma. This means that playing "just intonation" in Western harmony requires more than a single just-intonation scale: each harmonic context requires its own specific tuning, which indeed cannot be achieved on keyboard instruments. A method for constructing just-intonation scales and using them in Bol Processor music is given on the Just intonation: a general framework page.

Looking at two scales

From the grammar page "-gr.tryScales" we can follow the tonal resource file "-to.tryScales" which contains scale definitions. Csound instrument definitions are contained in "-cs.tryScales", along with the instruction

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

telling the Csound instrument to use the "vina" waveform. From August 2024, tonal resources and Csound instruments are stored in separate files, as microtonality is no longer reserved for Csound.

The following is a representation of the piano scale (Cordier's equal temperament):

The "piano" scale: 12-tone equal-tempered with an octave stretching of 4 cents (see full image).
Note buttons for export/import of SCALA and KBM files.

All the intervals were set in a single click, after entering "1204" as the size of the octave in cents, which set the last ratio to 2.004 (approximately 501/250). The "INTERPOLATE" button was then clicked to calculate the intermediate ratios.

The scale is displayed as a circular graph by clicking on the "IMAGE" link:

The "piano" scale proposed by Serge Cordier. Note that the size of the whole circle is 1204 cents, not 1200!

The display confirms that the position of "G" ("solp") is in the ratio 3/2 or 702 cents. However, the tonal distance between "G" ("solp") and "D" ("rep") is slightly smaller (699 cents), which means that this scale is not a pure cycle of fifths, as the latter would have ended after 12 steps with an octave extended by a Pythagorean comma (scale "twelve_fifths" in "-to.tryScales"):

Cycle of 12 perfect fifths ending with the "last C" one Pythagorean comma higher (approximately 81/80 = 22 cents)

The basekey is the key used to produce basefreq. Here basefreq is set to 261.630 Hz for key #60 which is usually the "middle C" on a piano keyboard. The basefreq parameter has an effect on the pitch which is further adjusted by the value of the diapason entered in "-se.tryScales". If the diapason is set to 430 Hz, the frequency of "C4" would be 261.630 x 430 / 440 = 255.68 Hz.

The baseoctave parameter is not stored in the Csound function table, but it is required by the Bol Processor to name notes correctly. This scale uses the Italian/French note convention, where key #60 is called "do3" instead of "C4". Therefore baseoctave = 3.

Temperament

At the bottom of the "Scale" page is a form for constructing scales in musical temperament. The scope of this procedure is wider than usual because the interface permits the modification of any series of intervals, not just fifths and fourths.

Bol Processor procedures for the production of tempered scales (and all scales in general) can be used both to visualise/hear intervals and chords derived from a theoretical description of the scale, and to check that a procedure for tuning a mechanical instrument conforms to its theoretical description. Below is an example of both approaches applied to Zarlino's meantone temperament (tempérament mésotonique).

The long history of the temperament in European music is covered in Pierre-Yves Asselin's dissertation and publication (2000, p. 139-150). During the 16th and 17th centuries, European musicians tended to prefer "pure" major thirds (frequency ratio 5/4) at the cost of compromising the size of the fifths. This was called the "pure third meantone temperament" (tempérament mésotonique à tierces majeures pures) which was generally achieved by reducing the size of certain fifths by a fraction of the syntonic comma (Asselin 2000 p. 76). After this period, there was another fashion of using perfect fifths (frequency ratio 3/2) and compromising the size of major thirds in the same way. Both methods — and many more — are implemented in the Bol Processor. Algorithmic tuning is indeed easier to achieve than tuning a mechanical instrument!

Zarlino, theory

Let us try Zarlino's meantone temperament (Asselin 2000 p. 85-87) which was popular in the 16th and 17th centuries. It consists of 12 fifths starting from "E♭" ("mi♭") up to "G#" ("sol#") diminished by 2/7 of a syntonic comma — that is 6 cents.

This should not be confused with Zarlino's "natural scale", an instance of just intonation.

Theoretically, this takes two steps from the previously known position "C".

First, we enter the starting note "do" and the sequence of fifths "do, sol, re, sol#," specifying a ratio of 3:2 with a -2/7 comma modification (see picture).

Then we do the same with fourths (descending fifths) starting from "do" ("C") down to "mi♭" ("E♭").

The result is displayed by clicking on the IMAGE link:

Zarlino's meantone temperament (source Asselin 2000 p. 85)

In this temperament, the harmonic major thirds (green connections on the graph) are equal and slightly smaller (384 cents) than the "pure" ones (ratio 5/4 or 386 cents). Semitones between unaltered and altered notes are equal (71 cents). All major tones are equal (192 cents) except "do#-mi♭" and "sol#-sib" (242 cents).

Noticeable dissonances are found in the "sol#-mi♭" fifth (746 cents, i.e. an extra 2 + 1/7 commas = 44 cents) and major thirds such as "sol#-do", "do#-fa", "fa#-sib" and "si-mi♭" which are larger (433 cents) than Pythagorean major thirds (408 cents). Obviously, these intervals are not intended to be used in the musical repertoire to which this tuning is applied…

Zarlino meantone temperament, table of intervals (in cents)

Comparison

A layperson might wonder whether small tonal adjustments — often less than a quarter of a semitone (i.e. 25 cents) — have any noticeable effect on musical works using these tuning systems. Comparative experiments are easy with the Bol Processor.

For example, let us play one (of a billion variations) of Mozart's musical dice game, with tuning options selected by activating a first rule in "-gr.Mozart":

// gram#1[1] S --> _vel(80)_tempo(3/4) _scale(0,0) A B // Equal temperament
// gram#1[2] S --> _vel(80) _tempo(3/4) _scale(piano,0) A B // Equal temperament (Cordier)
// gram#1[3] S --> _vel(80) _tempo(3/4) _scale(Zarlino_temp,0) A B // Zarlino's temperament
// gram#1[4] S --> _vel(80) _tempo(3/4) Ajust Bjust // Just intonation

Musical productions are listed below. The random seed has been set to 998 (in "-se.Mozart") as this variation contains a greater number of chords, and the performance has been slowed down by "_tempo(3/4)".

It is important to remember that of these options, only the first three ones (temperaments) are accessible on fixed-pitch MIDI instruments with 12-degree keyboards. The last one (just intonation) requires a "retuning" of each harmonic content, which is possible if the instrument accepts pitchbender corrections — see page MIDI microtonality.

The first option (equal temperament) is the default tuning of most electronic instruments:

Equal temperament on Mozart's dice game

The second option is an equal temperament with octaves stretched by 4 cents, as advocated by Serge Cordier (see above):

Equal temperament with stretched octaves (Cordier)

The third option is Zarlino's temperament:

Zarlino's temperament

The last option is "just intonation":

Just intonation

Zarlino: a simulation of physical tuning

The tuning of mechanical instruments (such as a harpsichords) requires different procedures from the programming of "tempered" scales on the Bol processor. However, by using the computer, it is possible to quickly verify that the mechanical procedure would produce the expected result. Let us demonstrate this using Zarlino's temperament.

On the computer we had programmed a series of 7 ascending fifths diminished by a 2/7 comma from "do" to "do#". This is impossible to achieve "by ear" on a mechanical instrument. Pierre-Yves Asselin (2000 p. 86) revealed the method shown below.

First step

From "do", tune two successive major thirds. This results in a "sol#" which is positioned at a frequency ratio of 25/16 (773 cents) above "do".

This "sol#" is actually "SOL#+2" of the 2nd order harmonic fifths down series in Asselin's tuning framework (2000 p. 62) — see page Just intonation: a general framework. It is not exactly the one expected on Zarlino's meantone temperament, although it is close. It is labelled "sol2#".

Second step

From "sol2#" tune down a perfect fifth, resulting in "do#".

Be careful to program a perfect fifth, which is specified on the form as "add 0/1 comma". There is also a form for creating series of perfect fifths which can be used for this step.

The resulting "do#" (ratio 1.04166) is exactly 52/3/23, as expected in Zarlino's meantone temperament (Asselin 2000 p. 194).

Third step

Tune 7 equal fifths between "do" and "do#". Equalising fifths is a typical procedure for tuning mechanical instruments. Notes "sol", "re", "la", "mi", "si", "fa#" will be created. Here we specify that all intervals need to be close to the fraction 3/2, even though they will end up as fifths diminished by a 2/7 comma since we clicked the EQUALIZE INTERVALS button.

The missing notes "sol", "re", "la", "si", "fa#" are created. For the existing note "mi", the machine checks that its current position is close to the one predicted by the approximate fraction.

The graph shows that the calculated position of "mi" (ratio 1.248) is slightly different from its previous position (1.25), but this difference is negligible. We keep both positions on the graph, knowing that only one will occur in a physical tuning.

Fourth step

Now tune down 3 fifths from "do" to "mi♭", diminished by a 2/7 comma. This can be done by reproducing "by ear" intervals created in the previous step. Another method is to tune "mi♭" a harmonic major third below "sol" as shown on the form.

Fifth step

Once "mi♭" has been tuned we can tune three equal fifths (in fact diminished by 2/7 comma) between "mi♭" and "do". Again we use the "equalize intervals" procedure. At this stage, the positions of "si♭" and "fa" are created.

The result is shown in the graph below:

Zarlino's meantone temperament designed as a simulation of physical tuning

On this graph, the ratio 1.563 for "sol#" is close (within 7 cents) to 1.557 of Zarlino's temperament. On a mechanical instrument, since "mi" tuned by equalising fifths (3d step) was at position 1.248, adjusting the "mi-sol#" major third to a 5/4 ratio would set "sol#" at a better ratio (1.56).

More temperaments

All the temperaments listed in Asselin's thesis can be easily programmed on the Bol Processor. Take, for example, a classical meantone tuning (Asselin 2000 p. 76), popular in the 16th and 17th centuries, also known as Chaumont (Asselin 2000 p. 109). Its aim is to produce "pure thirds" (ratio 5/4). It consists of a series of fifths from "mi♭" ("E♭") to "sol#" ("G#") diminished by a 1/4 comma. The problem is that the tuning scheme — unlike Zarlino's meantone — does not start from "do" ("C"). There are two solutions.

The first solution is to divide the series of fifths into two parts: first create the series "do, sol, re, la, mi, si, fa#, do#, sol#" of ascending fifths, then the series "do, fa, si♭, mi♭" of descending fifths.

In the second solution, we directly create the series "mi♭, si♭, fa, do, sol, re, la, mi, si, fa#, do#, sol#" of ascending fifths, giving the graph shown below.

Classical / Chaumont meantone tuning positioned on mi♭

This tuning is correct but it cannot be used by the Bol Processor console because of the shift of the reference. Complicated procedures would be required to set the diapason (A4 frequency) to the desired standard and to assign the correct key numbers to the notes of the scale.

Fortunately, this problem is solved in a single click by resetting the base of the scale to note "do", which amounts to a rotation of the graph.

We take this opportunity to replace the Italian/French note convention with the English note convention.

The result is the classic meantone scale tuning which is notable for its large number of harmonic major thirds (circa 5/4, green lines):

The same methods can be used to implement another meantone temperament popular at the same time (16th-17th century) which aims to enhance pure minor thirds (Asselin 2000 p. 83). It can also be described as a series of ascending fifths from "mi♭" to "sol#" with a different adjustment: the fifths are diminished by 1/3 comma.

In this tuning, the minor thirds are sized 316 cents (harmonic minor third, frequency ratio 6/5) with the exception of "A#-C#", "D#-F#" and "F-G#" which are all 352 cents:

Pure minor-third meantone temperament
Source: Asselin (2000 p. 101)

The BACH temperament designed by Johann Peter Kellner for the music of the 18th century (Asselin 2000 p. 101-103) contains two varieties of fifths (see tuning scheme). It is therefore not a "meantone" temperament.

It can be programmed in 3 steps:

  1. A series of descending fifths from "do-sol-re-la-mi", diminished by 1/5 comma;
  2. A series of ascending perfect fifths from "do" to "sol♭";
  3. An ascending perfect fifth from "mi" to "si".

The last interval is a remaining fifth "si-sol♭" ("B-G♭") diminished by exactly 1/5 comma (i.e. 697 cents).

The result is close to Werkmeister III (1691) (Asselin 2000 p. 94), with all positions close to the Pythagorean/harmonic series used for just intonation.

BACH temperament designed by Johann Peter Kellner (18th century)
Werckmeister IV temperament
Source: Asselin (2000 p. 96)

The procedures for tuning temperaments with the Bol Processor sometimes differ from those used for physical instruments. Examples are Werckmeister IV (Asselin 2000 p. 96) and Werckmeister V (p. 99). To tune Werckmeister IV on an instrument (see picture), we start by tuning the sequence G C F Bb Eb Ab Db Gb B E as perfect descending fifths. Then interpolate three fifths (diminished by 1/3 comma) between G and E. Then retune G so that G D becomes a perfect fifth, which reduces C G by 1/3 comma. The same is done on E so that A E becomes a perfect fifth and E B is diminished by 1/3 comma. Similar adjustments are made to retune Bb, and finally Ab and Db to obtain the intervals shown on the picture.

On the Bol Processor the same procedure can be followed if the 1/3 comma correction is replaced by 7 cents. Another procedure is to "add" intervals, which is acceptable on a digital model because of the accuracy. This procedure is automatically summarised at the bottom of the "scale" page:

Werckmeister IV temperament (Asselin 2000 p. 96)
Added fifths down: “do,fa” starting fraction 1/1
Created meantone downward notes “fa,sib” fraction 3/2 adjusted -1/3 comma
Created meantone downward notes “sib,mib,sol#” fraction 3/2 adjusted 1/3 comma
Created meantone downward notes “sol#,do#” fraction 3/2
Created meantone downward notes “do#,fa#” fraction 3/2 adjusted -1/3 comma
Created meantone downward notes “fa#,si” fraction 3/2
Created meantone downward notes “si,mi” fraction 3/2 adjusted -1/3 comma
Created meantone downward notes “mi,la” fraction 3/2
Created meantone upward notes “do,sol” fraction 3/2 adjusted -1/3 comma
Created meantone upward notes “sol,re” fraction 3/2

Werckmeister IV temperament

Let us compare some temperaments on ascending unaltered and descending altered scales…

Equal-tempered tuning, 20th century
Classical (Chaumont) meantone temperament, 16th-17th century
Meantone temperament, pure minor thirds, 16th-17th century
BACH temperament (Kellner) 18th century

Eighteen temperaments described by Pierre-Yves Asselin (2000) have been programmed in the "-to.trTunings" tonal resource. These can be checked against various musical works, see the pages Comparing temperaments and Tonal analysis of musical works.

As Schlick's temperament is not fully documented, we have set "do-la♭" as a pure major third and "mi-sol#" as a major third augmented by a 2/3 comma. As a result, "sol#" and "la♭" remain distinct.

Tartini-Vallotti temperament (Asselin 2000 p. 104)

Implementations of temperaments in the Bol Processor cannot be used as a reference because (1) errors may have occurred and (2) it is important to know the musical repertoire for which each temperament was designed. See also chapter VIII of Musique et tempéraments (Asselin 2000 p. 139-180) for the history of temperaments and musical examples discussed in terms of instrument tuning.

Tartini-Vallotti temperament: the interval list

Circular graphs show noticeable intervals - perfect fifths, wolf fifths, harmonic and Pythagorean major thirds - in a wide range of uncertainty. For example, in the Tartini-Vallotti temperament shown above, "C-E" is listed as a harmonic major third (green segment), although it is slightly larger (+7 cents) than a "pure" major third (ratio 5/4). The safe way to check that this temperament matches its description is to read the deviations in the interval list (see picture).

D'Alembert-Rousseau temperament with series of slightly larger/smaller fifths

In a few temperaments the sizes of the fifths are not given explicitly, as the tuner is instructed to tune slightly larger (than perfect) or slightly smaller fifths. This is the case in the D'Alembert-Rousseau temperament (Asselin 2000 p. 119), where the series "do, fa, sib, mi♭, sol#" is expected to be slightly larger and "sol#, do#, fa#, si, mi" slightly smaller… In addition, the frame should be "complete", which implies the absence of a remaining comma fraction when closing the cycle of fifths.

In this example, the conditions were met by increasing the slightly larger fifths "do, fa, sib, mi♭, sol#" by 1/12 comma (+2 cents). To complete the cycle, the last series "sol#, do#, fa#, si, mi" was declared as equalised intervals. This resulted in the slightly smaller fifths being reduced by 2 cents to reflect the slightly larger ones. Incidentally, this -1/12 comma adjustment is also the one required to construct an equal-tempered scale.

The whole process of creating a scale is automatically recorded in the Comments section of the "scale" page, for example "d_alembert_rousseau":

D'Alembert-Rousseau temperament (Asselin 2000 p. 119)
Created meantone upward notes “do,sol,re,la,mi” fraction 3/2 adjusted -1/4 comma
Created meantone downward notes “do,fa,sib,mib,sol#” fraction 3/2 adjusted 1/12 comma
Equalized intervals over series “sol#,do#,fa#,si,mi” approx fraction 2/3 adjusted 2.2 cents to ratio = 0.668

It took us about 8 minutes to understand the procedure and another 8 minutes to tune the scale according to D'Alembert-Rousseau…

For a comparison of temperaments applied to several pieces of Baroque music, see the page Comparing temperaments.

The full set of tuning schemes currently implemented on the Bol Processor is presented on this page : https://bolprocessor.org/misc/figs/list-scales.php

More than 12 degrees

We will use a model from ancient Indian musicology to demonstrate divisions of more than 12 degrees per octave. This model is an interpretation of the description of the basic scales (grama) and their transpositions (murcchana) in Bharata Muni's Natya Shastra, a treatise dating from a period between 400 BCE and 200 CE — read the page The two-vina experiment.

The inner wheel of Arnold's model, analogous to the "Ma-grama" of Natya Shastra

The grama-murcchana model and its application to Western harmony is described on the page Just intonation: a general framework. Its application to Hindustani music is presented on the page Raga intonation.

E.J. Arnold (1982) had designed a device to demonstrate the transposition of scales in Bharata's model. The actual division of the octave is 23 steps, but this amounts to having 22 optional positions (shruti-s) since the base note has only one option.

The result can be described as 11 pairs of note positions giving 211 = 2048 possible chromatic scales. Of these, only 12 are "optimally consonant", i.e. with only one "wrong" major fifth, short by 1 syntonic comma (pramāņa ṣruti), which here, for simplicity, is 21 cents.. These 12 chromatic scales are the ones that can be used in harmonic or modal music to experience the best consonance.

Below is a picture of the "grama" scale as displayed by the BP3 editor:

A framework for just-intonation chromatic scales based on the grama-murcchana model in ancient Indian musicology (see full image). The syntonic comma (pramāņa ṣruti) has been set at 21 cents. The note "m4" is not marked.

In this scale we use the conventional Indian sargam notation: sa, re, ga, ma , pa, dha, ni, translated as "C", "D", "E", "F", "G", "A", "B". Note that "re" ("D"), for example, can be found in four positions: r1 and r2 are the two possibilities for "D♭", the first one (256/243) being called "Pythagorean" (derived from five descending fifths) and the second one (16/15) "harmonic" (derived from one descending fifth and one descending major third). Positions r2 and r3 are "D♮" (natural) with r3 being harmonic (10/9) and r4 being Pythagorean (9/8).

Tanpura: the drone of Indian musicians
(manufactured in Miraj)

There are special cases (visible on the wheel model) where m3 is almost superimposed on p1 and m4 with p2, their difference being an inaudible schisma (32805 / 32768 = 1.00112 = 1.9 cents). We use m3p1 and m4p2 to denote these merged positions.

The intervals given in cents are those identified by Western musicologists: the Pythagorean limma (256/243 = 90 cents), the syntonic comma (81/80 = 22 cents) and the minor semitone (25/24 = 70 cents). This shows that a shruti, as described by Bharata, can be of 3 different sizes. However, in its application to Indian music, this model should be rendered "flexible" with a size of the syntonic comma (pramāņa ṣruti) between 0 and 56.8 cents — see page The two-vina experiment.

Clicking on the IMAGE link displays a circular graphic representation of the "grama" scale:

The "grama" scale, an interpretation of the ancient Indian theory of musical scales

Let us play a diatonic scale according to the grama-murcchana model, an occurrence of Western just-intonation scales, and the piano stretched-octave tuning, again with "C4" (or "sa_4") as the block key. The grammar is called "-gr.tryShruti":

S --> _tempo(2) _scale(grama, sa_4) sa_4 r4_4 g3_4 m1_4 p4_4 d3_4 n3_4 sa_5 _scale(just intonation, C4) C4 D4 E4 F4 G4 A4 B4 C5 _scale(piano, C4) do4 re4 mi4 fa4 sol4 la4 si4 do5

Diatonic scales in the grama-murcchana, just-intonation and tempered stretched-octave tunings

The differences are barely perceptible for a simple reason: the first two are identical, since this just intonation scale is a special case of grama-murcchana, while the piano scale is a fair approximation of the former. This can be seen in the following Csound score:

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

t 0.000 60.000
i1 0.000 0.500 261.630 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 0.500 0.500 294.334 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r4_4
i1 1.000 0.500 327.038 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g3_4
i1 1.500 0.500 348.753 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m1_4
i1 2.000 0.500 392.445 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_4
i1 2.500 0.500 436.137 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d3_4
i1 3.000 0.500 490.556 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n3_4
i1 3.500 0.500 523.260 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_5

i1 4.000 0.500 261.630 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Cj4
i1 4.500 0.500 294.334 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Dj4
i1 5.000 0.500 327.038 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Ej4
i1 5.500 0.500 348.753 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Fj4
i1 6.000 0.500 392.445 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Gj4
i1 6.500 0.500 436.137 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Aj4
i1 7.000 0.500 490.556 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Bj4
i1 7.500 0.500 523.260 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; Cj5

i1 8.000 0.500 261.630 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; do4
i1 8.500 0.500 293.811 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; re4
i1 9.000 0.500 329.916 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; mi4
i1 9.500 0.500 349.538 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; fa4
i1 10.000 0.500 392.445 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sol4
i1 10.500 0.500 440.585 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; la4
i1 11.000 0.500 494.742 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; si4
i1 11.500 0.500 524.464 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; do5
s

Let us now listen to the 22 shrutis against a drone ("C" and "G" translated as sa and p4):

S --> scale(grama,sa_4) {9 Full_scale _ _ _ , Drone} - - tempo(3/4) {_retro Full_scale} _ _ _
Full_scale --> sa_4 r1_4 r2_4 r3_4 r4_4 g1_4 g2_4 g3_4 g4_4 m1_4 m2_4 m3p1_4 m4p2_4 p3_4 p4_4 d1_4 d2_4 d3_4 d4_4 n1_4 n2_4 n3_4 n4_4 sa_5
Drone --> _volume(30) Droneseq Droneseq Droneseq Droneseq Droneseq Droneseq Droneseq Droneseq
Droneseq --> {_legato(300) p4_3 sa_4 sa_4 sa_3}

Time structure of the drone sequence (played 2 times)

Note the use of the _retro performance tool to reverse the order of the Full_scale sequence. The _legato(300) command extends the duration of notes up to three times their current duration. This produces a Droneseq sound structure similar to that of the Indian tanpura.

In the sound rendering of this example, a 279 Hz sample waveform of a Miraj tanpura was used to feed the Karplus-Strong algorithm.

The 23 positions of Bharata's grama-murcchana model interpreted as "just intonation"

f1 0 0 1 "tanpura_waveform.aiff" 0 4 0

t 0.000 60.000
i1 1.125 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 0.000 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 2.250 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 5.625 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 3.375 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 4.500 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 9.000 1.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 6.750 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 10.000 1.000 275.496 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r1_4
i1 10.125 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 11.000 1.000 279.159 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r2_4
i1 7.875 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 12.000 1.000 290.671 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r3_4
i1 9.000 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 13.000 1.000 294.334 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r4_4
i1 11.250 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 14.000 1.000 310.032 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g1_4
i1 14.625 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 15.000 1.000 313.956 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g2_4
i1 12.375 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 16.000 1.000 327.038 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g3_4
i1 17.000 1.000 331.224 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g4_4
i1 13.500 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 18.000 1.000 348.753 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m1_4
i1 15.750 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 19.000 1.000 353.201 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m2_4
i1 19.125 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 20.000 1.000 367.852 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m3p1_4
i1 16.875 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 21.000 1.000 372.038 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m4p2_4
i1 18.000 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 22.000 1.000 387.474 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p3_4
i1 20.250 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 23.000 1.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_4
i1 23.625 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 24.000 1.000 413.375 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d1_4
i1 21.375 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 25.000 1.000 418.608 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d2_4
i1 26.000 1.000 436.137 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d3_4
i1 22.500 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 27.000 1.000 441.632 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d4_4
i1 24.750 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 28.000 1.000 465.178 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n1_4
i1 28.125 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 29.000 1.000 470.934 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n2_4
i1 25.875 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 30.000 1.000 490.556 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n3_4
i1 27.000 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 31.000 1.000 496.574 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n4_4
i1 29.250 3.375 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 32.625 1.125 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 30.375 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 32.000 4.000 523.260 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_5
i1 31.500 4.500 196.223 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_3
i1 33.750 4.500 261.630 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
i1 38.000 1.333 523.260 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_5
i1 34.875 4.500 130.815 30.000 30.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_3
i1 39.333 1.333 496.574 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n4_4
i1 40.666 1.334 490.556 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n3_4
i1 42.000 1.333 470.934 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n2_4
i1 43.333 1.333 465.178 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; n1_4
i1 44.666 1.334 441.632 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d4_4
i1 46.000 1.333 436.137 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d3_4
i1 47.333 1.333 418.608 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d2_4
i1 48.666 1.334 413.375 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; d1_4
i1 50.000 1.333 392.445 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p4_4
i1 51.333 1.333 387.474 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; p3_4
i1 52.666 1.334 372.038 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m4p2_4
i1 54.000 1.333 367.852 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m3p1_4
i1 55.333 1.333 353.201 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m2_4
i1 56.666 1.334 348.753 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; m1_4
i1 58.000 1.333 331.224 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g4_4
i1 59.333 1.333 327.038 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g3_4
i1 60.666 1.334 313.956 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g2_4
i1 62.000 1.333 310.032 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; g1_4
i1 63.333 1.333 294.334 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r4_4
i1 64.666 1.334 290.671 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r3_4
i1 66.000 1.333 279.159 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r2_4
i1 67.333 1.333 275.496 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; r1_4
i1 68.666 5.334 261.630 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; sa_4
s

Listening to this sequence makes it clear that treating a sequence of shruti-s as a "scale" is iconoclastic for the aesthetics of Hindustani music: most of these notes sound out of tune when played in relation to a drone (the tanpura). As discussed on page The two-vina experiment, the presence of a drone makes it unlikely that mutual consonance in melodic intervals will always prevail over consonance with the drone's upper partials. If the grama-murcchana system has any relevance to the performance of classical ragas — see page Raga intonation — then at the very least the model should be made flexible enough to accommodate the correct intonation in melodic movements.

Comparing scales

A scale comparison tool is available on the tonal resource page. Click on COMPARE TONAL SCALES and select the ones that need to be analysed.

Scales are compared 2 by 2, so that a set of n scales gives n2/2 results, which are displayed in tables. The following is a comparison of scales called Amin, Cmaj and equal_tempered. The first two ones are described on the page Just intonation: a general framework.

Comparison of three tonal scales

All comparisons are made on a 12-degree (chromatic) scale, measuring the sizes of perfect fifths — some of which may be wolf's fifths as explained on the just intonation page. The average difference of fifths is calculated by summing the squares of the differences between the sizes of fifths of identical degrees (counted in cents):

D=\ \sqrt{\frac{\sum_{^{i=1}}^{12}\left(fa_i\ -\ fb_i\right)^2}{12}}

The distance between Amin and Cmaj is 8.9 cents and the distance between each of these scales and the equal-tempered one is almost 6 cents.

The second table is the result of a search for the smallest distance when transposing one of the scales by 1 to 11 semitones. Here we see that Amin (see picture) and Cmaj (see picture) are practically equivalent — they are harmonically related — since the difference goes down to 1.2 cents. The best matching version of Cmaj is constructed by transposing Amin up a fifth (7 semitones), thus moving 'C' to 'G'. For details of this procedure, see the section on Creation of just-intonation scales.

This device can be further developed to produce a classification of selected tonal scales highlighting similar/identical tuning schemes.

Another approach to tonal scale comparison is to assess the concordance between a musical work and the full set of documented tuning procedures: read the page Tonal analysis of musical works.

The syntactic model

Settings in "-se.tryOneScale"

The following are guidelines for a correct and useful implementation of microtonal scales in BP3. We follow simple sequences listed in "-gr.tryOneScale". This grammar is linked to "-to.tryOneScale" which contains a unique just intonation scale with its notes labelled "Cj", "Cj#", "Dj" etc. In "-se.tryOneScale", the Note convention has been set to 0 (English), the 'C4' key number to 60 and the Default block key to 60. All these parameters are important to reproduce the same effects. Read the Check MIDI microtonality page for practical details.

Rule #1: If only 1 microtonal scale is loaded with the grammar, it will be used by default in all productions.

Example: Let us play:

S --> C4 A4 G4

It produces the following Csound score:

i1 0.000 1.000 261.630 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj4
i1 1.000 1.000 436.137 90.000 90.000 0.000 0.000 0.000 0.000 ; Aj4
i1 2.000 1.000 392.445 90.000 90.000 0.000 0.000 0.000 0.000 ; Gj4

The display of "Cj4" etc. makes it clear that just intonation has been used. This is also confirmed by ratio 436.137/261.630 = 1.666 = 5/3.

Why not use the note labels "Cj4", "Aj"' and "Gj4" in the grammar? This only works if, for example, the scale is specified:

S --> _scale(just intonation, Cj4) Cj4 Aj4 Gj4

This will give the same Csound score because the block key "Cj4" is set to 261.630 Hz in the scale definition. Using "Aj4" as the block key would give:

S --> _scale(just intonation, Aj4) Cj4 Aj4 Gj4

and a sightly different Csound score:

i1 0.000 1.000 263.952 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj4
i1 1.000 1.000 440.007 90.000 90.000 0.000 0.000 0.000 0.000 ; Aj4
i1 2.000 1.000 395.928 90.000 90.000 0.000 0.000 0.000 0.000 ; Gj4

Here, "Aj4" has been set to 440 Hz which is the diapason frequency in "-se.tryOneScale". The ratios are unchanged, e.g. 440.007/263.952 = 5/3.

How can we play equal-tempered intervals with this grammar? This is achieved by specifying the default scale: _scale(0,0):

S --> _scale(0,0) C4 A4 G4

yielding the following Csound score:

i1 0.000 1.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 1.000 1.000 8.09 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 2.000 1.000 8.07 90.000 90.000 0.000 0.000 0.000 0.000 ; G4

The frequencies are not explicit because the default Csound score format uses the octave point pitch-class representation, for example "A4" is the 9th pitch-class or the 8th octave (on a standard MIDI instrument). To make them explicit, just set the diapason in "-se.tryOneScale" to a slightly different value, for example 440.0001 Hz. This will produce:

i1 0.000 1.000 261.626 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 1.000 1.000 440.000 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 2.000 1.000 391.996 90.000 90.000 0.000 0.000 0.000 0.000 ; G4

We could expect the frequency of "C4" to be 261.630 Hz, but the value of 261.626 Hz differs due to rounding. The ratio of the difference is 261.630/261.626 = 1.000015 = 0.026 cents!

Rule #2: When parsing a sequence of notes, if a microtonal scale has been specified, the parser will first attempt to match the note against labels in the current microtonal scale. If there is no match, it will try to interpret the note according to the Note convention specified in settings.

For instance:

S --> _scale(just intonation, Cj4) Cj4 Aj4 Gj4 D4 F4 E4

The notes in the sequence "D4 F4 E4" are translated to the corresponding positions in the intonation scale. The result is visible in both the Csound score and the graphic.

This practice is only relevant to 12-degree tonal scales where positions are equivalent — albeit with slightly different frequency ratios. For example, since the matching is based on key numbers, feeding the "grama" (23-degree) microtonal scale (see above) with "C4 D4 E4" would produce "sa_4 r2_4 r4_4", where r2_4 is close to "C#4" and r4_4 is close to "D4". This makes sense because the key sequence is 60-62-64. There is currently no generic way of mapping note positions in scales with different divisions. An additional difficulty would be scales with an interval other than 2/1.

We will show later that rule #2 provides a flexibility that makes it very easy to insert enharmonic corrections in a musical score by selecting one of 12 just-intonation chromatic scales — see the page Just intonation: a general framework.

Rule #3: If the parser cannot identify a note in the current microtonal scale and against the note convention, it will try other microtonal scales previously loaded in the sequence.

Top of the "-gr.tryScales" grammar

This can be demonstrated with "-gr.tryScales". At the top of the grammar are listed the scales that will be sent to the console along with the grammar and instructions. Each scale becomes "active" in the grammar once a _scale() operator has declared it.

Let us try to produce:

S --> _scale(piano,dop4) fap3 _scale(just intonation,69) C4 rep4

Active scales are piano, then just intonation. There are no problems with note "fap3", which belongs to the piano scale, nor with "C4" which is known in the English note convention. As predicted by rule #2, the note "C4" is translated to its equivalent "Cj4" and played in just intonation.

Since the baseoctave of the scale piano is 3 (see the image above), the pitch of "fap3" will be close to that of "F4".

What happens to note "rep4"? If the piano scale had not been activated, this note would be rejected as a syntax error. However, following rule #3, the parser finds it in the piano scale. This results in the key number 74 since baseoctave = 3.

The note is interpreted as key #74 in the just intonation scale, displayed as "Dj5". This can be seen in the Csound score below and in the graphic.

i1 0.000 1.000 349.538 90.000 90.000 0.000 0.000 0.000 0.000 ; fap3
i1 1.000 1.000 263.952 90.000 90.000 0.000 0.000 0.000 0.000 ; Cj4
i1 2.000 1.000 593.891 90.000 90.000 0.000 0.000 0.000 0.000 ; Dj5

As a result, notes found in a sequence are always interpreted as belonging to the scale declared immediately to the left, even if their label belongs to a different scale or note convention.

Therefore, it is not a good idea to mix notes belonging to different scales without declaring the scale before they occur. A "_scale()" declaration is best placed at the beginning of each sequence, especially at the beginning of the right argument of a rule.

References

Arnold, E.J. A Mathematical model of the Shruti-Swara-Grama-Murcchana-Jati System. Journal of the Sangit Natak Akademi, New Delhi 1982.

Asselin, P.-Y. Musique et tempérament. Paris, 1985, republished in 2000: Jobert. Soon available in English.

Continuous parameters in Csound scores

The following are simple examples explaining the design of Csound scores containing instructions to control parameters that can vary continuously. We will use simple notes (no sound-object) and no Csound instrument file, so that all scores can easily converted into sound files using the "default.orc" orchestra file supplied with BP3.

Consider the following grammar with the metronome set to 60 beats per minute:

S --> _pitchcont _pitchrange(200) C5 _pitchbend(0) D5 _ _pitchbend(120) _ _pitchbend(-150) _ _ _pitchbend(0) E5

The graphic display does not show pitchbend controls:

Pianoroll and object display of "C5 D5 E5"

The _pitchcont instruction at the beginning instructs the interpreter to interpolate pitchbend values throughout whole sequence. This process can be interrupted with _pitchstep.

The _pitchrange(200) instruction indicates that the pitch may vary between -200 and +200 units, which are mapped to the MIDI standard values 0 and +16383 (both logarithmic). This is the range required by "default.orc", which counts intervals in cents. There are 1200 cents in an octave. So, _pitchbend(100) would raise the following note by one semitone.

Note: No pitchbend value is assigned to 'C5'. The default value is '0'. Notes 'D5' and 'E5' are preceded by _pitchbend(0), which assigns a '0' value. All pitchbend variations are assigned during the prolongation of 'D5'. How is this done?

The MIDI output is deceptive. Pitchbend assignments are not taken into account in this format:

"C5 D5 E5" in the MIDI output

However, the Csound output has taken all parameters into account:

"C5 D5 E5" (with pitchbend assignments) in the Csound output

How does Csound process this phrase? Let us look at the Csound score:

t 0.000 60.000
i1 0.000 1.000 9.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C5
f101 1.000 256 -7 0.000 102 120.000 51 -150.000 103 0.000
i1 1.000 5.000 9.02 90.000 90.000 0.000 0.000 0.000 101.000 ; D5
i1 6.000 1.000 9.04 90.000 90.000 0.000 0.000 0.000 0.000 ; E5
s
e

A table (Function Table Statement, see documentation) labelled f101 has been created by Bol Processor and inserted above 'D5' to specify variations of the pitchbend parameter. This table is called by the 10th argument of line 'D5'. Arguments 8 and 9 contain the start and end values of pitchbend according to "default.orc". These are 0 for all three notes.

The second argument of the table is the duration of its validity, here 1.000 seconds. The third argument (256) is its size — always a power of 2. The fourth argument "-7" specifies the GEN routine that Csound will use for its interpolation (see documentation). By default, GEN07 (linear interpolation) is used.

Numbers highlighted in red indicate the values of pitchbend during the variation: 0, 120, -150, 0. Numbers in black indicate the time intervals between two values. Note that 102 + 51 + 103 = 256.

All continuous parameters are handled in the same way by the Bol Processor when creating Csound scores. This includes standard MIDI controls (volume, pressure, modulation, panoramic, pitchbend) and any additional parameters defined in the Csound instrument file. See for example the page Sarasvati Vina.

Note

There is a workaround for playing the same piece with the correct pitchbend changes in MIDI. Change the rule to:

S --> _pitchcont _pitchrange(200) {C5 D5 _ _ _ _ E5, - _pitchbend(0) - _ _pitchbend(120) - _pitchbend(-150) - _ _pitchbend(0) -}

This is the same piece in a polymetric structure, with a line of silences '-' placed in the right places to receive pitchbend modifications. As pitchbend modifies all sounds on the current MIDI channel it will also modify 'D5' during its prolongation. The following is a MIDI rendering on PianoTeq — at a higher speed, so that 'D5' remains audible:

C5 D5 E5 in the MIDI format with pitchbend effects on D5

Csound tuning in BP3

This page deals with the Bol Processor BP3 using an updated version of the Csound orchestra file "default.orc". Changes to the diapason ('A4' frequency) in the settings now affect the production of Csound scores.

In the revised Csound orchestra file, a few lines have been added to change the value of icps (oscillator frequency) according to that of the p4 argument:

if (p4 < 15.0) then
icps = cpspch(p4)
else icps = p4
endif

By default, this instrument receives the pitch value (argument p4) in the octave point pitch-class format — see documentation. In this case, the frequency depends only on the diapason set up in the Csound orchestra, or 440 Hz by default, i.e. cpspch(8.09) = 440.

To "tune" the Csound instrument to the diapason selected for the project in the Bol Processor BP3, if the base frequency is not exactly 440 Hz, p4 will contain the actual frequency of the note (cps format) instead of its octave point pitch-class value. The orchestra file "default.orc" can decide which format is used because (1) no note is ever sent above the 14th octave and (2) frequencies are never lower than 15 Hz. So, the value of p4 automatically makes the decision in "default.orc".

Let us try for example:

S --> A4 B4 C5

If the diapason is 440 Hz, we get the standard Csound score output:

i1 0.000 1.000 8.09 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 1.000 1.000 8.11 90.000 90.000 0.000 0.000 0.000 0.000 ; B4
i1 2.000 1.000 9.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C5

On the first line, 'A4' is set to 8.09 in the octave point pitch-class format.

Once we set the diapason to 435 Hz the Csound score will become:

i1 0.000 1.000 435.00 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 1.000 1.000 488.27 90.000 90.000 0.000 0.000 0.000 0.000 ; B4
i1 2.000 1.000 517.31 90.000 90.000 0.000 0.000 0.000 0.000 ; C5

This score shows the actual frequencies of the notes, for example 'A4' = 435 Hz. This sequence of notes will sound slightly lower than the previous one.

If the diapason is radically different from 440 Hz, the names of the notes will not change. Only the frequencies will be change accordingly. See for example the Csound score created with 'A4' = 300 Hz:

i1 0.000 1.000 300.00 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 1.000 1.000 336.74 90.000 90.000 0.000 0.000 0.000 0.000 ; B4
i1 2.000 1.000 356.76 90.000 90.000 0.000 0.000 0.000 0.000 ; C5

Let us now examine the changes in diapason when dealing with Csound objects. Take for example the object "a" in "-gr.tryCsoundObjects". The Csound score of its prototype (as shown in "-so.tryCsoundObjects") is a mix of 3 instruments:

t 0 120
i1 0 0.5 4.05 ; F0
i2 1.5 0.5 5.05 ; F1
i3 1.5 0.2 643.5 1 ; D#5
e

Instruments i1 and i2 use the octave point pitch-class format, while instrument i3 uses the direct cps format. This score has been created with 'A4' = 440 Hz which explains why 643.5 Hz is labelled D#5. The labelling of the notes is of minor importance as it will be revised when the performance Csound score is created.

When 'A4' = 440 Hz the Csound score of a performance of "a" exactly reflects the score in its prototype:

t 0.000 60.000
i1 0.000 0.250 4.05 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i2 0.750 0.250 5.05 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; F1
i3 0.750 0.100 643.50 1.000 ; D#5
s
e

If the diapason is set to 500 Hz the Csound score of the performance will be:

t 0.000 60.000
i1 0.000 0.250 24.80 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i2 0.750 0.250 49.61 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; F1
i3 0.750 0.100 643.50 1.000 ; C#5
s
e

Pianorolls with A4 = 440 Hz (left) and 500 Hz (right)

All pitches are now given in the cps format. The pitches of notes F0 and F1 would be changed in the sound output. However, the pitch of instrument i3 would remain at 643.50 Hz as set in the sound-object's prototype. As a result of the change in reference, the name of the note produced by i3 would now be 'C#5'. This change is reflected in the pianorolls (see image).

Important…

This automatic the pitch format selection does not work if you try to send a frequency lower than 15 Hz, as it would be the case for 'F0' in the previous example if the diapason was set to 300 Hz. This should never happen, however, as 15 Hz is below the range of audible sounds.

At the opposite end, octaves beyond 14 are way beyond the musical range since 'C15' is already more than 535 KHz…

This might have an incidence on Csound scores being used for producing anything else than music, although in this case the use of the octave point pitch-class format is very unlikely.

Changing middle C key number

"Middle C", or 'C4' in the English convention, is the key in the middle of a piano keyboard. By convention, its MIDI key number is 60, but this value can be changed in the settings.

For example, setting 'C4' to key #48 will cause all notes on a MIDI device to be one octave (12 semitones) lower . This does not change the Csound sound output. Playing "A4 B4 C5" with 'C4' other than 60 will produce the same sound output and the same Csound score, but in the cps pitch format:

t 0.000 120.000
i1 0.000 1.000 440.00 90.000 90.000 0.000 0.000 0.000 0.000 ; A4
i1 1.000 1.000 493.88 90.000 90.000 0.000 0.000 0.000 0.000 ; B4
i1 2.000 1.000 523.25 90.000 90.000 0.000 0.000 0.000 0.000 ; C5
s
e

When applied to Csound objects, changing 'C4' to a key number other than 60 will not change the note names or their actual frequencies, but it will use the cps pitch format. For example, playing "a" will result in the following Csound score:

t 0.000 60.000
i1 0.000 0.250 21.83 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i2 0.750 0.250 43.65 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; F1
i3 0.750 0.100 643.50 1.000 ; D#5
s
e

Misc. grammar controls

The following short examples illustrate the usage of specific controls of the inference mechanism in grammars of Bol Processor (BP2 and BP3).

_destru

This instruction is useful in pattern grammars containing repetition and pseudo-repetition markers. For instance, the following grammar creates a sequence of two occurrences of variable "X" which may further be derived as "abc" or "de".

S --> (= X)(: X)
X --> abc
X --> de

In the first rule, (= ) is called a master parenthesis and (: ) a slave parenthesis — containing a copy of the former. This master-slave dependency is maintained throughout subsequent derivations.

The only eligible final derivations would be "abcabc" or "dede". However, the final string would be displayed for instance "(= abc)(: abc)". To obtain a usable string in which 'a', 'b', 'c' may be further instantiated as sound-objects, it is necessary to remove structural markers. The Bol Processor does it automatically once the final string has been created, i.e. there are no more candidate rules for further derivations. However, the user may want to display strings without their markers. Instruction _destru is used to this effect.

Let us consider for instance "-gr.tryDESTRU":

-se.tryDESTRU
-al.abc
// This grammar produces various patterns on alphabet …

RND
gram#1[1] <2-1> S --> (= (= X) S (:X)) (: (= X) S (:X))
gram#1[2] <2-1> X --> Y
gram#1[3] <2-1> X --> Y S Z
gram#1[4] <2-1> X --> Z

ORD
gram#2[1] LEFT S --> lambda [This is an erasing rule]

LIN
_destru
gram#3[1] X X --> abca
gram#3[2] Z Y --> abc
gram#3[3] Y Z --> cba
gram#3[4] Y Y --> cbbc
gram#3[5] Z Z --> lambda [This is an erasing rule]

The first rule in subgrammar #1 creates a self-embedding pattern in which the start symbol S is created again recursively. This recursivity might produce unlimited strings. To avoid this, each rule in subgrammar #1 is assigned initial weight "2" decreased by "1" once the rule has been fired. Therefore, no rule may be used more than 2 times. Subgrammar #2 contains a single rule deleting the left-over "S".

Subgrammar #3 destroys the structure by erasing all parentheses and master/slave markers, then it rewrites variables "X", "Y", "Z" as strings of terminal symbols. Tracing the production shows for instance that workstring

(=(= Z)(=(= Y)(: Y))(:(= Y)(: Y))(: Z))(:(= Z)(=(= Y)(: Y))(:(= Y)(: Y))(: Z))

is replaced with "Z Y Y Y Y Z Z Y Y Y Y ZZ Y Y Y Y Z Z Y Y Y Y Z".

Rewriting is then done strictly from left to right due to the LIN instruction.

The following is a series of 10 items produced by this grammar:

abccbbccbaabccbbccba
cbacbacbacbacbacbacbacbacbacbacbacba
abccbbccbaabccbbccba
cbaabccbaabc
cbacbacbacbacbacbacbacbacbacbacbacba
abcabcabcabcabcabcabcabc
abcabcabcabcabcabcabcabc
cbbcabcabcabccbbcabcabcabccbbcabcabcabccbbcabcabcabc
cbacbacbacba
cbbccbbccbacbbccbbccbacbbccbbccbacbbccbbccba

Complex patterns are visible on the following sound rendering of the first item using "-so.abc" sound-object prototypes.

Item "abccbbccbaabccbbccba" created by -gr.tryDESTRU

Mozart’s musical dice game

Dice animation
Source: MaskOfVirtue

The following is a version of a Musikalisches Würfelspiel attributed to the Austrian composer Wolfgang Amadeus Mozart (1756-1791). The source is a manuscript published by B. Schott's Söhne (Mainz 39542) containing musical fragments and their correspondances to numbers selected by rolling two dice.

We will show an implementation of this game that works with both BP2.9.8 and BP3. The BP3 example has already been introduced in the page Bol Processor ‘BP3’ and its PHP interface. Here we will focus on the improvisational aspects.

The implementation took time because the score fragments were not available in digital format. Today, similar projects can be easily handled using MusicXML scores and the import procedure implemented in the Bol Processor BP3.

Set up options

Settings of “-gr.Mozart”
Settings of "-gr.Mozart"

In the settings of the grammar "-gr.Mozart" (see picture), the option "Non-stop improvize" is checked. This means that the machine is expected to create and play new variations of the theme forever. On the BP3, in the absence of real-time MIDI, only 10 variations are produced, saved in a MIDI or Csound file and immediately available for listening via the interface players.

At the bottom of the settings, the note convention has been set to "French". At the top of it is the "seed for randomization" which deserves a comment.

Computers produce sequences of random numbers determined by successive calls to the rand() function in the C programming language. Another function called srand(x) reseeds the sequence with number "x": the seed. A given seed will produce the same sequence for subsequent calls of rand(). The only way to get unpredictable sequences is to use a different seed each time a random sequence is required. In other words, shuffle the cards. To do this, the Bol Processor picks up a seed in the time() function which returns the current date/time as an integer number.

Here, the seed is set to "999". Unless modified, the sequence of variations of Mozart's dice game should be identical (on the same computer). In order to generate random sequences we need to instruct the machine to reseed the sequence with an arbitrary number of its choice. By convention, this is done by setting the seed to 0.

The result

Below you can hear a sequence of 10 variations created with seed = 999. The MIDI file was downloaded and sent to a PianoTeq synthesiser tuned to equal temperament:

Ten variations of "-gr.Mozart" produced with seed = 999

I remember playing variations of "-gr.Mozart" to a team of music teachers who concluded enthusiastically: "That must be Mozart!"

You can also download the MIDI file and send it to a MIDI device. Below is another set of variations sent by BP2.9.8 to a Roland D-50 synthesiser whose split patch assigned notes to different instruments according to their tonal position:

Variations of "-gr.mozart" played on a split patch of Roland D-50

The same can be achieved by using _chan() or _ins() instructions in the grammar to assign instruments via reserved MIDI channels or their indices in Csound.

These examples are played on electronic instruments tuned to equal temperament. However, Bol Processor + Csound can produce the same by exploiting microtonality to produce works tuned in different temperaments or in pure intonation. Below is the same set of pieces using Zarlino's meantone temperament (Asselin 2000 p. 85):

Mozart's musical dice game in Zarlino's meantone temperament

Finally, "just intonation" can be achieved by retuning the instrument at each measure to match the harmonic context, as explained on the page Just intonation, a general framework. This gives the following interpretation — the best tuning, in my opinion:

Mozart's musical dice game in just intonation

The MIDI format does not allow for these precise context-sensitive microtonal adjustments.

The stochastic model

A challenging aspect of this game is that there is no equal probability of getting numbers in the range 2 … 12. For example, a sum of 7 is six times more likely than a sum of 2 or 12. The designer of this game may have been aware of this, as the less likely numbers have been mapped to musical sequences that sound more "dissonant".

In order to simulate the dice game, it was therefore necessary to assign weights to the rules that reflected the real probabilities. This was achieved in the grammar (below) by assigning weights K1, K2 etc. to all rules activated by dice rolls.

-se.Mozart

// Use a harpsichord or piano sound

LIN [Select rules randomly and apply from left to right]

gram#1[1] S --> _vel(80) A B
gram#1[2] A --> A1 A2 A3 A4 A5 A6 A7 A8 A1 A2 A3 A4 A5 A6 A7 A'8
gram#1[3] B --> B1 B2 B3 B4 B5 B6 B7 B8 B1 B2 B3 B4 B5 B6 B7 B8

LIN
gram#2[1] <K1=1> A1 --> T96
gram#2[2] <K2=2> A1 --> T32
gram#2[3] <K3=3> A1 --> T69
gram#2[4] <K4=4> A1 --> T40
gram#2[5] <K5=5> A1 --> T148
gram#2[6] <K6=6> A1 --> T104
gram#2[7] <K7=5> A1 --> T152
gram#2[8] <K8=4> A1 --> T119
gram#2[9] <K9=3> A1 --> T98
gram#2[10] <K10=2> A1 --> T3
gram#2[11] <K11=1> A1 --> T54

LIN [These rules could be mixed with the preceding ones. But production is faster in this way.]
gram#3[1] <K1> A2 --> T22
gram#3[2] <K2> A2 --> T6
gram#3[3] <K3> A2 --> T95
gram#3[4] <K4> A2 --> T17
gram#3[5] <K5> A2 --> T74
gram#3[6] <K6> A2 --> T157
gram#3[7] <K7> A2 --> T60
gram#3[8] <K8> A2 --> T84
gram#3[9] <K9> A2 --> T142
gram#3[10] <K10> A2 --> T87
gram#3[11] <K11> A2 --> T130

LIN
gram#4[1] <K1> A3 --> T141
gram#4[2] <K2> A3 --> T128
gram#4[3] <K3> A3 --> T158
gram#4[4] <K4> A3 --> T113
gram#4[5] <K5> A3 --> T163
gram#4[6] <K6> A3 --> T27
gram#4[7] <K7> A3 --> T171
gram#4[8] <K8> A3 --> T114
gram#4[9] <K9> A3 --> T42
gram#4[10] <K10> A3 --> T165
gram#4[11] <K11> A3 --> T10

LIN
gram#5[1] <K1> A4 --> T41
gram#5[2] <K2> A4 --> T63
gram#5[3] <K3> A4 --> T13
gram#5[4] <K4> A4 --> T85
gram#5[5] <K5> A4 --> T45
gram#5[6] <K6> A4 --> T167
gram#5[7] <K7> A4 --> T53
gram#5[8] <K8> A4 --> T50
gram#5[9] <K9> A4 --> T156
gram#5[10] <K10> A4 --> T61
gram#5[11] <K11> A4 --> T103

LIN
gram#6[1] <K1> A5 --> T105
gram#6[2] <K2> A5 --> T146
gram#6[3] <K3> A5 --> T153
gram#6[4] <K4> A5 --> T161
gram#6[5] <K5> A5 --> T80
gram#6[6] <K6> A5 --> T154
gram#6[7] <K7> A5 --> T99
gram#6[8] <K8> A5 --> T140
gram#6[9] <K9> A5 --> T75
gram#6[10] <K10> A5 --> T135
gram#6[11] <K11> A5 --> T28

LIN
gram#7[1] <K1> A6 --> T122
gram#7[2] <K2> A6 --> T46
gram#7[3] <K3> A6 --> T55
gram#7[4] <K4> A6 --> T2
gram#7[5] <K5> A6 --> T97
gram#7[6] <K6> A6 --> T68
gram#7[7] <K7> A6 --> T133
gram#7[8] <K8> A6 --> T86
gram#7[9] <K9> A6 --> T129
gram#7[10] <K10> A6 --> T47
gram#7[11] <K11> A6 --> T37

LIN
gram#8[1] <K1> A7 --> T11
gram#8[2] <K2> A7 --> T134
gram#8[3] <K3> A7 --> T110
gram#8[4] <K4> A7 --> T159
gram#8[5] <K5> A7 --> T36
gram#8[6] <K6> A7 --> T118
gram#8[7] <K7> A7 --> T21
gram#8[8] <K8> A7 --> T169
gram#8[9] <K9> A7 --> T62
gram#8[10] <K10> A7 --> T147
gram#8[11] <K11> A7 --> T106

LIN
gram#9[1] A8 --> T5
gram#9[2] A'8 --> T'5

LIN
gram#10[1] <K1> B1 --> T70
gram#10[2] <K2> B1 --> T117
gram#10[3] <K3> B1 --> T66
gram#10[4] <K4> B1 --> T90
gram#10[5] <K5> B1 --> T25
gram#10[6] <K6> B1 --> T138
gram#10[7] <K7> B1 --> T16
gram#10[8] <K8> B1 --> T120
gram#10[9] <K9> B1 --> T65
gram#10[10] <K10> B1 --> T102
gram#10[11] <K11> B1 --> T35

LIN
gram#11[1] <K1> B2 --> T121
gram#11[2] <K2> B2 --> T39
gram#11[3] <K3> B2 --> T139
gram#11[4] <K4> B2 --> T176
gram#11[5] <K5> B2 --> T143
gram#11[6] <K6> B2 --> T71
gram#11[7] <K7> B2 --> T155
gram#11[8] <K8> B2 --> T88
gram#11[9] <K9> B2 --> T77
gram#11[10] <K10> B2 --> T4
gram#11[11] <K11> B2 --> T20

LIN
gram#12[1] <K1> B3 --> T26
gram#12[2] <K2> B3 --> T126
gram#12[3] <K3> B3 --> T15
gram#12[4] <K4> B3 --> T7
gram#12[5] <K5> B3 --> T64
gram#12[6] <K6> B3 --> T150
gram#12[7] <K7> B3 --> T57
gram#12[8] <K8> B3 --> T48
gram#12[9] <K9> B3 --> T19
gram#12[10] <K10> B3 --> T31
gram#12[11] <K11> B3 --> T108

LIN
gram#13[1] <K1> B4 --> T9
gram#13[2] <K2> B4 --> T56
gram#13[3] <K3> B4 --> T132
gram#13[4] <K4> B4 --> T34
gram#13[5] <K5> B4 --> T125
gram#13[6] <K6> B4 --> T29
gram#13[7] <K7> B4 --> T175
gram#13[8] <K8> B4 --> T166
gram#13[9] <K9> B4 --> T82
gram#13[10] <K10> B4 --> T164
gram#13[11] <K11> B4 --> T92

LIN
gram#14[1] <K1> B5 --> T112
gram#14[2] <K2> B5 --> T174
gram#14[3] <K3> B5 --> T73
gram#14[4] <K4> B5 --> T67
gram#14[5] <K5> B5 --> T76
gram#14[6] <K6> B5 --> T101
gram#14[7] <K7> B5 --> T43
gram#14[8] <K8> B5 --> T51
gram#14[9] <K9> B5 --> T137
gram#14[10] <K10> B5 --> T144
gram#14[11] <K11> B5 --> T12

LIN
gram#15[1] <K1> B6 --> T49
gram#15[2] <K2> B6 --> T18
gram#15[3] <K3> B6 --> T58
gram#15[4] <K4> B6 --> T160
gram#15[5] <K5> B6 --> T136
gram#15[6] <K6> B6 --> T162
gram#15[7] <K7> B6 --> T168
gram#15[8] <K8> B6 --> T115
gram#15[9] <K9> B6 --> T38
gram#15[10] <K10> B6 --> T59
gram#15[11] <K11> B6 --> T124

LIN
gram#16[1] <K1> B7 --> T109
gram#16[2] <K2> B7 --> T116
gram#16[3] <K3> B7 --> T145
gram#16[4] <K4> B7 --> T52
gram#16[5] <K5> B7 --> T1
gram#16[6] <K6> B7 --> T23
gram#16[7] <K7> B7 --> T89
gram#16[8] <K8> B7 --> T72
gram#16[9] <K9> B7 --> T149
gram#16[10] <K10> B7 --> T173
gram#16[11] <K11> B7 --> T44

LIN
gram#17[1] <K1> B8 --> T8
gram#17[2] <K2> B8 --> T78
gram#17[3] <K3> B8 --> T8
gram#17[4] <K4> B8 --> T8
gram#17[5] <K5> B8 --> T8
gram#17[6] <K6> B8 --> T8
gram#17[7] <K7> B8 --> T8
gram#17[8] <K8> B8 --> T8
gram#17[9] <K9> B8 --> T8
gram#17[10] <K10> B8 --> T8
gram#17[11] <K11> B8 --> T8

SUB1 [Substitute only once.]
gram#18[1] T1 --> {fa3 re3 sol3,fa5 re5 sol5}
gram#18[2] T2 --> {{2,si2,sol3}-,la4 {2,fa#4 sol4 si4 sol5}}
gram#18[3] T3 --> {{2,do3,mi3}-,sol5 do5 mi5}
gram#18[4] T4 --> {{1,sol2 si2} sol3 si2,sol5 re5_}
gram#18[5] T5 --> {sol2 {2,sol3 fa3 mi3 re3}, {2,sol4,si4,re5,sol5}-}
gram#18[6] T'5 --> {sol2 {2,si3 sol3 fa#3 mi3}, {2,sol4,si4,re5,sol5}-}
gram#18[7] T6 --> {{2,do3,mi3}-,sol4 do5 mi5}
gram#18[8] T7 --> {{2,do3,sol3}-,mi5 do5 mi5 sol5 do6 sol5}
gram#18[9] T8 --> {do3 sol2 do2,do5_ -}
gram#18[10] T9 --> {sol3_ sol2,{do5,mi5}{si4,re5}-}
gram#18[11] T10 --> {sol3_ -,si4 la4 si4 do5 re5 si4}
gram#18[12] T11 --> {do3 re3 re2,mi5 do5 si4 la4 sol4 fa#4}
gram#18[13] T12 --> {do3 do3 do3,{mi4 mi4 mi4},{do5 do5 do5}}
gram#18[14] T13 --> {{2,mi3,sol3}-,do5 sol4 mi4}
gram#18[15] T15 --> {{2,do3,sol3}{do3,mi3},mi5 {1,sol5 mi5}do5}
gram#18[16] T16 --> {{2,re3,fa#3}{do3,fa#3},la5 fa#5 re5}
gram#18[17] T17 --> {{2,mi3,sol3}-,do5 sol4 do5 mi5 sol4 do5}
gram#18[18] T18 --> {{2,do3,mi3}{do3,sol3},sol4 do5 mi5}
gram#18[19] T19 --> {{2,do3,sol3}{do3,mi3},{1,mi5 do5}mi5 sol5}
gram#18[20] T20 --> {si2_ -,sol5{1,si5 re6}re5}
gram#18[21] T21 --> {do3 re3 re2,do5 mi5 sol5 re5 la4 fa#5}
gram#18[22] T22 --> {do3_ -,mi5 do5 sol4}
gram#18[23] T23 --> {{3,fa3 mi3 re3 mi3 fa3 sol3},fa5 mi5 re5 mi5 fa5 sol5}
gram#18[24] T25 --> {re3_ do3,re4 fa#4 la4 re5 fa#5 la5}
gram#18[25] T26 --> {{3,do3 mi3 sol3 mi3 do4 do3}, {do5,mi5}{do5,mi5}{do5,mi5}}
gram#18[26] T27 --> {{2,sol3,si3}-,fa5 mi5 fa5 re5 do5 si4}
gram#18[27] T28 --> {{2,do3,la3}-,fa#5 re5 la4 la5 fa#5 re5}
gram#18[28] T29 --> {sol3_ sol2,{2,si4 re5 sol5 re5}si4}
gram#18[29] T31 --> {{2,do3,sol3}{do3,sol3},{1,mi5 do5}sol4 mi5}
gram#18[30] T32 --> {{2,do3,mi3}-,sol4 do5 mi5}
gram#18[31] T34 --> {sol3_ -,{2,mi5 do5 re5 si4} sol4}
gram#18[32] T35 --> {{2,re3,fa#3}{do3,la3},la4 re5 fa#5}
gram#18[33] T36 --> {do3 re3 re2,la4 mi5 re5 sol5 fa#5 la5}
gram#18[34] T37 --> {{2,si2,re3}-,{2,sol5 si5 sol5 re5}si4}
gram#18[35] T38 --> {{1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_}, do5 sol4 mi5}
gram#18[36] T39 --> {{3,si2 re3 sol3 re3 si2 sol2},sol5 sol4 sol4}
gram#18[37] T40 --> {{2,do3,mi3}-,do5 si4 do5 mi5 sol4 do5}
gram#18[38] T41 --> {{2,do3,mi3}-,{2,do5 si4 do5 mi5} sol4}
gram#18[39] T42 --> {sol2_ -,si4 do5 re5 si4 la4 sol4}
gram#18[40] T43 --> {{2,do3,mi3}-,sol5{2,fa5 mi5 re5 do5}}
gram#18[41] T44 --> {fa3_ sol3,la4{2,fa5 re5 la4 si4}}
gram#18[42] T45 --> {{2,mi3,sol3}-,do5 si4 do5 sol4 mi4 do4}
gram#18[43] T46 --> {{2,si2,re3}-,sol5{2,si5 sol5 re5 si4}}
gram#18[44] T47 --> {{2,si2,re3}-,sol5{1,sol5 re5}si5}
gram#18[45] T48 --> {{2,do3,sol3}{do3,mi3},mi5{2,do5 mi5 sol5 do6}}
gram#18[46] T49 --> {{1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_},mi5 do5 sol4}
gram#18[47] T50 --> {{2,mi3,sol3}-,do5{1,mi5 do5}sol4}
gram#18[48] T51 --> {{2,do3,mi3}-,do5 sol4 mi5 do5 sol5 mi5}
gram#18[49] T52 --> {fa3_ sol3,re5 do#5 re5 fa5 sol4 si4}
gram#18[50] T53 --> {do3_ -,{do5,mi5}{1,do5 re5,mi5 fa5}{mi5,sol5}}
gram#18[51] T54 --> {do3 do3 do3,{mi4,do5}{mi4,do5}{mi4,do5}}
gram#18[52] T55 --> {{2,si2,re3}-,sol5 si5 re5}
gram#18[53] T56 --> {{2,sol2,sol3}sol3,{1,re5 si4}sol4 -}
gram#18[54] T57 --> {{1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_},mi5 do5 sol4}
gram#18[55] T58 --> {{1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_},sol5 mi5 do5}
gram#18[56] T59 --> {{1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_},sol5 do5 mi5}
gram#18[57] T60 --> {{2,do3,mi3}-,sol5{2,fa5 mi5 re5 do5}}
gram#18[58] T61 --> {{2,mi3,sol3}-,do5{1,mi5 do5}sol5}
gram#18[59] T62 --> {do3 re3 re2,mi5 do5 si4 sol4 la4 fa#4}
gram#18[60] T63 --> {do3_ -,{2,mi5 do5 si4 do5} sol4}
gram#18[61] T64 --> {{2,do3,sol3}{do3,sol3},mi5 sol5 do6 sol5 mi5 do5}
gram#18[62] T65 --> {{2,re3 fa#3}-,{1,re5 la4}re5 fa#5}
gram#18[63] T66 --> {{re3,la3}{re3,fa#3}{do3,re3},fa#5 la5 fa#5}
gram#18[64] T67 --> {{2,do3,mi3}{mi3,sol3},do5 si4 do5 mi5 sol4 do5}
gram#18[65] T68 --> {si2_ -,sol5{2,si5 sol5 re5 sol5}}
gram#18[66] T69 --> {{2,do3,mi3}-,sol5 mi5 do5}
gram#18[67] T70 --> {re3_ do3,fa#5{2,la5 fa#5 re5 fa#5}}
gram#18[68] T71 --> {{2,si2,re3}{si2,re3},{2,sol5 si5 re6 si5} sol5}
gram#18[69] T72 --> {fa3_ sol3,fa5 mi5 re5 do5 si4 re5}
gram#18[70] T73 --> {{1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_},sol5 mi5 do5}
gram#18[71] T74 --> {{2,do3,mi3}-,do6 si5 do6 sol5 mi5 do5}
gram#18[72] T75 --> {do3 do3 do3,{re5,fa#5}{re5,fa#5}{re5,fa#5}}
gram#18[73] T76 --> {{2,do3,mi3}{do3,sol3},do6 si5 do6 sol5 mi5 do5}
gram#18[74] T77 --> {{2,si2,re3}{si2,sol3},{1,sol5 si5}sol5 re5}
gram#18[75] T78 --> {do3_ do2,do5 do4 -}
gram#18[76] T80 --> {do3_ -,re5 la4 fa#5}
gram#18[77] T82 --> {{2,si2,sol3}{si2,re3},{1,re5 si4}sol4 sol5}
gram#18[78] T84 --> {{2,do3,mi3}-,do5 sol4 mi5 do5 sol5 mi5}
gram#18[79] T85 --> {{2,mi3,sol3}-,do5 mi5 sol4}
gram#18[80] T86 --> {{2,si2,sol3}-,re5{1,re5 sol5}si5}
gram#18[81] T87 --> {{2,do3,mi3}{do3,sol3},sol5 do5 mi5}
gram#18[82] T88 --> {{2,si2,re3}{si2,re3},sol5 re5 sol5 si5 sol5 re5}
gram#18[83] T89 --> {{1,fa3 mi3}re3 sol3,{1,fa5 mi5}re5 sol5}
gram#18[84] T90 --> {{2,do3,la3}{do3,la3},fa#5 la5 re6 la5 fa#5 la5}
gram#18[85] T92 --> {{2,sol2,sol3}sol3,{si4,re5}{1,sol5 si5}re5}
gram#18[86] T95 --> {{2,do3,mi3}-,sol5 mi5 do5}
gram#18[87] T96 --> {do3_ -,mi5 do5 sol4}
gram#18[88] T97 --> {{2,si2,re3}{si2,sol3},sol5 fa#5 sol5 re5 si4 sol4}
gram#18[89] T98 --> {{1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_},do5 sol4 mi5}
gram#18[90] T99 --> {{2,do3,la3}{do3,la3},fa#5 la5 re5}
gram#18[91] T101 --> {{2,do3,sol3}{do3,mi3},mi5 re5 mi5 sol5 do6 sol5}
gram#18[92] T102 --> {{2,do3,la3}{do3,la3},{1,fa#5 re5}la4 fa#5}
gram#18[93] T103 --> {{2,mi3,sol3}-,{2,do5 mi5 do5 sol4} mi4}
gram#18[94] T104 --> {do3_ -,mi5 re5 mi5 sol5 do6 sol5}
gram#18[95] T105 --> {do3_ -,fa#5{2,la5 fa#5 re5 fa#5}}
gram#18[96] T106 --> {do3 re3 re2,la4{2,re5 do5 si4 la4}}
gram#18[97] T108 --> {{2,do3,sol3}{do3,mi3},mi5 sol5 do6}
gram#18[98] T109 --> {{2,fa3,la3}{sol3,re4},re5 fa5 re5 fa5 si4 re5}
gram#18[99] T110 --> {do3 re3 re2,si4 la4 la4 sol4 sol4 fa#4,re5 do5 do5 si4 si4 la4}
gram#18[100] T112 --> {{1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_},mi5 do5 sol4}
gram#18[101] T113 --> {{2,sol3,si3}-,fa5 re5 si4}
gram#18[102] T114 --> {sol3 sol3 sol3,{si4,re5}{si4,re5}{si4,re5}}
gram#18[103] T115 --> {{2,do3,mi3}-,do5 sol4 mi5 do5 sol5 mi5}
gram#18[104] T116 --> {fa3_ sol3,re5 fa5 la5 fa5 re5 si4}
gram#18[105] T117 --> {{2,re3,fa#3}-,re5 la4 re5 fa#5 la5 fa#5}
gram#18[106] T118 --> {do3 re3 re2,mi5 la5 sol5 si5 fa#5 la5}
gram#18[107] T119 --> {{2,do3,mi3}-,mi5 do5 sol5 mi5 do6 sol5}
gram#18[108] T120 --> {{2,re3,fa#3}{do3,fa#3},re6{2,la5 fa#5 re5 la4}}
gram#18[109] T121 --> {{2,si2,sol3}-,sol5{1,si5 sol5}re5}
gram#18[110] T122 --> {{si2,re3}{si2,re3}{si2,re3},{2,sol5 fa#5 sol5 si5} re5}
gram#18[111] T124 --> {do3 do3 do3,{mi4,do5}{mi4,do5}{mi4,do5}}
gram#18[112] T125 --> {sol3 sol2 -,{2,sol5 mi5 re5 si4}sol4}
gram#18[113] T126 --> {mi3_ {1,mi3 do3},do5 sol4 do5 mi5 sol5 {do5,mi5}}
gram#18[114] T128 --> {sol2_ -,si4 re5 sol5}
gram#18[115] T129 --> {{si2,re3}{si2,re3}{si2,sol3},{2,la5 sol5 fa#5 sol5}re5}
gram#18[116] T130 --> {do3 do3 do3,mi4 mi4 mi4,do5 do5 do5}
gram#18[117] T132 --> {sol3 sol2 -,{do5,mi5}{1,si4 sol4,re5 si4}sol4}
gram#18[118] T133 --> {{2,si2,sol3}-,re5{2,sol5 re5 si4 re5}}
gram#18[119] T134 --> {do3 re3 re2,la4 mi5{si4,re5}{la4,do5}{sol4,si4}{fa#4,la4}}
gram#18[120] T135 --> {{do3,re3}{do3,re3}{do3,re3},fa#5{1,fa#5 re5}la5}
gram#18[121] T136 --> {{2,do3,mi3}-,do6 si5 do6 sol5 mi5 do5}
gram#18[122] T137 --> {{1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_},do5 sol4 mi5}
gram#18[123] T138 --> {{3,re2 re3 do#3 re3 do3 re3},{la4,re5,fa#5}fa#5_}
gram#18[124] T139 --> {si2_ -,{2,sol5 si5 sol5 si5}re5}
gram#18[125] T140 --> {{do3,fa#3}{do3,fa#3}{do3,la3},la4{1,la4 re5}fa#5}
gram#18[126] T141 --> {{2,si2,sol3}sol2,re5 mi5 fa5 re5 do5 si4}
gram#18[127] T142 --> {{2,do3,mi3}-,do5 sol4 mi5}
gram#18[128] T143 --> {{2,si2,re3}{si2,re3},sol5{1,re5 si4}sol4}
gram#18[129] T144 --> {{1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_},sol5 do5 mi5}
gram#18[130] T145 --> {fa3_ sol3,re5 fa5 la4 re5 si4 re5}
gram#18[131] T146 --> {do3 do3 do3,{fa#4,re5}{re5,fa#5}{fa#5,la5}}
gram#18[132] T147 --> {do3 re3 re2,mi5 do6 si5 sol5 la5 fa#5}
gram#18[133] T148 --> {{2,do3,mi3}-,do6 si5 do6 sol5 mi5 do5}
gram#18[134] T149 --> {fa3_ sol3,{1,fa5 re5}la4 si4}
gram#18[135] T150 --> {{3,do3 si2 do3 re3 mi3 fa#3},{sol4,do5,mi5}mi5_}
gram#18[136] T152 --> {{2,do3,mi3}-,sol5{2,fa5 mi5 re5 do5}}
gram#18[137] T153 --> {do3_ -,re5 la4 fa#5 re5 la5 fa#5}
gram#18[138] T154 --> {do3_ -,re5 do#5 re5 fa#5 la5 fa#5}
gram#18[139] T155 --> {{2,si2,re3}-,sol5 si5 sol5 re5 si4 sol4}
gram#18[140] T156 --> {{2,mi3,sol3}-,{2,do5 sol4 mi5 do5} sol5}
gram#18[141] T157 --> {do3_ -,mi5 re5 mi5 sol5 do6 sol5}
gram#18[142] T158 --> {sol2_ -,si4{2,re5 si4 la4 sol4}}
gram#18[143] T159 --> {do3 re3 re2,mi5 sol5 re5 do5 si4 la4}
gram#18[144] T160 --> {{2,do3,mi3}{do3,mi3},do5 si4 do5 mi5 sol4 do5}
gram#18[145] T161 --> {do3 do3 do3,{fa#4,re5}{fa#4,re5}{fa#4,re5}}
gram#18[146] T162 --> {{2,do3,sol3}{do3,mi3},mi5 re5 mi5 sol5 do6 sol5}
gram#18[147] T163 --> {{2,si2,re3}-,sol5 fa#5 sol5 re5 si4 sol4}
gram#18[148] T164 --> {{3,sol3 fa#3 sol3 re3 si2 sol3},re5 sol4_}
gram#18[149] T165 --> {si2_ -,re5 si4 sol4}
gram#18[150] T166 --> {{2,sol3,si3}-,{2,re5 si5 sol5 re5}si4}
gram#18[151] T167 --> {{2,do3,mi3}-,do5{1,do5 re5}mi5}
gram#18[152] T168 --> {{2,do3,mi3}{mi3,sol3},sol5{2,fa5 mi5 re5 do5}}
gram#18[153] T169 --> {do3 re3 re3,mi5 sol5 re5 sol5 la4 fa#5}
gram#18[154] T171 --> {{2,sol2,sol3}{si2,sol3},si4 do5 re5 mi5 fa5 re5}
gram#18[155] T173 --> {fa3_ sol3,{1,fa5 la5}la4{1,si4 re5}}
gram#18[156] T174 --> {{1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_} {1,{do3,mi3}sol3_},sol4 do5 mi5}
gram#18[157] T175 --> {sol3 sol2 -,{2,mi5 do5 si4 re5}sol5}
gram#18[158] T176 --> {{2,si2,re3}{si2,re3},la5 sol5 si5 sol5 re5 sol5}

COMMENT:
This is Mozart's musical dice game…
[Source: B. Schott's Söhne, Mainz 39542]

Sound-object and pianoroll displays of a polymetric expression {{2,do3,sol3}{do3,mi3},mi5 re5 mi5 sol5 do6 sol5} produced by T162 in "-gr.Mozart"
Sound-object and pianoroll displays of a polymetric expression {{2,do3,sol3}{do3,mi3},mi5 re5 mi5 sol5 do6 sol5} produced by T162 in "-gr.Mozart"

Subgrammars #1 to #17 rewrite the work string — initially "S" — as strings of variables "A1", "A2", "B1", "T96" etc. The numbers of the "T-variables" are taken from tables in the game.

Subgrammar #18 rewrites each "T-variable" as a polymetric expression of terminal symbols (simple notes). For example, "la3" is equivalent to "A4" in English which is set to 440 Hz in "-se.Mozart". This instrument can be tuned.

The pictures show self-explanatory pianoroll and sound-object displays of the polymetric expression produced by "T162":

{{2,do3,sol3}{do3,mi3},mi5 re5 mi5 sol5 do6 sol5}

Octave numbering and diapason

When we captured notes from a MIDI keyboard to construct the rules for subgrammar #18, we had the Bol Processor set up incorrectly due to confusion over octave numbering in the English and French conventions.

In English, the "middle C" on a piano keyboard is called "C4" and its number is 60. In French, the key with the same number is called "do3". When we mistakenly called it "do4", all the notes were written an octave higher…

After fixing the problem on BP2, there were two ways to correct the octave shift:

  • Set the "Middle C" number to 48 
  • Keep the standard "Middle C" = "C4" = 60 and transpose the whole piece down 12 semitones:
    S --> _transpose(-12) _vel(80) A B

We believe that the second solution makes more sense because it is based on a universal standard of key numbering.

Both solutions have the same corrective effect on the Csound score: only note names will change, for example "mi5" is replaced with "mi4" but both octave point pitch-class notations remain "9.04".

Settings on -gr.Mozart

On the Settings page the diapason (frequency of "A4") is set to 440 Hz which is the most common standard for tuning instruments. If "A4" was numbered 48 this frequency should be lowered to 220 Hz.

However, this diapason setting has no effect on the tonality of pieces produced by "-gr.Mozart" in MIDI format. The real-time MIDI stream or MIDI file will be played by MIDI devices — such as the MIDIjs javascript player — using their own default setting of "A4".

In the Bol Processor BP2, the frequency of "A4" also had no effect on the Csound output. In the orchestra file "default.orc", the oscillator parameter kpitch was derived from the octave point pitch-class parameter p4 via the function cpspch() also using the default 440 Hz diapason = cpspch(8.09) — see documentation. This has been changed in BP3, using an updated version of "default.orc". See Csound tuning in BP3 for more details.

References

Asselin, P.-Y. Musique et tempérament. Paris, 1985, republished in 2000: Jobert. Soon available in English.

Csound

No posts found.

Csound objects

This article is a continuation of Csound check in which we introduced the creation of Csound parameters monitored by performance controls. Musical phrases were created from simple notes translated into Csound events in a straightforward manner. We now consider the creation of Csound scores based on sound-objects containing Csound instructions — which may be called "Csound objects".

Csound object "e" in sound-object prototypes file "-so.tryCsoundObjects"

Csound objects contain a Csound score with a specific tempo and duration. For example, in object "e" shown above, the tempo (line "t" of the score) is 120 beats/min. The total duration is 2 beats, or 1000 ms. Note that to calculate the total duration of this sound-object, the durations of 'E3' and 'G3' (0.667 sec) shouldn't be added to those of 'C3' and 'D3', because of the start dates.

The duration of a Csound object is independent of the duration set by MIDI events that may coexist in the sound-object prototype. In most situations, note sequences and durations are identical in the MIDI stream and the Csound score. This makes it possible to play almost the same items via MIDI and Csound. However, as we will see, Csound is open to controls that are not available in MIDI.

Calculations can be easily verified against the C-sound instrument file "‑cs.tryCsoundObjects" provided in the example set bp3-ctests-main.zip — downloadable from GitHub along with the Bol Processor BP3 interface: php-frontend-master.zip. Items can be created with the grammar "‑gr.tryCsoundObjects" using the alphabet "‑ho.tryCsoundObjects" associated with the sound-object prototype file "‑mi.tryCsoundObjects".

Csound score of sound-object "a"

Let us start with sound-object "a" whose score is shown in the picture. The score is given for a tempo of 120 beats per minute, giving a total duration of 2 beats ( = 1.5 + 0.5) or 1000 ms.

The first event (note 'F0') is repeated 2 times with identical timing, a meaningless detail to check that Csound can handle this abnormal case.

Events i1 and i2, calling instruments 1 and 2, describe tonal positions in the octave point pitch-class format: octave number + semitones above C. We notice that "5.05" has been mislabelled as 'G5'. This will have no effect on the computation, as the Bol Processor will automatically correct it to 'F1'. It will also rename notes according to the convention set in the settings: English, French or Indian.

Pitch format in instrument 3

Event i3, calling instrument 3, defines pitch as frequency (in Hz). It is assumed that 643.5 Hz is 'D#5' because the diapason is 'A4' = 440 Hz. This tuning is defined in the settings (page "-se.tryCsoundObjects"). Bol Processor can change the name of this note according to the diapason.

Changes of the diapason are taken into account by BP3 when generating Csound scores, but this was not yet the case with BP2. The following examples have been produced with the default 'A4' = 440 Hz, giving identical results with BP2 and BP3. See the page Csound tuning in BP3 page to examine different cases.

Producing object "a" at a tempo of 60 beats per minute results in the following Csound score:

a

Pianoroll of object "a"

t 0.000 60.000
i1 0.000 0.250 4.05 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i1 0.000 0.250 4.05 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i2 0.750 0.250 5.05 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; F1
i3 0.750 0.100 643.50 1.000 ; D#5

Note that this score is more complete than the one contained in sound-object "a". This is because the sound-object prototype file "-so.tryCsoundObjects" is linked to a Csound instrument file "-cs.tryCsoundObjects" (see figure below).

Mention of the related Csound instruments file is necessary to bind it to the sound-objects prototypes file.

Instrument 1 of the Csound instrument file is designed to handle 10 arguments while the score of "i1" events in "a" only contains 4. The 6 missing arguments are filled with default values of the parameters they represent. Here, for example, '90' is the default volume. Zeros represent default pitchbend or function table indexes.

Note that "5.05" has been correctly fixed to "F1". This is only relevant to human readers, as Csound ignores any text following a semicolon.

You cannot convert this and other examples to sound with the supplied Csound orchestra "default.orc", because it only handles instrument 1. The examples on this page are for visual inspection only.

Object graphic of f {a b, c}

In the following example, we need to look at the graph to understand why the events of "a" are delayed by 160ms compared to "b". Object "b" has a pivot set at 20% of its duration from the start date. This can be checked in "-so.tryCsoundObjects".

Although the object graphic and the pianoroll for this item indicate that "b" should start on a negative date (-160ms), the Csound score is shifted to show only positive or zero dates.

{a, b} c

Pianoroll of {a b, c}

i3 0.000 0.800 461.34 1.000 ; A4
i4 0.100 0.200 6.03 1.050 ; C2
i1 0.160 0.250 4.05 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i1 0.160 0.250 4.05 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i2 0.910 0.250 5.05 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; F1
i3 0.910 0.100 643.50 1.000 ; D#5
i2 1.160 0.125 9.00 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; C5
i2 1.285 0.125 9.02 0.000 0.000 62.000 62.000 0.000 0.000 0.000 ; D5
i2 1.410 0.125 9.04 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; E5
i2 1.535 0.125 9.05 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; F5

Note on pivots and relocation: sound-object "b" has its pivot shown as a full arrow, unlike other sound-objects in this set which only have a red triangle. This means that it is not relocatable. Relocation would be performed if these sound-objects had topological properties such as prohibiting the covering of their beginning/end, allowing truncation of beginning/end to a certain degree, breaking the tempo etc. A constraint-satisfaction algorithm is run on each production to produce a solution that minimises the number of constraints violated. This is best illustrated by "-gr.koto3" (read the article).

Sequence "b midiobject"

Let us now look at a phrase containing "midiobject", a sound-object with both a MIDI stream and a Csound score. The MIDI stream is ignored when constructing the score. The time resolution (10 ms) also has no effect on the accuracy of timings in the Csound score.

b midiobject

i3 0.000 0.800 461.34 1.000 ; A4
i4 0.100 0.200 6.03 1.050 ; C2
i1 1.160 0.666 7.04 90.000 90.000 0.000 0.000 0.000 0.000 ; E3
i1 1.160 1.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C3
i1 2.160 1.000 7.02 90.000 90.000 0.000 0.000 0.000 0.000 ; D3
i1 2.493 0.667 7.07 90.000 90.000 0.000 0.000 0.000 0.000 ; G3

Since the score of "midiobject" has been defined with a tempo of 60 beats/min for a duration of 2 beats, the durations of the notes E3, C3, D3, G3 are unchanged.

Expression {a b a, c midiobject}

Now consider a polymetric structure in which the first line contains 3 sound-objects and the second line contains 2 sound-objects. The structure will be forced to a symbolic duration of 3 beats — the duration of "a b a" — and the second line will arrange the objects as "two in three" with symbolic durations of 1.5 beats.

This is clear on the picture, looking at the pivots of sound-objects, if one does not get confused by the physical duration of the sound-objects. The sound-object prototype "b" has a duration of 0.8 beats, resulting in a physical duration of 800 ms.

PIanoroll of {a b a, c midiobject}

On the second line, the symbolic duration of each object is 1.5 beats. Consequently, the sound-object "c", whose prototype has a physical duration of 500 ms, is set to physical duration = 500 * 1.5 = 750 ms. The object "c" appears as sequence "C5 D5 E5 F5" with total physical duration of 4 * 188 ms = 752 ms. These durations are reflected in the Csound score below.

{a b a, c midiobject}

i1 0.000 0.250 4.05 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i1 0.000 0.250 4.05 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i2 0.000 0.188 9.00 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; C5
i2 0.187 0.188 9.02 0.000 0.000 62.000 62.000 0.000 0.000 0.000 ; D5
i2 0.374 0.188 9.04 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; E5
i2 0.561 0.188 9.05 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; F5
i2 0.750 0.250 5.05 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; F1
i3 0.750 0.100 643.50 1.000 ; D#5
i3 0.840 0.800 461.34 1.000 ; A4
i4 0.940 0.200 6.03 1.050 ; C2
i1 1.500 0.999 7.04 90.000 90.000 0.000 0.000 0.000 0.000 ; E3
i1 1.500 1.500 7.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C3
i1 2.000 0.250 4.05 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i1 2.000 0.250 4.05 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i2 2.750 0.250 5.05 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; F1
i3 2.750 0.100 643.50 1.000 ; D#5
i1 3.000 1.500 7.02 90.000 90.000 0.000 0.000 0.000 0.000 ; D3
i1 3.499 1.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 ; G3

Combined objects and notes

In the following example, we combine sound-objects (containing Csound scores) with simple notes that are converted to Csound events. These notes are played on (default) MIDI channel 1, which is assigned to instrument 1.

a C4 D4 b c

Combined objects and notes on pianoroll. Notes in brown colour are those available on both MIDI and Csound outputs. Notes in green are exclusively Csound.

i1 0.000 0.250 4.05 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i1 0.000 0.250 4.05 90.000 90.000 0.000 0.000 0.000 0.000 ; F0
i2 0.750 0.250 5.05 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; F1
i3 0.750 0.100 643.50 1.000 ; D#5
i1 1.000 1.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i3 2.840 0.800 461.34 1.000 ; A4
i4 2.940 0.200 6.03 1.050 ; C2
i1 2.000 1.000 8.02 90.000 90.000 0.000 0.000 0.000 0.000 ; D4
i2 4.000 0.125 9.00 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; C5
i2 4.125 0.125 9.02 0.000 0.000 62.000 62.000 0.000 0.000 0.000 ; D5
i2 4.250 0.125 9.04 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; E5
i2 4.375 0.125 9.05 0.000 0.000 90.000 90.000 0.000 0.000 0.000 ; F5

This combination is highlighted in the pianoroll. Notes that are present in both the MIDI stream and the Csound score are displayed in brown, while notes that are present only in the Csound output are displayed in green.

Pitchbend mapping by instrument 2

Let us apply a continuous pitchbend control to a sound-object containing four Csound instructions, using instrument 2, which maps the MIDI pitchbend range [0..16384] to a range of [-200..+200], both on logarithmic scales. (This mapping is therefore linear.)

In the Bol Processor score, the use of mapped values in _pitchbend() controls is possible, thanks to a _pitchrange(200) instruction at the beginning of the sequence.

The resulting Csound score makes it clear that the pitchbend should vary continuously over each Csound event : 0 to 24.997, 24.997 to 49.994 etc. Csound will further interpolate the values using its GEN 07 (linear interpolation) generator.

_pitchrange(200) _pitchcont _pitchbend(0) c _pitchbend(100)

i2 0.000 0.125 9.00 0.000 24.997 90.000 90.000 0.000 0.000 0.000 ; C5
i2 0.125 0.125 9.02 24.997 49.994 62.000 62.000 0.000 0.000 0.000 ; D5
i2 0.250 0.125 9.04 49.994 74.991 90.000 90.000 0.000 0.000 0.000 ; E5
i2 0.375 0.125 9.05 74.991 99.988 90.000 90.000 0.000 0.000 0.000 ; F5

Volume control is possible on instruments 1 and 2, but not on instrument 3. Therefore its effect is only applied to certain events of sound-object "a":

_volumecont _volume(30) a _volume(127)

i1 0.000 0.250 4.05 30.000 54.250 0.000 0.000 0.000 0.000 ; F0
i1 0.000 0.250 4.05 30.000 54.250 0.000 0.000 0.000 0.000 ; F0
i2 0.750 0.250 5.05 0.000 0.000 102.750 127.000 0.000 0.000 0.000 ; F1
i3 0.750 0.100 643.50 1.000 ; D#5

Csound score of sound-object "d"

In the following example, a continuous pitchbend correction cannot be applied because instrument 5, called by "d", does not have a pitchbend parameter. However, the value of +100 cents is applied to the pitch parameter itself.

The Csound score of sound-object "d" is limited to 1 note at 440 Hz (with reference to instrument 5). This note was labelled 'A4' on the prototype, but we should remember that with a diapason of 435 Hz it will be slightly higher than 'A4'. The increase is 1200 * log2(440/435) = 24 cents. So, in the performance it will be set to 124 cents above 435 Hz, giving 435 * 2^(124/1200) = 467 Hz. As shown below:

_pitchrange(200) _pitchcont _pitchbend(100) d _pitchbend(0)

i5 0.000 0.500 466.16 ; A4

In the following example, a continuous pitchbend correction results in different adjustments of the pitchbend parameters of the instruments called by sound-objects "a", "b" and "c". Simple notes 'C4' and 'D4' call instrument 1 because it is the one assigned to the (default) channel 1. The volume is also adjusted continuously.

Note that we also apply negative values to the pitchbend parameter, expecting the Csound orchestra to do the extrapolation.

_pitchrange(200) _pitchcont _volumecont _volume(30) _pitchbend(-10) a C4 D4 b c _pitchbend(100) _volume(127)

i1 0.000 0.250 4.05 30.000 34.850 0.000 -10.000 -4.500 0.000 ; F0
i1 0.000 0.250 4.05 30.000 34.850 0.000 -10.000 -4.500 0.000 ; F0
i2 0.750 0.250 5.05 6.499 11.999 44.550 49.400 0.000 0.000 0.000 ; F1
i3 0.750 0.100 643.50 1.005 ; D#5
i1 1.000 1.000 8.00 49.400 68.800 0.000 12.000 34.000 0.000 ; C4
i3 2.840 0.800 461.34 1.069 ; A4
i4 2.940 0.200 6.03 1.151 ; C2
i1 2.000 1.000 8.02 68.800 88.200 0.000 34.000 56.000 0.000 ; D4
i2 4.000 0.125 9.00 77.990 83.490 107.600 112.450 0.000 0.000 0.000 ; C5
i2 4.125 0.125 9.02 83.490 88.989 77.466 80.807 0.000 0.000 0.000 ; D5
i2 4.250 0.125 9.04 88.989 94.488 117.300 122.150 0.000 0.000 0.000 ; E5
i2 4.375 0.125 9.05 94.488 99.988 122.150 127.000 0.000 0.000 0.000 ; F5

Settings of the "blurb" parameter

Let us check an arbitrary parameter "burb" which affects arguments 9, 10 and 11 of instrument 2.

This parameter is designed as additive in its combinations. The default value is '0'.

In sound-object "e", the third event 'D3' is required to set 'blurb' to a start value of 10 and to an end value of 30.

Csound score of sound-object "e"

These values are added to those interpolated over the continuous 'blurb' variation: 25.6 + (100 - 25.6) * 0.5 = 62.8 and 100 at dates 0.5 and 1 sec. This gives an initial value of 62.8 + 10 = 72.8 and a final value of 100 + 30 = 130.

_cont(blurb) _value(blurb,25.6) e _value(blurb,100)

i2 0.000 0.333 7.04 8191.500 8191.500 64.000 64.000 25.600 50.375 0.000 ; E3
i2 0.000 0.500 7.00 8191.500 8191.500 64.000 64.000 25.600 62.800 0.000 ; C3
i2 0.500 0.500 7.02 8191.500 8191.500 64.000 64.000 72.800 130.000 0.000 ; D3
i2 0.666 0.334 7.07 8191.500 8191.500 64.000 64.000 75.150 99.963 0.000 ; G3

If the variation of "blurb" becomes more complex, the Bol Processor will handle it
through function tables.

_cont(blurb) _value(blurb,12) e _value(blurb,110)_ _value(blurb,130)__ _value(blurb,80)__ _value(blurb,-20)_ _value(blurb,-10)___ _value(blurb,40)

f101 0.000 256 -7 12.000 76 110.000 76 130.000 104 96.750
i2 0.000 3.330 7.04 8191.500 8191.500 64.000 64.000 12.000 96.750 101.000 ; E3
f102 0.000 256 -7 12.000 51 110.000 51 130.000 102 80.000 52 30.000
i2 0.000 5.000 7.00 8191.500 8191.500 64.000 64.000 12.000 30.000 102.000 ; C3
f103 5.000 256 -7 40.000 51 -6.000 51 8.000 154 70.000
i2 5.000 5.000 7.02 8191.500 8191.500 64.000 64.000 40.000 70.000 103.000 ; D3
f104 6.660 256 -7 -13.400 26 -10.000 230 39.917
i2 6.660 3.335 7.07 8191.500 8191.500 64.000 64.000 -13.400 39.917 104.000 ; G3

In the Csound score of "e", event 'D3' has non-zero initial values on arguments 9 and 10. These values are added to those determined by variations of the "blurb" parameter, thereby giving 40 for argument 9 (the initial value of "blurb") and 70 for argument 10 (the final value). The same calculation is applied to the attached table f103. Consequently, the first and last values of a function table always reflect the initial and final values of the parameter. This allows Csound instruments to operate in a consistent manner, either interpolating the initial and final values, or picking up (and interpolating) the values in the attached function table.

The "oops" parameter in instrument 6

The Bol Processor combines Csound parameters either additively or multiplicatively. For predefined MIDI-mapped parameters, the combination mode is preset: all parameters, except volume, are combined additively. For additional (non-MIDI) parameters, the composer can choose both the default value and the combination mode.

For example, instrument 6 deals with an "oops" parameter that combines multiplicatively. Sound-object "f" contains calls to this instrument with values of "oops" other than the default.

f

i6 0.000 0.500 7.00 0.000 0.000 90.000 90.000 0.000 0.000 0.000 0.500 1.500 0.000 0.000 0.000 0.000 ; C3
i6 0.500 0.500 7.02 0.000 0.000 90.000 90.000 0.000 0.000 0.000 0.000 4.700 0.000 0.000 0.000 0.000 ; D3
i6 1.000 0.500 7.04 0.000 0.000 90.000 90.000 0.000 0.000 0.000 0.250 2.500 0.000 0.000 0.000 0.000 ; E3

_cont(oops) _value(oops,0) f _value(oops,4)

i6 0.000 0.500 7.00 0.000 0.000 90.000 90.000 0.000 0.000 0.000 0.000 2.000 0.000 0.000 0.000 0.000 ; C3
i6 0.500 0.500 7.02 0.000 0.000 90.000 90.000 0.000 0.000 0.000 0.000 12.533 0.000 0.000 0.000 0.000 ; D3
i6 1.000 0.500 7.04 0.000 0.000 90.000 90.000 0.000 0.000 0.000 0.667 10.000 0.000 0.000 0.000 0.000 ; E3

Sound-object f for mm = 60 beats/min

The "oops" parameter varies from 0 to 4 over 1500 ms. At the start of 'D3' and 'E3', its values are 4 * (500 / 1500) = 1.33 and 4 * (1000 / 1500) = 2.66 respectively.

The initial value of "oops" in 'C3' is 0 * 0.5 = 0, and its final value 1.5 * 1.33 = 2, as shown on the score.

The initial value for 'D3' will be O, and for 'E3' it will be 0.25 * 2.66 = 0.665. The value at the end of D3 is 4.7 * 2.66 = 12.5. The value at the end of D3 is 2.5 * 4 = 10.


These examples have been designed to test all the features of the Csound interface as it is implemented in Bol Processor. We expect more to come as both environments continue to explore new concepts and build tools for musicians.

We apologise for the lack of a corpus of real musical pieces created with Bol Processor and Csound. A first example of high musical quality was composed in 1996: read and listen to Sarasvati vina!

Csound checkup

Csound in the Bol Processor (BP2, BP3) environment

This article and the next one on Csound objects are reserved for Csound geeks interested in creating Csound scores with Bol Processor. They are complementary but they can be studied independently.

The examples in this section are not intended to be auditory. Rather, the idea was to produce short Csound scores that could be used to illustrate the treatment of parameters in a variety of contexts.

The calculations in this article can be easily checked against the Csound instrument file "‑cs.chekAllCsound" included in the bp3-ctests-main.zip example set, which can be downloaded from GitHub along with the Bol Processor BP3's interface: php-frontend-master.zip. See the Bol Processor ‘BP3’ and its PHP interface page for the installation and testing.

All items can be produced with the grammar "‑gr.checkAllCsound".

Let us start with a simple example:

A4 G4 C5 A4

This produces the following Csound score:

t 0.000 60.000
i2 0.000 1.000 440.00 90.000 0.000 0.000 0.000 ; A4
i2 1.000 1.000 392.00 90.000 0.000 0.000 0.000 ; G4
i2 2.000 1.000 523.25 90.000 0.000 0.000 0.000 ; C5
i2 3.000 1.000 440.00 90.000 0.000 0.000 0.000 ; A4
s

Instrument 2 is used because it's the one assigned to channel 1 by default in the Csound instrument file "-cs.checkAllCsound".
This score will not produce any sound with the default orchestra file "default.orc" because it does not contain a definition for instrument 2.
Argument 4 is the pitch (in Herz) related to the diapason (frequency of A4) set in "-se.checkAllCsound".
Argument 5 is the MIDI value of the volume, default 90 according to the settings.
Arguments 6 and 7 can be used for the 'blurb' parameter (see infra).
Argument 8 is not not used, its value remains 0.

No treatment of MIDI pitchbend in instrument 2

Instrument 2 does not use the pitchbend value as a parameter, but changes the pitch parameter (in Hz) accordingly. In the following example, G4, which is 200 cents higher, will be played 2 semitones higher, at the same pitch as A4 (440 Hz).

_pitchrange(200) A4 _pitchbend(200) G4 _pitchbend(0) C5 A5

i2 0.000 1.000 440.00 90.000 0.000 0.000 0.000 ; A4
i2 1.000 1.000 440.00 90.000 0.000 0.000 0.000 ; G4
i2 2.000 1.000 523.25 90.000 0.000 0.000 0.000 ; C5
i2 3.000 1.000 880.00 90.000 0.000 0.000 0.000 ; A5

Volume mapping in instrument 3

Now we will force the instrument to 3. Note that many new parameters are displayed.
The default volume is 90 on the MIDI scale. This is converted to 16.98 (log scale) using the volume mapping defined in instrument 3.
As instrument 3 accepts pitchbend corrections (arguments 5 and 6), pitchbend = 16383 (+2 semitones) is applied to G4 instead of changing its frequency.

_ins(3) _pitchrange(200) A4 _pitchbend(200) G4 _pitchbend(0) C5 A5

i3 0.000 1.000 440.00 8191.500 8191.500 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; A4
i3 1.000 1.000 392.00 16383.000 16383.000 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; G4
i3 2.000 1.000 523.25 8191.500 8191.500 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; C5
i3 3.000 1.000 880.00 8191.500 8191.500 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; A5

Arguments 5 and 6 represent the start and end values of the pitchbend. This makes it possible to tell Csound to calculate a portamento (see infra).

Mapping of modulation in instrument 3

Playing simple notes on channel 2 calls up instrument 3, which has volume and modulation control parameters. Here the modulation range (0 to 12431) is mapped to 0 to 3035.097 (arguments 11 and 12).

chan(2) _modcont _mod(0) C4 D4__ E4 _mod(12431)

i3 0.000 1.000 261.63 8191.500 8191.500 16.981 16.981 0.000 0.000 0.000 607.019 0.000 ; C4
i3 1.000 3.000 293.66 8191.500 8191.500 16.981 16.981 0.000 0.000 607.019 2428.078 0.000 ; D4
i3 4.000 1.000 329.63 8191.500 8191.500 16.981 16.981 0.000 0.000 2428.078 3035.097 0.000 ; E4

Another way to do the same without tempering with channels is to use instrument 3.

ins(3) _modcont _mod(0) C4 D4__ E4 _mod(12431)

Note that instrument specifications override the assignments of The_default instrument, which are made on the basis of the MIDI channel. For instance, in the following example, because of the _ins(1) statement, _chan(2) does not set the instrument index to 3, so _mod() is ignored:

ins(1) _chan(2) _modcont _mod(0) C4 D4__ E4 _mod(12431)

i1 0.000 1.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C4
i1 1.000 3.000 8.02 90.000 90.000 0.000 0.000 0.000 0.000 ; D4
i1 4.000 1.000 8.04 90.000 90.000 0.000 0.000 0.000 0.000 ; E4

Polymetric structure {C5 D5 E5 F5, G5 D5 C6}

Let us consider a polymetric structure in which the same note (D5) has two consecutive NoteOn's.

In MIDI, a NoteOff is inserted before the second NoteOn of "D5". In Csound the same
instrument is called twice. In both versions the break between successive occurrences of "D5" is audible.

_ins(The_default) {_volume(30) C5 D5 E5 F5,_volume(20) G5 D5 C6}

i1 0.000 1.000 9.00 30.000 30.000 0.000 0.000 0.000 0.000 ; C5
i1 0.000 1.333 9.07 20.000 20.000 0.000 0.000 0.000 0.000 ; G5
i1 1.000 1.000 9.02 30.000 30.000 0.000 0.000 0.000 0.000 ; D5
i1 1.333 1.333 9.02 20.000 20.000 0.000 0.000 0.000 0.000 ; D5 striked again
i1 2.000 1.000 9.04 30.000 30.000 0.000 0.000 0.000 0.000 ; E5
i1 3.000 1.000 9.05 30.000 30.000 0.000 0.000 0.000 0.000 ; F5
i1 2.666 1.334 10.00 20.000 20.000 0.000 0.000 0.000 0.000 ; C6

Note that this example would sound strange without the volume controls: we would get a silence during the time the two D5' are superimposed, simply because they are sine waves with equal amplitudes and opposite phases!

Let us look at the same note played at different volumes in stepwise variations. Notice that instrument 3 is now specified by its name "Harpsichord". (Don't look for it in an orchestra file!)

_ins(Harpsichord) _volume(0) A4 _volume(32) A4 _volume(64) A4 _volume(80) A4_volume(127) A4

i3 0.000 1.000 440.00 8191.500 8191.500 -24.000 -24.000 0.000 0.000 0.000 0.000 0.000 ; A4
i3 1.000 1.000 440.00 8191.500 8191.500 -2.763 -2.763 0.000 0.000 0.000 0.000 0.000 ; A4
i3 2.000 1.000 440.00 8191.500 8191.500 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; A4
i3 3.000 1.000 440.00 8191.500 8191.500 13.204 13.204 0.000 0.000 0.000 0.000 0.000 ; A4
i3 4.000 1.000 440.00 8191.500 8191.500 24.000 24.000 0.000 0.000 0.000 0.000 0.000 ; A4

The following illustration shows the volume decreasing continuously from 127 (i.e. +24 after mapping) to 0 (i.e. -24 after mapping). Instrument 3 has two parameters (7 and 8) that take the start and end volumes respectively, and these values are interpolated by Csound (using scheme GEN07) to produce a continuous change.

_ins(Harpsichord) _volumecont _volume(127) A4 _volume(0)

i3 0.000 1.000 440.00 8191.500 8191.500 24.000 -24.000 0.000 0.000 0.000 0.000 0.000 ; A4

Now we will look at similar continuous changes over several notes invoking the same instrument.

_ins(Harpsichord) _volumecont _volume(127) A4 G4 C5 A5 A4 G4 C5 A5 _volume(0)

i3 0.000 1.000 440.00 8191.500 8191.500 24.000 21.688 0.000 0.000 0.000 0.000 0.000 ; A4
i3 1.000 1.000 392.00 8191.500 8191.500 21.688 18.431 0.000 0.000 0.000 0.000 0.000 ; G4
i3 2.000 1.000 523.25 8191.500 8191.500 18.431 12.899 0.000 0.000 0.000 0.000 0.000 ; C5
i3 3.000 1.000 880.00 8191.500 8191.500 12.899 -0.031 0.000 0.000 0.000 0.000 0.000 ; A5
i3 4.000 1.000 440.00 8191.500 8191.500 -0.031 -1.179 0.000 0.000 0.000 0.000 0.000 ; A4
i3 5.000 1.000 392.00 8191.500 8191.500 -1.179 -2.794 0.000 0.000 0.000 0.000 0.000 ; G4
i3 6.000 1.000 523.25 8191.500 8191.500 -2.794 -5.547 0.000 0.000 0.000 0.000 0.000 ; C5
i3 7.000 1.000 880.00 8191.500 8191.500 -5.547 -24.000 0.000 0.000 0.000 0.000 0.000 ; A5

The same, but step by step:

_ins(Harpsichord) _volumestep _volume(127) A4 G4 C5 A5 A4 G4 C5 A5 _volume(0)

i3 0.000 1.000 440.00 8191.500 8191.500 24.000 24.000 0.000 0.000 0.000 0.000 0.000 ; A4
i3 1.000 1.000 392.00 8191.500 8191.500 21.688 21.688 0.000 0.000 0.000 0.000 0.000 ; G4
i3 2.000 1.000 523.25 8191.500 8191.500 18.431 18.431 0.000 0.000 0.000 0.000 0.000 ; C5
i3 3.000 1.000 880.00 8191.500 8191.500 12.899 12.899 0.000 0.000 0.000 0.000 0.000 ; A5
i3 4.000 1.000 440.00 8191.500 8191.500 -0.031 -0.031 0.000 0.000 0.000 0.000 0.000 ; A4
i3 5.000 1.000 392.00 8191.500 8191.500 -1.179 -1.179 0.000 0.000 0.000 0.000 0.000 ; G4
i3 6.000 1.000 523.25 8191.500 8191.500 -2.794 -2.794 0.000 0.000 0.000 0.000 0.000 ; C5
i3 7.000 1.000 880.00 8191.500 8191.500 -5.547 -5.547 0.000 0.000 0.000 0.000 0.000 ; A5

Changing the volume continuously on the first two notes, then the volume stays unchanged:

_ins(Harpsichord) _volumecont _volume(127) A4 G4 _volume(10) C5 A5

i3 0.000 1.000 440.00 8191.500 8191.500 24.000 4.549 0.000 0.000 0.000 0.000 0.000 ; A4
i3 1.000 1.000 392.00 8191.500 8191.500 4.549 -7.372 0.000 0.000 0.000 0.000 0.000 ; G4
i3 2.000 1.000 523.25 8191.500 8191.500 -7.372 -7.372 0.000 0.000 0.000 0.000 0.000 ; C5
i3 3.000 1.000 880.00 8191.500 8191.500 -7.372 -7.372 0.000 0.000 0.000 0.000 0.000 ; A5

Continuous pitchbend variation over an entire phrase:

_ins(Harpsichord) _pitchcont _pitchbend(16383) A4 G4 C5 A5 A4 G4 C5 A5 _pitchbend(0)

i3 0.000 1.000 440.00 16383.000 14335.125 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; A4
i3 1.000 1.000 392.00 14335.125 12287.250 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; G4
i3 2.000 1.000 523.25 12287.250 10239.375 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; C5
i3 3.000 1.000 880.00 10239.375 8191.500 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; A5
i3 4.000 1.000 440.00 8191.500 6143.625 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; A4
i3 5.000 1.000 392.00 6143.625 4095.750 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; G4
i3 6.000 1.000 523.25 4095.750 2047.875 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; C5
i3 7.000 1.000 880.00 2047.875 0.000 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; A5

Here, pitchbend and volume vary simultaneously:

_ins(Harpsichord) _volumecont _volume(0) _pitchcont _pitchrange(200) _pitchbend(200) A4 G4 C5 A5 A4 G4 C5 A5 _pitchbend(-200) _volume(127)

i3 0.000 1.000 440.00 16383.000 14335.125 -24.000 -5.547 0.000 0.000 0.000 0.000 0.000 ; A4
i3 1.000 1.000 392.00 14335.125 12287.250 -5.547 -2.794 0.000 0.000 0.000 0.000 0.000 ; G4
i3 2.000 1.000 523.25 12287.250 10239.375 -2.794 -1.179 0.000 0.000 0.000 0.000 0.000 ; C5
i3 3.000 1.000 880.00 10239.375 8191.500 -1.179 -0.031 0.000 0.000 0.000 0.000 0.000 ; A5
i3 4.000 1.000 440.00 8191.500 6143.625 -0.031 12.899 0.000 0.000 0.000 0.000 0.000 ; A4
i3 5.000 1.000 392.00 6143.625 4095.750 12.899 18.431 0.000 0.000 0.000 0.000 0.000 ; G4
i3 6.000 1.000 523.25 4095.750 2047.875 18.431 21.688 0.000 0.000 0.000 0.000 0.000 ; C5
i3 7.000 1.000 880.00 2047.875 0.000 21.688 24.000 0.000 0.000 0.000 0.000 0.000 ; A5

So far we have seen how instruments interpolate between single start and end values.
Instrument 1, here called "The_default", i.e. the one defined in "default.orc", is able to vary pitchbend and volume in a more sophisticated way, using a function table.

BP3 automatically creates function tables when required and when the instrument specification (here "-cs.checkAllCsound") provides slots (arguments) for entering function table indexes.

Let us look at a simple example with pitchbend. Both of the following notations result in the same score.
You will hear the production of this score with the demo orchestra "default.orc". (Doesn't sound great!)

ins(The_default) _pitchcont _pitchbend(0) D4__ _pitchbend(16383) E4_ _pitchbend(0)__

ins(The_default) _pitchrange(200) _pitchcont _pitchbend(-200) D4__ pitchbend(+200) E4_ pitchbend(-200)__

i1 0.000 3.000 8.02 90.000 90.000 0.000 -200.000 200.000 0.000 ; D4
f101 3.000 256 -7 200.000 102 -200.000 154 -200.000
i1 3.000 5.000 8.04 90.000 90.000 0.000 200.000 -200.000 101.000 ; E4

Note that GENO7 is used. GENO8 (cubic spline interpolation) could be considered, but it has the disadvantage of forcing the first derivative to zero at the start and end points. GEN07 is also much faster.

Here, C4 needs a 4-point table, because of _pitchcont whereas D4 only needs linear interpolation?

ins(1) _pitchrange(200) _pitchbend(0) _pitchcont C4_ _pitchbend(20) __ _pitchbend(165) __ D4 _ _ _ _pitchbend(150)

f101 0.000 256 -7 0.000 85 20.000 85 165.000 86 160.000
i1 0.000 6.000 8.00 90.000 90.000 0.000 0.000 160.000 101.000 ; C4
i1 6.000 4.000 8.02 90.000 90.000 0.000 160.000 150.000 0.000 ; D4

Here, the initial portamento on a silence '-' is only provided by the
MIDI output. Csound ignores silence:

ins(1) _pitchrange(200) _pitchbend(0) _pitchcont - ___ C4 ___ _pitchbend(200) __ D4 ___ _pitchbend(150)

f101 4.000 256 -7 100.000 170 200.000 86 183.333
i1 4.000 6.000 8.00 90.000 90.000 0.000 100.000 183.333 101.000 ; C4
i1 10.000 4.000 8.02 90.000 90.000 0.000 183.333 150.000 0.000 ; D4

ins(1) _pitchrange(200) _pitchbend(0) _pitchcont - _ _pitchbend(20) __ C4 ___ _pitchbend(200) __ D4 ___ _pitchbend(150)

f101 4.000 256 -7 80.000 170 200.000 86 183.333
i1 4.000 6.000 8.00 90.000 90.000 0.000 80.000 183.333 101.000 ; C4
i1 10.000 4.000 8.02 90.000 90.000 0.000 183.333 150.000 0.000 ; D4

ins(1) _pitchcont _pitchrange(200) _pitchbend(0) - ___ C4 ___ _pitchbend(200) __ D4 ___ _pitchbend(150

f101 4.000 256 -7 100.000 170 200.000 86 183.333
i1 4.000 6.000 8.00 90.000 90.000 0.000 100.000 183.333 101.000 ; C4
i1 10.000 4.000 8.02 90.000 90.000 0.000 183.333 150.000 0.000 ; D4

Here the section between brackets { } follows an independent portamento

ins(1) _pitchcont _pitchrange(200) _pitchbend(0) - ___ {C4 ___ _pitchbend(200) __ } D4 ___ _pitchbend(150)

f101 4.000 256 -7 42.857 170 200.000 86 200.000
i1 4.000 6.000 8.00 90.000 90.000 0.000 42.857 200.000 101.000 ; C4
i1 10.000 4.000 8.02 90.000 90.000 0.000 107.143 150.000 0.000 ; D4

A polymetric structure. E4 retains the initial pitchbend value of C4.

ins(1) _pitchcont _pitchrange(200) _pitchbend(0) - ___ {C4 ___ _ pitchbend(200) __ , E4} D4 ___ _pitchbend(150)

f101 4.000 256 -7 42.857 170 200.000 86 200.000
i1 4.000 6.000 8.00 90.000 90.000 0.000 42.857 200.000 101.000 ; C4
i1 4.000 6.000 8.04 90.000 90.000 0.000 42.857 107.143 0.000 ; E4
i1 10.000 4.000 8.02 90.000 90.000 0.000 107.143 150.000 0.000 ; D4

Here, E4 has its own independent movement, which would be impossible with MIDI.

ins(1) _pitchcont _pitchrange(200) _pitchbend(0) - ___ {C4 ___ _ pitchbend(200) __ ,E4_ _pitchbend(180) _ _pitchbend(60) _ } D4 ____ _pitchbend(150)

f101 4.000 256 -7 42.857 170 200.000 86 200.000
i1 4.000 6.000 8.00 90.000 90.000 0.000 42.857 200.000 101.000 ; C4
f102 4.000 256 -7 42.857 128 180.000 64 60.000 64 60.000
i1 4.000 6.000 8.04 90.000 90.000 0.000 42.857 60.000 102.000 ; E4
i1 10.000 4.000 8.02 90.000 90.000 0.000 107.143 150.000 0.000 ; D4

Don't forget to set _pitchrange(200) on channel 2, otherwise _pitchbend(180) will be used as the MIDI value (range 0..16383). Note again that channel 2 will not call instrument 3 because instrument 1 has already been specified.

ins(1) _pitchcont _pitchrange(200) _pitchbend(0) - ___ {C4 ___ _ pitchbend(200) __ , _chan(2) _pitchrange(200) E4_ _pitchbend(180) __ } D4 ___ _pitchbend(150)

f101 4.000 256 -7 42.857 170 200.000 86 200.000
i1 4.000 6.000 8.00 90.000 90.000 0.000 42.857 200.000 101.000 ; C4
f102 4.000 256 -7 42.857 128 180.000 128 180.000
i1 4.000 6.000 8.04 90.000 90.000 0.000 42.857 180.000 102.000 ; E4
i1 10.000 4.000 8.02 90.000 90.000 0.000 107.143 150.000 0.000 ; D4

In the above example, if you forget to set the instrument to 1, instruments will be assigned based on MIDI channels. This results in:

pitchcont _pitchrange(200) _pitchbend(0) - ___ {C4 ___ _ pitchbend(200) __ , _chan(2) _pitchrange(200) E4_ _pitchbend(180) __ } D4 ___ _pitchbend(150)

i2 4.000 6.000 268.18 90.000 0.000 0.000 0.000 ; C4
i3 4.000 6.000 329.63 9946.821 15563.850 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; E4
i2 10.000 4.000 312.41 90.000 0.000 0.000 0.000 ; D4

Let us now try an arbitrary parameter 'blurb' (which has no MIDI equivalent)
on the two instruments 'Harpsichord' and 'Flute'.

_ins(Harpsichord) _cont(blurb) _value(blurb,123.42) C4 D4 _ins(Flute) E4 F4 _value(blurb,-211) _step(blurb) G4 A4 _value(blurb,-34) _fixed(blurb) B4 C5

i3 0.000 1.000 261.63 8191.500 8191.500 16.981 16.981 123.420 39.815 0.000 0.000 0.000 ; C4
i3 1.000 1.000 293.66 8191.500 8191.500 16.981 16.981 39.815 -43.790 0.000 0.000 0.000 ; D4
i2 2.000 1.000 329.63 90.000 -43.790 -127.395 0.000 ; E4
i2 3.000 1.000 349.23 90.000 -127.395 -211.000 0.000 ; F4
i2 4.000 1.000 392.00 90.000 -211.000 -211.000 0.000 ; G4
i2 5.000 1.000 440.00 90.000 -122.500 -122.500 0.000 ; A4
i2 6.000 1.000 493.88 90.000 -34.000 -34.000 0.000 ; B4
i2 7.000 1.000 523.25 90.000 -34.000 -34.000 0.000 ; C5

Instrument "Flute" can handle function tables for 'blurb'.

ins(Flute) _cont(blurb) _value(blurb,544.5) C4__ _value(blurb,120) __ _value(blurb,-37)___ _value(blurb,0)

f101 0.000 256 -7 544.500 96 120.000 64 -37.000 96 0.000
i2 0.000 8.000 261.63 90.000 544.500 0.000 101.000 ; C4

Note that if the 'arbitrary' parameter is called 'volume', it will be MIDI volume, here remapped to the range -24..+24

_ins(Harpsichord) _cont(volume) _value(volume,127) A4 B4 _value(volume,0)

i3 0.000 1.000 440.00 8191.500 8191.500 24.000 -0.031 0.000 0.000 0.000 0.000 0.000 ; A4
i3 1.000 1.000 493.88 8191.500 8191.500 -0.031 -24.000 0.000 0.000 0.000 0.000 0.000 ; B4

The same applies to 'pitchbend', 'pressure', 'panoramic' and 'modulation' (all case sensitive). In instrument 3, MIDI modulation is remapped to the range 0..4000.

_ins(Harpsichord) _cont(modulation) _value(modulation,0) A4 B4 C5 D5 _value(modulation,16383)

i3 0.000 1.000 440.00 8191.500 8191.500 16.981 16.981 0.000 0.000 0.000 1000.000 0.000 ; A4
i3 1.000 1.000 493.88 8191.500 8191.500 16.981 16.981 0.000 0.000 1000.000 2000.000 0.000 ; B4
i3 2.000 1.000 523.25 8191.500 8191.500 16.981 16.981 0.000 0.000 2000.000 3000.000 0.000 ; C5
i3 3.000 1.000 587.33 8191.500 8191.500 16.981 16.981 0.000 0.000 3000.000 4000.000 0.000 ; D5

Now the two have been combined:

_ins(Harpsichord) _cont(volume) _cont(modulation) _value(volume,127) _value(modulation,0) A4 B4 C5 D5 _value(volume,0) _value(modulation,16383)

i3 0.000 1.000 440.00 8191.500 8191.500 24.000 18.431 0.000 0.000 0.000 1000.000 0.000 ; A4
i3 1.000 1.000 493.88 8191.500 8191.500 18.431 -0.031 0.000 0.000 1000.000 2000.000 0.000 ; B4
i3 2.000 1.000 523.25 8191.500 8191.500 -0.031 -2.794 0.000 0.000 2000.000 3000.000 0.000 ; C5
i3 3.000 1.000 587.33 8191.500 8191.500 -2.794 -24.000 0.000 0.000 3000.000 4000.000 0.000 ; D5

Note that if the additional parameter is unknown to the instrument, it will simply be ignored. No warning will be given. For example:

_ins(Harpsichord) _cont(gasp) _value(gasp,0) A4 B4 _value(gasp,1000)

i3 0.000 1.000 440.00 8191.500 8191.500 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; A4
i3 1.000 1.000 493.88 8191.500 8191.500 16.981 16.981 0.000 0.000 0.000 0.000 0.000 ; B4

The 'Splashmachine' instrument handles the 'splash' parameter which is instructed to create function tables with GEN08 (cubic spline) instead of GEN07.

ins(Splashmachine) _cont(splash) _value(splash,544.5) C4__ _value(splash,120) __ _value(splash,-37)___ _value(splash,130)

f101 0.000 256 -8 544.500 96 120.000 64 -37.000 96 130.000
i4 0.000 8.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 544.500 130.000 101.000 ; C4

The same instrument also uses GENO8 for the pitchbend.

_ins(Splashmachine) _cont(pitchbend) _pitchrange(200) _value(pitchbend,120) C4__ _value(pitchbend,34) __ _value(pitchbend,55)___ _value(pitchbend,-160)

This can be written more simply:

_ins(Splashmachine) _cont(pitchbend) _pitchrange(200) _pitchbend(120) C4__ _pitchbend(34) __ _pitchbend(55)___ _pitchbend(-160)

f101 0.000 256 -8 120.000 96 34.000 64 55.000 96 -160.000
i4 0.000 8.000 8.00 90.000 90.000 0.000 120.000 -160.000 101.000 0.000 0.000 0.000 ; C4

All these examples produce identical results with BP2.9.8 and its current version BP3.

Want to know more? Read the page Csound objects!

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.