Operatic characters are defined by the violence of their passions. For this reason, the demon barber in Stephen Sondheim's Sweeney Todd - a visionary fanatic who slits throats as an offering to the carnivorous god he worships - belongs at the Royal Opera, in company with such holy sinners as Puccini's pious torturer Scarpia from Tosca or Alban Berg's Jack the Ripper from Lulu. In Covent Garden's new production, Thomas Allen's sallow, glowering Sweeney is a scary epilogue to his Don Giovanni; as Mrs Lovett, who minces up the barber's victims and bakes them into pies, Felicity Palmer cheerfully parodies her own recent performance as Klytamnestra, sacrificing battalions of slaves in Strauss's Elektra. Opera is about blood, sperm, and all the body's other viscous products, two of which are mentioned for the first time in Sweeney Todd. The barber denounces a green tonic sold by an Italian mountebank as piss, and declares that rancid, predatory London smells like shit.
Sondheim cautiously admits that Sweeney Todd is "virtually an opera". Nevertheless he has chosen to categorise it as "a musical thriller", and it pays due homage to the scores composed for Alfred Hitchcock by Bernard Herrmann. There's a staccato mimicry of the stabbing in the shower from Psycho, with bottled shrieks from a factory whistle, and a recurring harmonic shock - "a tritone sitting on top of a minor chord", as Sondheim describes it - recalls the dizzying view into an open grave in Vertigo. Intriguingly, the ultimate source for that abysmal, quaking tritone is the demented piano concerto Herr-mann wrote for a thriller called Hangover Square, with Laird Cregar as a nutty composer who slaughters a music-hall singer and sets fire to the hall, where he plays his distempered Lisztian showpiece. Sondheim enlists this maniac as a colleague: his own professed aim in Sweeney Todd is "to scare the audience to death".
Early productions of the work emphasised its satire on an industrial society in which cannibalism is an economic imperative. The set for the 1979 premiere in New York was constructed from the remnants of a Rhode Island iron foundry. At Covent Garden, the director Neil Armfield and the designer Brian Thomson present a version that is starker, barer and more psychotic. They dispense with mechanistic trickery and place the action inside a grubby cage, curtained with shrouds. Todd's abducted daughter covets a caged bird, which has been blinded so that it will sing continually (Sondheim's savage comment, perhaps, on the mellifluous nonsense dispensed by most operatic sopranos); she herself ends up caged in a lunatic asylum. As in a magic-lantern show, obscene playlets - the rape of Todd's wife by a venal judge, or the cavorting of the Bedlamites - are enacted by shadows behind the enshrouding drapes.
The sexual manias of these people are even fouler than the fly-blown pies that they eat. A beadle's truncheon filthily wielded by Robert Tear does duty as a militant penis, and the raddled beggar played by Rosalind Plowright hoists up her skirts to offer customers a glimpse of her dirt-encrusted groin. Jonathan Veira as Judge Turpin flagellates himself to a solitary orgasm while peering at his nubile ward through a keyhole, then collapses sated. Other unmentionable body parts can be discerned if you listen carefully to Sondheim's quick-witted rhymes or his gruesome puns. When Todd objects that a pie containing a massacred priest has too much fat, Mrs Lovett says "Only where he sat"; he challenges her to cook up a general, and she cheekily asks, "With or without his privates?", adding that the general's tasty genitals will rack up the price.
For Sondheim, Sweeney Todd is a revenge tragedy, and the barber's rampages, as he said when I discussed the work with him in 1995, are "a righteous act". The composer nurtures vindictive grudges of his own, which perhaps lie behind Todd's lethal vocation. Sondheim's mother perversely blamed him for his father's desertion of her, and loudly wished he'd never been born. Later, when the daughter of Richard Rodgers presented him with a plate, Sondheim - a Salome more inclined to execute Herodias than John the Baptist - innocently inquired, "Where's my mother's head?" He points to the edge of malice and the undertow of mortality in the most apparently innocuous of his scores, and describes A Little Night Music as "a Viennese operetta - but with knives". Here those prickly implements open into silver-plated cut-throat razors, to which the barber sings an enraptured aria set to an inversion of the "Dies Irae". Jewels glitter on the blades, as he says: the arteries of his customers bleed rubies. That image embodies the cruel, dangerous beauty of the work. Sweeney Todd concocts delicacies from offal, finds art in ordure, and enables Sondheim himself to get away with murder.
Sweeney Todd is at the Royal Opera House, London WC2 (020 7304 4000) until 14 January