“The Singing Detective” has a distinguished pedigree, having been adapted to an American setting by the late Dennis Potter from his celebrated six-hour British television series. Unfortunately, ancestry doesn’t always guarantee quality. The film follows the pattern of Potter’s earlier “Pennies from Heaven,” which was also originally a multi-episode TV production adapted into a American film, in that it uses pop songs, lip-synched by characters, as a means of revealing their motives, dreams and fears. But in the earlier instance the procedure worked brilliantly–Herbert Ross’s 1981 picture, which was unjustly maligned at the time, had a richness and depth that compared well with the British original. In the present case, the result is a cinematic belly-flop rather than a beautiful swan dive. The one among the ’50s records that occurs most frequently here is Patti Page’s “How Much Is That Doggie in the Window?” In this case, the correct answer would be: whatever a viewer’s ticket cost.

That’s a bit of a surprise, given that the film is the work of Keith Gordon, the actor-turned-director who has previously worked wonders with challenging material on next-to-nothing budgets (“The Chocolate War” and “A Midnight Clear”–“Mother Night” wasn’t quite as successful). This time, though, he’s really come a-cropper. When, early on, a couple of uncomfortable lines show up–Saul Rubinek’s “Things are bad here” and Robert Downey, Jr.’s “I can’t stand any more of this”–one is already willing to nod in agreement.

At its foundation “The Singing Detective” offers what’s really a simple, even simplistic narrative arc–the passage of a highly troubled individual to psychological well-being, reflected in a physical cure from what’s probably a psychosomatic illness. The patient, Dan Dark (Downey) overcomes his trauma over watching his mother’s slide into prostitution and the memory of her suicide–which created in him not only a strong suspicion of all women but also a horrible skin disease–through medical treatment and therapy. But being that this is a Potter product, it’s told in an obscure and complicated way. Dark is a none-too-successful mystery writer who imagines himself as the protagonist of his books, a combination Sam Spade-like sleuth and nightclub singer. Included in his memories of his true past and his book-based dreams are his mother (Carla Gugino), who’s also a hooker in his fictional story; a fellow named Mark Binney (Jeremy Northam), who apparently romanced his mother in real life but is some sort of unscrupulous villain in his dream novel; and two comic Damon Runyon-style thugs (Adrien Brody and Jon Polito). (When at one point this duo finds itself lost in the desert and deliver the Beckett-like line “What are we looking for?” and the response “I don’t know,” you’ll certainly be moved to groan.) Also on hand are the “true” Dark’s long-suffering wife (Robin Wright Penn) and the shrink who gently brings him back to adjustment (producer Mel Gibson, doing a crotchety routine very badly in a bald hair-cap). And, oh yes: in the hallucinatory scenes plenty of pop tunes from the 1950s are used, either as routines by the warbler/gumshoe or as bits performed by other characters. This device, which had considerable poignancy and resonance when employed with depression-era songs in “Pennies from Heaven,” seems like nothing more than an affectation here, since the tunes don’t seem connected to either time-frame and mostly appear arbitrarily chosen. (The fact that Gordon doesn’t seem able to stage them gracefully makes the technique all the more pointless.) The director’s handling of all the material, in fact, is flat and shapeless throughout.

The cast mostly drowns in the morass. Penn is okay in a thankless role, but Gibson seems to be slumming, and Northam’s accent work is poor. Brody and Polito embarrass themselves acting like bad refugees from “Miller’s Crossing.” And as for Downey, while one has to admire his level of commitment, he seems more desperate than involving, spitting out his cynical one-liners as though he were trying to get rid of them as quickly as possible–the only plausible way to deal with such material. The film doesn’t even look good; after the staggering beauty of “Pennies from Heaven,” “The Singing Detective” looks as though it was shot in cubicles too small by half, and the overly bright cinematography by Tom Richmond is positively headache-inducing.

Mel Gibson’s Icon Productions had better hope that the upcoming “The Passion” will do robust business to cover the losses they’ll surely suffer on this turkey. To emulate the bad hard-boiled dialogue that fills so much of “The Singing Detective,” you’re going to need buns of steel to sit through such a total debacle.