The only previous time I have been to a wayang, the Javanese shadow-puppet theatre, was a show in Yogyakarta, Java's tourist capital. I fell asleep - but that's OK. Wayang shows last all night, and snoozing is perfectly acceptable. It's less acceptable, however, if you're one of the performers. So I'm rather daunted at the prospect of performing, as a member of the South Bank Gamelan Players, in an eight-hour show this Saturday night.
Then again, playing in a wayang will be a lot less restful than watching one. The music is mostly loud and fast, and the musicians accompanying the puppeteer have only a general idea of what's going to happen next. It's a game of follow-my-leader: the gamelan's drummer follows the puppeteer, and conveys his intentions to the rest of the group using rhythmic patterns that signal when a piece ends, or moves from one section to another, or segues into another piece. If you're taking a holiday from concentration, you can find that everyone else is playing something different from you. Or worse, not playing at all, leaving you with an inadvertent solo.
But assuming we can all keep up and stay conscious, it will be a thrilling night. Imagine a cross between a Punch and Judy show and the Ring cycle, plus fart jokes, and you're starting to get an idea of a wayang. The shadow play is the focal point of Javanese dramatic, literary, musical and visual arts, and the puppeteer's role combines actor, musician, stand-up and shaman (villages experiencing bad times will put on a wayang in the hope of changing their fortunes). He moves the puppets, does the voices, sings songs and banters with the group, adding improvised and topical elements to an ancient story (told in Javanese, with surtitles for our show). In Java, it's huge, and the top puppeteers - including Ki Purbo Asmoro, who has flown in to perform the London wayang - play to stadium-sized crowds.
"A wayang is a complete artwork," says Ki Purbo. "It presents the whole story of human life, not just good and evil, or winning and losing. But even if you don't follow the story, there's lots of interest in the slapstick, the music, or the beauty of the puppets. It's a misconception just to see it as black images on a white screen - the shadow is the least of it."
Wayangs use stories from the Hindu culture that preceded Islam as Java's dominant religion. For ours, Ki Purbo is telling an episode from the Mahabharata, the epic struggle between two royal families in which the virtuous Pandawa build a city in an enchanted forest given to them by their cousins, the devious Kurawa. Each of the score of characters - princes, ogres, clowns, animals and more - is represented by a flat, jointed figure made of intricately worked and painted leather. You can watch from the shadow side, from where only the silhouettes are visible, or you can go round the back and watch the puppeteer and the gamelan at work.
The core of the gamelan is a set of bronze percussion instruments - metallophones and gongs with non-western tunings and registers ranging from whale-song to bat-squeak. The patterns they play are melodious but strange, repetitive but shifting. You can hear the sounds and structures of gamelan in music by Debussy, Britten, Messiaen, and American minimalists such as Steve Reich. It can also come across like techno played on acoustic instruments - think of the dreamy electronica of Four Tet, or percussion-heavy post-rock groups such as Tortoise.
Gamelan can be gentle and intricate or, when the group is pounding away in unison during a battle scene, direct and deafening. But rather than being a linear music with a clear tune to focus on, it's more like a garden of sound. At its best, it seems to stop time. But it's also natural to let your attention drift outside the music, to chat to a friend, visit the bar, pop outside to look at the river - or nod off. It's not designed to be played in concert halls where everybody sits still and shuts up.
Besides percussion, the ensemble of 24 musicians is completed by stringed instruments, a chorus of three male voices, and two female solo voices - in this case Sukesi, another guest artist from Indonesia, and our own Esther Wilds, a brilliant singer who as a member of Purbo's group became something of a celebrity in Java. Collectively, the SBGP - who have been based at the Festival Hall for more than 20 years - have played and studied in Indonesia for several decades, but this is our first all-night wayang, and the first by any British group.
The gamelan's job is to focus its energies through the puppeteer, to become part of the whole. Aiding us is our third Javanese guest, Rahayu Supanggah, the group's drummer and musical director for the evening. He's one of the most important living gamelan musicians and composers in the world. In his 58 years, he has performed in more than 40 countries, written music for instruments from just about everywhere, and worked with theatre directors including Peter Brook and Robert Wilson. A collaboration with the Kronos Quartet is in the diary for next January, and he wrote the score for Garin Nugroho's film Opera Jawa, released today. Despite this CV, he is completely un-maestro-ish. Humorous and approachable, Supanggah is as keen to find out how we do things as he is to tell us how they should be done, and he adapts his drumming to our playing, steering the group with a gentle hand.
This is in keeping with the traditions of gamelan. It is a collective and democratic music. No part is set above another, and many, although not all, of the instruments are technically easy - the skill lies in listening and reacting to what's going on around you. It takes a minute to learn, and a lifetime to master: a beginner can hold their own in a group alongside a virtuoso, and each will find something rewarding and challenging in the music. "In gamelan, there's no boundary between what's easy and what's difficult," says Supanggah. "You can play a concert after two hours' practice, but you can also work on something for 40 years and still not get it."
Another aspect of Javanese gamelan is its indeterminacy. If a western score is like a recipe - do this, then do this - a gamelan piece is more like the rules of a game. A piece could be as simple as a sequence of eight notes, played round and round. Each player takes this skeleton and fleshes it out, by using the conventions for each instrument, responding to other players and drawing on his or her expertise and inclinations. A piece's tempo, duration and mood arises out of the dynamic between the players, and the possibilities are literally infinite, like a fractal into which you can zoom at ever deeper levels of magnification. In 2004, a group of physicists published a paper declaring that gamelan is the most rhythmically complex music in the world, but this complexity emerges from the group rather than from the skill of any individual.
This means that gamelan music is composed anew every time it's played. Which is why Supanggah wants our music to say something about us, rather than just recreating what happens in Java. "Each composition is different according to the time and place it's played, the function of the music, and the musicians playing it," he says. "There's no right and wrong, only good and bad." The prospect of being on one's toes, musically, for a whole night is nerve-racking, but the uncertainty is also comforting - you can't worry in advance, because nothing exists until it's played. And if we knew how it was going to turn out, there would be no need to play it.
· The wayang takes place at the Royal Festival Hall, London, from 10.30pm on Saturday until 7am on Sunday. Box office: 0871 663 2500.
