eC!

Social top

English

Aspects of Sahnsi and Polos in Balinese Gamelan Instruments

This article describes a project to sample, analyze, and create a computer music composition simulating the gamelan instruments Kemong, Kempli, Jegogan, Gong, Calung, Gangsa, and Reyong. Central to the project was analyzing pitch frequencies, and simulating the harmonic beating which takes place between the male and female tunings of several instruments. The procedure for sampling the instruments, and also utilizing a software synthesis application to analyze the sounds will be described below. A composition by Akito Van Troyer employing additive synthesis techniques was created, and details of the composition implementation including novel procedures for employing table look-up functions to control rhythm, tempo, and duration will be explained.

Explanation of the Instruments

The simplest view of a Balinese gamelan consists of two instruments which are paired in their tuning employing a complementary female (slightly lower-pitched pengumbang, also called wadon) and male (slightly higher-pitched pengisep, also called Lanang) relationship. The unison pitches on the two instruments are not identical frequencies and when the same melody is played on the different instruments (male and female) the characteristic shimmering sound of Balinese gamelan is heard, the result of an acoustical beating called ombak (literally, “waves”). In the beginning, however, when learning complex melodies the tones of a complex melody are often divided, hocket-style, into Sahnsi and Polos parts and performed by two players. The players may or may not play their Sahnsi or Polos parts on male and female instruments. In order to insure that a melody which has been divided into Sahnsi and Polos is heard with the characteristic beating quality, we would assume four instruments (two male and two female instruments), with four players, two of which play Sahnsi (on male and female) and two which play the Polos (also on male and female).

The Polos part is normally associated with the downbeat, and the Sahnsi the offbeat. Sahnsi and Polos is not a male and female relationship but a rhythmic one. The higher pitched male instrument of the family is assigned the Polos (the on-beat part, roughly), and the lower pitched female instrument is assigned the Sahnsi (the off-beat part, roughly). The so called kotekan, or interlocking melody, shared amongst the players helps them learn complicated parts, and also to play in a composite manner, executing faster and more complex melodies than a single human can produce (source: Remus).

Gamelan Instrument Samples

In order to analyze pitch frequencies of the gamelan instruments employed for the project, and to determine the rate of harmonic beating between paired instruments, recordings were made and samples were collected. The recording procedure included the use of two microphones for source stereo recording, at 96 kHz, 16-bit. Later the sample files were downsampled to 44.1 kHz, 16-bit for analysis purposes. Each instrument was struck and allowed to sustain for the duration of the recording. Instruments were recorded separately (male or female), together (male and female), and in stereo and mono.

male and female gangsa instruments
Figure 1. Image of Balinese Gamelan Gangsa instruments (male and female).

Analysis

The purpose of sampling the instruments was to discover the actual pitches as frequencies as well as the frequency of harmonic beating between the paired instruments (male and female). While the tuning and pitch scales of gamelan instruments fall within traditional patterns, Christine Southworth has noted that the beating rates vary, both within each gamelan and between different gamelans. Southworth also noted that tunings of the various Indonesian gamelans generally differ in both starting frequencies and subsequent intervals.

After sampling the instruments, the attack caused by striking the instrument was removed using an audio editor, resulting in a sample containing the sustain portion of the sound without the attack transient.

A frequency analysis was performed using the external MaxMSP object fiddle~, in a patch created by Akito Van Troyer. The fiddle~ object, a pitch estimator and sinusoidal peak finder, can be employed to report frequencies for partials. (1)

Figure 2 shows a Gangsa sample being analyzed in real-time. Pitch is reported as MIDI note numbers, then these MIDI numbers are converted to frequencies in hertz using the mtof object. The fiddle~-reported MIDI note numbers are shown in the Max window on the right side of the image, while the frequency in hertz is reported in the large number box near the left center of the image.

MaxMSP analysis patch
Figure 2. Van Troyer’s Max/MSP patch to analyze gamelan samples.

The fiddle~ object can also be used to verify rates of harmonic beating. The rate of harmonic beating can be deduced from the difference between two closely-spaced frequencies. Figure 3 shows adapting a “cooked” output of fiddle~ to verify beat frequencies using the Max objects counter and clocker.

MaxMSP analysis patch
Figure 3. Max/MSP fiddle~ object used to verify the rate of harmonic beating.

Appendix I shows the complete list of the analyzed frequencies, as well the beat rates observed.

Composition

The spectral analysis data of gamelan instruments showed that additive synthesis could be employed to simulate the basic sound of the instruments. Additive synthesis was implemented in Csound by summing multiple instances of the oscili opcode (see below). Partial content was heightened by adjusting partials and amplitudes as a creative component in the piece. The heightened partial content was selected, utilizing Max/MSP filters prior to analysis by fiddle~ in the patch from Figure 2 above, in order to resonate particular frequencies. (2)

Partial frequencies reported by fiddle~ were converted to ratios and placed in Csound f-tables (indicated by -2, below).

Gen2 transfers data from immediate pfields into a function table. The partial ratios below (1, 2.7, 4.63, etc.) do not represent a synthesized waveform, but simply a list of numbers as ratios (for a complete view of the Csound score & orchestra see the attached Gamelan_Study1.csd.zip).

;Gangsa harmonic partial
gitmap5 ftgen 6, 0, 8, -2, 1, 2.7, 4.63, 5, 8.2, 11.3, 0, 0
;partial str
gitmap15 ftgen 16, 0, 8, -2, 1, 0.13717, 0.04665, 0.04, 0.01487, 0.00783, 0, 0

The use of the opcode oscili allows for changing and summing the various partial numbers at the k-rate, which is shown below as the input k-rate variable ‘kpit’. The variable kpit is reading from zack space location 12. Code not shown was used to convert the ratio numbers back to cycles per second before writing to zack space (see the Gamelan_Study1.csd file):

kpit zkr 12
ktimb zkr 1
a1 oscili klp, kpit, iosc ; fundamental
a2 oscili klp*ks2, (kpit*kp2)*ktimb, iosc ; 2nd harmonic
a3 oscili klp*ks3, (kpit*kp3)*ktimb, iosc ; 3rd
a4 oscili klp*ks4, (kpit*kp4)*ktimb, iosc
a5 oscili klp*ks5, (kpit*kp5)*ktimb, iosc
a6 oscili klp*ks6, (kpit*kp6)*ktimb, iosc

Beat frequencies between male and female were created using a second Csound instrument, similar to the first, but having a slight pitch offset. The k-rate variable ‘kbet’ (below) shows the addition of a six hertz offset:

kpit zkr 12
ktimb zkr 1
kbet = 6
a1 oscili klp,kpit+abet,iosc ; fundamental
a2 oscili klp*ks2,((kpit*kp2)*ktimb)+kbet,iosc ; 2nd harmonic
a3 oscili klp*ks3,((kpit*kp3)*ktimb)+kbet,iosc ; 3rd
a4 oscili klp*ks4,((kpit*kp4)*ktimb)+kbet,iosc
a5 oscili klp*ks5,((kpit*kp5)*ktimb)+kbet,iosc
a6 oscili klp*ks6,((kpit*kp6)*ktimb)+kbet,iosc

Considerable effort was spent on algorithmic design to ensure that Csound’s score file entries were kept to a minimum. (3) Csound receives events from the score which include start time, and note lengths or durations. In Van Troyer’s design, however, rhythms are generated as samples employing f-tables. Table 162, for example, which contains zeros and ones, is read by a phasor. When the phasor encounters a ‘1’, a note is triggered. The speed of the phasor and the number of zeros between the ones determines a micro-rhythm which is repeated as one of the basic rhythmic cells during a formal section of the piece (4).

gitmap162 ftgen 162, 0, 32, -2, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0

The duration of formal sections, in which different instruments are sounding, or changing tempos, or amplitude over the duration of that section is determined by a hierarchical system of sequencing f-tables. (5) In other words, f-tables call f-tables, which contain values. Hence the large number of f-tables utilized in the composition. Global control of the tempo of the formal sections of the piece is determined by the linseg opcode which sends terraced envelope step values to instruments which also contain phasors. The speed of the phasors in several instruments, each representing a different gamelan instrument, is controlled globally in that manner. Dynamics are also controlled globally through a k-rate value used as the amplitude input values for the oscili opcodes. (6)

Although it is possible to render the piece in real-time with Csound by adjusting various header parameters (see “Csound Users Manual”, “Using Csound, Optimizing Audio I/O Latency”), due to the heavy demands on the processor, the piece has been rendered to an mp3 for listening (7).

Audio 1. Gamelan Study, by Akito Van Troyer. [mp3]

Conclusion

Csound is an effective software synthesis application for employing additive synthesis techniques to simulate the sound of gamelan instruments. In one sense, the Balinese Gamelan can be thought of as a sort of large, additive synthesis instrument. The shimmering quality of the tones produced by the  beating of slight differences in tunings between instruments is easy to reproduce, but may have further implications in sympathetic resonances (for example with gamelan gongs) which were not investigated in this project.

Notes

  1. For fiddle~ see Puckette, 1998: MSP port by Ted Apel, David Zicarelli. Max/MSP is a licensed, commercial software product and is available for purchase from http://www.cycling74.com.
  2. LowPass or HighPass filters were applied to the gamelan samples before the fiddle~ analysis, creating an equalization effect in order to increase the amplitudes of certain partials. The image below shows Van Troyer’s Max/MSP analysis patch employing filters as pre-EQ:
    MaxMSP analysis patch
  3. Several instruments act as triggering instruments for other instruments. For example instrument 20 Kempli (the metronome-like instrument), triggers instrument 1 using the schedkwhen opcode. This method is employed to help control overall entrances of particular instruments without having to list too many events in the score. At other places in the code the event opcode is used to trigger score events, such as instrument 25 Jegogan Trigger, which allows instruments 4 and 5 to play.
  4. The ktab variable in instrument 29 Gangsa Trigger, represents values from table 162. Further kpp = ktrig*ktab, such that later if (kpp == 1) then instrument 8 Gangsa (female) is triggered by schedkwhen.
  5. A small graphic portion of the formal design below shows table 500 which calls tables 600, 601, 602, 603, etc. Table 600 in turn calls tables 67, 68, 69, 70 etc. In each of those tables, for ex. table 67 individual pitch frequencies 448, 448, 828 etc. are indicated.
    Tables calling tables
  6. Instruments 100 and 101 write k-rate values from a linseg opcode to zak space and are used for global tempo and dynamic control. In several instruments the linseg k-rate values are read from zak space into a ktemp variable which is used for local tempo control. Many instruments also read from zak space into a kdyn variable which is applied to the oscili amplitude parameter for overall dynamics control. Instrument 101 also uses the loopseg opcode to control the dynamics of instruments 8 and 9, Gangsa, and Reyong by writing a kvalue, kdyn to zak space. Instruments 10 and 11, also Gangsa and Reyong employ kdyn = (kdyn*(1-2))+1 to invert the kdyn value read from zak space. Thus the amplitude of instrs 10 and 11 work in opposite amplitudes from instr 8 and 9, as Gangsa and Reyong alternate as voices during the performance of the piece.
  7. Beyond adjusting the parameters specified in “Optimizing Audio I/O Latency” from the “Csound Users Manual”, such as number of ksmps, the software(-b) and hardware buffer(-B), and the user’s preferred rtaudio module (alsa, portaudio, MME, etc.); an additional setting which is the kval number assigned as input to the vdelayk opcode may also require adjustment for real-time performance. The vdelayk opcode appears in instruments 29, 31, 33, and 35 Gangsa and Reyong and adds a small amount of delay for the specified instruments in the phasor start time in order to synchronize other instruments with the Kempli instrument which is the beat keeper (sounds like a metronome).

References

Loy, Gareth. Musimathics — A Guided Tour of the Mathematics of Music, Volume 1: Musical Elements. Cambridge, MA: MIT Press, 2006. [Chapter 2, “Representing Music,” discusses spectra, interval ratios, partials and overtones, dynamic spectra, bandwidth etc. which are basic topics applicable to computer music.]

National Geographic World Music. “Gamelan.” 1996–2006. Accessed 1 August 2007. http://worldmusic.nationalgeographic.com/worldmusic/view/page.basic/genre/content.genre/gamelan_721

Puckette, Miller, Theodore Apel and David Ziccarelli. “Real-time Audio Analysis Tools for Pd and MSP.” Proceedings of the International Computer Music Conference 1998.

Remus, Bill. “Notes On Playing Gamelan Bali: Gong Kebyar Style.” 5 April 1996. Accessed 1 August 2007.
http://remus.shidler.hawaii.edu/gamelan/balinota.htm

Southworth, Christine N. “Statistical Analysis of Tunings and Acoustical Beating Rates in Balinese Gamelans.”  June 2001. Accessed 12 June 2007.  http://www.kotekan.com/thesis.html

Vercoe, Barry. “Csound Users Manual.” 1992. Accessed 12 June 2007. http://sourceforge.net/projects/csound and http://www.csounds.com

Appendix I

Pitch is accumulated using MIDI note number. Then this MIDI note number is converted to Frequency (Hz) using the mtof object. Beat rate equation: f2 = f1 - f0

Jegogan Section
Female Male Beat Rate
1 136.36Hz 142.65Hz 6.29Hz
2 147.68Hz 154.66Hz 6.98Hz
3 160.95Hz 167.69Hz 6.74Hz
5 203.73Hz 210.92Hz 7.19Hz
6 216.60Hz 223.72Hz 7.12Hz
Calung Section
Female Male Beat Rate
1 272.73Hz 279.06Hz 6.33Hz
2 295.71Hz 302.97Hz 7.26Hz
3 321.73Hz 328.87Hz 7.14Hz
5 406.99Hz 415.06Hz 8.07Hz
6 433.44Hz 441.02Hz 7.58Hz
Gangsa Section
Female Male Beat Rate
Lo2 295.70Hz 302.46Hz 6.76Hz
Lo3 320.24Hz 327.73Hz 7.49Hz
Lo5 405.82Hz 413.87Hz 8.05Hz
Lo6 432.44Hz 440.25Hz 7.81Hz
Mid1 550.54Hz 558.22Hz 7.68Hz
Mid2 598.29Hz 605.24Hz 6.95Hz
Mid3 650.93Hz 656.97Hz 6.04Hz
Mid5 818.70Hz 826.30Hz 7.60Hz
Mid6 871.40Hz 880.00Hz 8.60Hz
Hi1 1108.73Hz 1115.80Hz 7.07Hz
Gangsa Section(Hi)
Female Male Beat Rate
Lo2 597.94Hz 605.59Hz 7.65Hz
Lo3 648.68Hz 656.22Hz 7.54Hz
Lo5 813.99Hz 820.59Hz 6.60Hz
Lo6 872.41Hz 877.97Hz 5.56Hz
Mid1 1108.73Hz 1116.44Hz 7.71Hz
Mid2 1196.57Hz 1204.20Hz 7.63Hz
Mid3 1298.74Hz 1306.38Hz 7.64Hz
Mid5 1638.35Hz 1646.89Hz 8.54Hz
Mid6 1742.80Hz 1750.87Hz 8.07Hz
Hi1 2209.79Hz 2218.74Hz 8.95Hz
Reyong Section
Lo3 322.17Hz  
Lo5 408.81Hz
Lo6 433.51Hz
Mid1 551.32Hz
Mid2 597.81Hz
Mid3 648.19Hz
Mid5 820.33Hz
Mid6 872.61Hz
Hi1 1110.62Hz
Hi2 1198.57Hz

Social bottom