The soundtrack of the film was composed by the sitar player Ravi Shankar, who was at an early stage of his career, having debuted in 1939. The background scores feature pieces based on several ragas of Indian classical music, played mostly on the sitar. The soundtrack, described in a 1995 issue of The Village Voice as "at once plaintive and exhilarating", is featured in The Guardian's 2007 list of 50 greatest film soundtracks. It has also been cited as an influence on The Beatles, specifically George Harrison.
Shankar saw about half the film in a roughly edited version before composing the background score, but he was already familiar with the story. According to Robinson, when Ray met Shankar the latter hummed a tune that was folk-based but had "a certain sophistication". This tune, usually played on a bamboo flute, became the main theme for the film. The majority of the score was composed within the duration of a single night, in a session that lasted for about eleven hours. Shankar also composed two solo sitar pieces—one based on the raga Desh (traditionally associated with rain), and one sombre piece based on the raga Todi. He created a piece based on the raga Patdeep, played on the tar shehnai, to accompany the scene in which Harihar learns of Durga's death. The film's cinematographer, Subrata Mitra, performed on the sitar for parts of the soundtrack.