Progressive Rock Artist seeks Audience

Gamelan SFZ Instrument Definitions

If you’re just here for the free SFZ files, the link to download them is at the end of the post. But if you are interested in the journey I took to get there, keep reading.


I’m thinking of including sounds from a Javanese Gamelan in my next project. After some Internet searching, I found a pretty complete set of samples available from Casa da Música released under a generous license. The sample files are available in a single download:   360 MB

Unpacking the ZIP reveals a substantial directory structure:

            Gamelão da Casa Da Música - Porto, Portugal\

The sample files for each instrument are distributed within the subdirectories, along with a set of instrument definitions for NI’s Kontakt Sampler.

Unfortunately I can’t use the .nkm Kontakt instrument definitions because I don’t have the full version of Kontakt. However I do know how to create my own instruments using the SFZ format, which is a standard text file format used by many Cakewalk virtual instruments and other third party sample players like the venerable but lightweight rgcaudio SFZ Player, or Plogue Sforzando.

Reviewing the Library

The library contains samples from three families of instruments: Drums; Gongs; and Keys. The samples are in stereo WAV format, grouped into subdirectories and with a file name prefix to identify the instrument:

DrumsKendhang AgengDrum, Large
CiblonDrum, Medium
KetipungDrum, Small
GongsBB_ _Bonang BarungLaid Gong, Medium
BP_ _Bonang PenerusLaid Gong, Small
K_ _KenongLaid Gong
Kt_ _KethukLaid Gong
Kp_ _KempyangLaid Gong
GA_AgengHanging Gong, Large
GS_SuwukanHanging Gong
GK_ _KempulHanging Gong
KeysGS_ _Gender SlenthemMetal Bars, Large
GB_ _Gender BarungMetal Bars, Medium
GP_ _Gender PenerusMetal Bars, Small
SD_ _Saron DemungThick Metal Bars, Large
SB_ _Saron BarungThick Metal Bars, Medium
SP_ _Saron PekingThick Metal Bars, Small
G_ _GambangWooden Bars
Table 1 – Instrument Families in the Sample Library

These samples do vary in quality: most are very good, but many have odd resonances; are too quiet; are excessively long; or have tonal differences that are distracting. I can also hear from recording compression artifacts as the sounds decay into silence. Some even have negative phase correlation.

I could actually modify the sample .WAV files themselves for my own use but my reading of the license tells me that I then would not be able to distribute them. (I could be wrong about that.) However there is still a lot that can be done with the raw samples just by controlling how they are used in an SFZ instrument definition.

An SFZ instrument definition is just a text file, using simple HTML-like tags to define how samples are allocated to a MIDI keyboard; and played in response to a key press. (More information on SFZ available here.)

The Scales

Gamelan instruments are either SLENDRO (5-note scale) or PELOG (7-note scale). The scale intervals and root notes are not standardized between orchestras like Western 12-tone temperaments, but within any given orchestra, there should be consistency among its instruments.

The Pelog scale roughly approximates that of the phrygian mode of the Western major scale (E-E on the white keys of the piano), with the notes EFGBC corresponding to the note positions 12356 in the slendro scale used by most gamelan.

Catherine Schmidt-Jones, Musical Travels for Children

Musically, the 5-note Slendro scale is similar to the Western pentatonic scale, with scale intervals of large, small, small, large, small.

The (pelog) scale “selisir” is the most common; this scale leaves out the fourth and
seventh notes.

Pieter Duimelaar

Back to the Library

For pitched instruments, a file name suffix indicates the scale of the instrument, and a number or letter indicates the scale note and octave:

    Sample file suffix  Scale                    Scale Notes
    ------------------  ----------------------   --------------
    __SLxx              Slendro (5 note scale)   1 2 3   5 6   
    __PLxx              Pelog   (7 note scale)   1 2 3 4 5 6 7 

Scale Notes

The Slendro scale samples in the CDM library would appear to use a root note of C, whilst the Pelog samples start on D.

Approximately mapping sample note to apparent pitch:

                   Slendo Scale           Pelog Scale
  Instrument       1   2   3   5   6      1   2   3   4   5   6   7
  -----------      -------------------    --------------------------
  Bonang           C   D#- F   G+  A+     D-  D#  F-  G   G#  A+  B  
  Kenong           C   D+  F-  G+  A+     D-  D#  F-  *   A-  A+  B
  Kempul           C   D#- F   G   A      D-  D#  F-  *   A-  A+  B
  Gender Slenthem  C   D+  F   G   A+     D   D#  F-  G   G#  A#+ B 
  Gender Barung    C   D#- F-  G+  A+     D-  D#+ E+  *   G#+ A+  B  
  Gender Penerus   C   D+  F-  G+  A+     D   E-  F+  *   G#+ A#  B+  
  Saron            C   D+  F-  G+  A+     D-  D#  F-  G+  G#+ A+  B  
  Gambang          C   D+  F   G+  A+     D   D#  F-  *   G#+ A#- *

* = No sample provided (see “Selisir” scale variant described above).

This assumes that the scale note number in the sample file name is accurate – which seems to be the case.

Assigning Samples to the Keyboard

When mapping the Slendro samples to the conventional piano keyboard, we could start at C. However, musically, the 5-note Slendro scale is similar to the Western Minor Pentatonic scale, and therefore maps quite well to the black notes on the piano keyboard. If we did that, we could then map the Pelog scale notes to the White keys.

In reviewing the samples of each instrument, I found that the Slendro scales aren’t consistent in their interval sizes:

Instrument     Slendro Scale Interval                     Pentatonic Root
----------     --------------------------------------------  ------------
Bonang          [1]long [2]short[3]short[5]long [6]short[1]    [1] C    
Kenong          [1]short[2]short[3]long [5]short[6]long [1]    [6] A+
Kempul          [1]long [2]short[3]short[5]long [6]long [1]    [1] C   
Gender Penerus  [1]long [2]short[3]long [5]short[6]short[1]    [3] F-
Gender Barung   [1]long [2]short[3]long [5]short[6]long?[1]    [3] F- (*)
Gender Slenthem [1]long [2]short[3]long [5]short[6]long?[1]    [3] F- (*)
Saron           [1]long [2]short[3]long [5]short[6]short[1]    [3] F- 
Gambang         [1]long [2]short[3]long [5]short[6]short[1]    [3] F-  

                                               (*) approx, matches Penerus

If we assign the Slendro scale note that corresponds to the Minor Pentatonic root to the Eb key; and assign the Pelog scale notes to the corresponding adjacent White keys, we get:

                     Slendro Scale        Pelog Scale
   Instrument        1  2  3  5  6        1  2  3  4  5  6  7
   ---------------   ----------------     --------------------
   Bonang            Eb Gb Ab Bb Db       E  F  G  A  B  C  D 
   Kenong            Gb Ab Bb Db Eb       G  A  B  -  D  E  F  
   Kempul            Eb Gb Ab Bb Db       E  F  G  -  B  C  D 

   Gender Slenthem   Bb Db Eb Gb Ab       C  D  E  F  G  A  B
   Gender Barung     Bb Db Eb Gb Ab       C  D  E  -  G  A  B
   Gender Penerus    Bb Db Eb Gb Ab       C  D  E  -  G  A  B
   Saron             Bb Db Eb Gb Ab       C  D  E  F  G  A  B  
   Gambang           Bb Db Eb Gb Ab       C  D  E  -  G  A  -   

I admit, I’m probably way over-thinking this.


  • The “Keys” instruments will share a common scale note : key note mapping (same pitch = same key)
  • The Slendro scale notes will be intuitively produced from the Black keys on the keyboard;
  • The 12 notes in each octave will uniformly increase in pitch from low to high, making some interesting performance possibilities (trills, note substitutions, cross-scale melodies)


  • Note 60 (“middle” C) isn’t going to produce a tone pitched at 262 Hz for any instrument, although this is hardly a new concept in orchestral assemblies;
  • It’s a shame that Kenong doesn’t map elegantly to Eb, matching the other Gong family instruments.

The SFZ Instrument Definitions

I developed the SFZ instrument definition files using Plogue Sforzando and the SFZ v2 format. However it would be easy enough to convert these back to SFZ v1 if necessary; I didn’t use any features unique to v2 other than the default sample path.

Each definition file uses a <control>default_path= operator to set the base directory to allow the sample files to be located. If it weren’t for those accented characters in the directory name, I’d have located the .SFZ files in the same directory as the .nkm files, the Gamelao_CdM\ folder.

But even just cutting and pasting the subdirectory name can cause problems, as you can see: “Gamela╠âo da Casa Da Mu╠üsica – Porto, Portugal”.

So instead, I’ve assumed the following relative directories:


This means that you’ll have to re-arrange the subdirectories to match, or edit the .sfz files to relatively or explicitly locate the samples where-ever you decide to put them.

I’ve prepared three categories of instrument definitions, indicated by a file name prefix:

  • RAW_ uses all available samples assigned to MIDI notes as per the table above. Slendro on the Black keys, Pelog on the White. I used Key Switches to separate the different kinds of sample (scale, mute/unmute, piano/forte) where available, for easy comparison. Feel free to use these instrument definitions in musical projects but really this was just intended for reference and review. I’ve made comments against each sample, where appropriate.
  • FIX_ are based on RAW_ but refined. Some sample substitution to omit noisy or tonally distracting samples, but retaining the original charm of the instrument. Hopefully still “organic” sounding. Ideally, this is what I’d use in projects that required the traditional Javanese tuning.
  • TET_ are 12-tone Equal Temperament versions, with A4=440 tuning, using cross fades, multi-samples, and other techniques to create instruments that would be used for Western tuning projects.


In general these are well-recorded samples, L-R balanced, low noise. A collection of “door slams”, “bongo hits”, and “face slaps”. I’ve assigned them to C2 > C3.


C1 and D1 are used to switch between the Barung and Penerus voices respectively.


Kenong, Kethuk, and Kempyang are arrayed with C1 and D1 switching between Muted and Un-muted (sustained) tones.

Kempul, Ageng and Suwukan are arrayed together with E1 and F1 switching between Piano and Forte voices.


Slenthem, Barung, and Penerus instruments are available using Key Switches on C1, D1, and E1.


Demung, Barung, and Peking size instruments are available using the C1, D1, and E1 key switches.


No voice variations, just Slendro and Pelog mapped across the Black and White keys, from A2 > G6.

The “FIX” instrument definitions


I’ve combined Barung and Penerus into one SFZ instrument, using round-robin alternating for over-lapping tone ranges.


Seeing as we have both muted and un-muted (sustaining) tones for Kenong, Kethuk, and Kempyang instruments, it seems sensible to combine these into one instrument definition. We could use key velocity to switch between them, but I don’t think it “works” from a performance point-of-view. I’ve used key switching, with C2 and D2 controlling Muted and Un-muted respectively.

Alternatively, we could replace the Key Switch with the following opcodes in order to play the sustained notes when the Damper Pedal is depressed:

hicc64=100          // play group when cc64=0   (sustain pedal up)

locc64=100          // play group when cc64=127 (sustain pedal down)

In practice, I didn’t like how the sustain pedal affected the natural decay of the sustained tones when the key was released, so I’ve left it as key switching. Feel free to experiment.


We have loud (forte) and soft (piano) tones for Ageng, Suwukan, and Kempul gong voices, so I combined these into one SFZ instrument, using velocity switching to change to the Forte tones. Some volume matching between samples was used.

I realize that the point in the velocity curve where the switch happens is dependent on the controller’s velocity curve; personal preference; etc, so tweak to taste.


Tonal differences between the Slenthem, Barung, and Penerus sizes mean that I’ve left them as separate key-switched ranges in this SFZ instrument. C2, D2, and E2 respectively.

I’ve used sample offsets and volume matching to try to even out some of the harsher samples, and used sample substitution in the worst cases. The result is a more uniform instrument, but still with character.


Because of a similarity of tone between the three sizes, I’ve combined these into a single SFZ instrument, using velocity switching for loud and soft tones; and round-robin for duplicates. I’ve adjusted for volume differences and also substituted some samples in cases where noise was distracting (vibration or rattle).


Generally clean samples. The Slendro notes have some rattle but it is a musical sound. Outliers in the Pelog scale have been substituted for. Clicks and initial “dead space” in the samples have been removed by limiting the sample playback regions.

The “TET” instrument definitions

The CDM library samples are used to construct a good-sounding 12-tone Equal Temperament instrument with A4=440 using the Gamelan Instruments’ samples as a source. This could be used in musical projects that would work best with Western tuning.

I’ve allowed more creative leeway in assembling the instruments. In the case of Gender and Saron, I liked the effect of playing all layers at once so I’ve provide a couple of alternative SFZ files that do that.

TET_bonang.sfzLaid Gong, Range B3 > F7
TET_kenong.sfzC2: Laid Gong (muted), Range C4 > E5
D2: Laid Gong (sustain), Range C4 > E5
TET_kempul.sfzHanging Gong, Range E2 > C4
(piano/forte on velocity switch)
TET_gender.sfzC2: Large Metal Bars, Range C3 > C4
C#2: Medium Metal Bars (Slendro), Range C3 > G5
D2: Medium Metal Bars (Pelog), Range G2 > G5
D#2: Small Metal Bars (Slendro), Range G3 > G6
E2: Small Metal Bars (Pelog), Range G3 > G6
TET_gender_ALL.sfzAll layers enabled. Thick! Range C3 > C7
TET_saron.sfzC2: Thick Metal Bars (Pelog), Range G3 > C7
D2: Thick Metal Bars (Slendro), Range G3 > C7
TET_saron_ALL.sfzAll layers enabled. Thick! Range C3 > C7
TET_gambang.sfzWooden Bars, Range G2 > G6

Okay, so where can I get these SFZ definitions?

The SFZ definition files are available here:

Reminder: You will also need to download the Gamelan WAV files referenced by these SFZ definitions, from Casa da Música.


  1. Conor

    This is fantastic! Thanks for the amazing work =)

  2. Joe

    Thank you very much

Leave a Reply

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

© 2024 The Prodigal Sounds

Theme by Anders NorenUp ↑