Diegetic music or source music is music in a drama (e.g., film or video game) that is part of the fictional setting and so, presumably, is heard by the characters.  The term refers to diegesis, a style of storytelling.
The opposite of source music is incidental music or underscoring, which is music heard by the viewer (or player), intended to comment on or highlight the action, but is not to be understood as part of the "reality" of the fictional setting.
Source music was sometimes used as scores from the earliest days of Hollywood talkies, in some cases — e.g., The Public Enemy (1931) — using it to the exclusion of any underscoring; or in Touch of Evil (1958), where there is proportionately more source compared to underscore.
Film sound and music
If the characters in the film can (or could) hear the music the audience hears, then that music is called diegetic. It is also called source music by professionals in the industry. It is said to be within the narrative sphere of the film. For instance, if a character in the film is playing a piano, or turns on a CD player, the resulting sound is diegetic. The cantina band sequence in the original Star Wars is an example of diegetic music in film, with the band playing instruments and swaying to the beat, as patrons are heard reacting to the second piece the band plays.
By contrast, the background music that cannot be heard by the characters in the movie is termed non-diegetic or extradiegetic. An example of this is in Rocky, where Bill Conti's "Gonna Fly Now" plays non-diegetically as Rocky makes his way through his training regimen finishing on the top steps of the Philadelphia Museum of Art with his hands raised in the air.
Songs are commonly used in various film sequences to serve different purposes. They can be used to link scenes in the story where a character progresses through various stages toward a final goal. If it is synchronized with the action, as in the "Good Morning" dance sequence from Singin' in the Rain, it is said to be Mickey mousing.
This distinction may be made explicit for comic effect, a form of breaking the fourth wall. For example, the first appearance of Kermit the Frog in The Muppets is accompanied by what initially appears to be a stock "heavenly choir" sound effect, which is then revealed to be coming from an actual church choir singing on a passing bus.
A combination of these concepts in film sound and music is known in the industry as source scoring—a blending of diegetic source music, such as a character singing or playing an instrument, with non-diegetic dramatic scoring.
There are other varying dimensions of diegesis in film sound, for example, metadiegetic sound, which are sounds imagined by a character within the film, such as memories, hallucinatory sounds, and distorted perspectives. Another notable condition of diegesis is cross-over diegesis, which is explored in the book Primeval Cinema - An Audiovisual Philosophy by Danny Hahn, in which he describes it as "blending/transforming a sound or piece of music from one spectrum of diegesis to another – from diegetic to non-diegetic space". The sci-film 2BR02B: To Be or Naught to Be is an example of cross-over diegetic music in film, with Schubert's Ave Maria playing over separate shot sequences as non-diegetic music, but then later showing it to come from a gramophone in a hospital waiting room. The music also becomes diegetic with the assistance of audio engineering techniques, having its reverberation undergo change to match the room's characteristics and indicate a spatial location from the surround speakers. Even though Ave Maria reappears extensively as diegetic music, its inclusion was treated as non-diegetic by the film-makers, the song being a bespoke recording by soprano Imogen Coward to match the film's tone, and the film being edited to her recording. The recording itself was timed to include a layer of narrative commentary for audiences familiar with the German lyrics.
In musical theatre, as in film, the term "diegesis" refers to the context of a musical number in a work's theatrical narrative. In typical operas or operettas, musical numbers are non-diegetic; characters are not singing in a manner that they would do in a naturalistic setting; in a sense, they are not "aware" that they are in a musical. In contrast, when a song occurs literally in the plot, the number is considered diegetic. Diegetic numbers are often present in backstage musicals.
For example, in The Sound of Music, the song "Edelweiss" is diegetic, since the character (Captain von Trapp) is performing the piece in front of other fictional characters at a gathering. In "Do-Re-Mi" the character Maria is using the song to teach the children how to sing, so this song is also diegetic. In contrast, the song "How Do You Solve A Problem Like Maria?" is non-diegetic, since the musical material is external to the narrative, it being a conversation that would in a naturalistic setting take place as simple speech.
In both the 1936 and the 1951 film versions of Show Boat, as well as in the original stage version, the song "Bill" is diegetic. The character Julie LaVerne sings it during a rehearsal in a nightclub. A solo piano (played onscreen) accompanies her, and the film's offscreen orchestra (presumably not heard by the characters) sneaks in for the second verse of the song. Julie's other song in the film, "Can't Help Lovin' Dat Man", is also diegetic. In the 1936 film, it is supposed to be an old folk song known only to blacks; in the 1951 film, it is merely a song that Julie knows; however, she and the captain's daughter Magnolia are fully aware that Julie is singing. When Julie, Queenie, and the black chorus sing the second chorus of the song in the 1936 version, they are presumably unaware of any orchestral accompaniment, but in the 1951 film, when Magnolia sings and dances this same chorus, she does so to the accompaniment of two deckhands on the boat playing a banjo and a harmonica. Two other songs in the 1936 Show Boat are also diegetic: "Goodbye My Lady Love" (sung by the comic dancers Ellie and Frank), and "After the Ball", sung by Magnolia. Both are interpolated into the film, and both are performed in the same nightclub in which Julie sings Bill.
In the television series Buffy the Vampire Slayer, the episode entitled "Once More, with Feeling" toys with the distinction between diegetic and non-diegetic musical numbers. In this episode, the Buffy characters find themselves compelled to burst into song in the style of a musical. The audience is led to assume that this is a "musical episode", in which the characters are unaware that they are singing. It becomes clear that the characters are all too aware of their musical interludes, and that determining the supernatural causes of the singing is the focus of the episode's story.
- Dillon, Kym (2011-09-18). "The Art of Scoring". IGN. Retrieved 2011-10-01.
- "Gregory Kurczynski on Outsight Radio Hours". Community Audio (Interview). Internet Archive. 22 May 2011. Retrieved 4 February 2017.
- Richards, Mark (21 April 2013). "Diegetic Music, Non-Diegetic Music, and 'Source Scoring'". Film Music Notes. Retrieved 12 January 2019.
- Hagen, Earle (1971). Scoring for Films. New York: E.D.J. Music, Inc. p. 200. ISBN 9780882843872.
- Kassabian, Anahid (2000). Hearing Film: Tracking Identifications in Contemporary Hollywood Film Music. New York: Routledge. pp. 45. ISBN 9780415928540.
- Hahn, Danny (2016). Primeval Cinema – An Audiovisual Philosophy. UK: Zarathustra Books. p. 123. ISBN 9780993338618.
- Hahn, Danny (2016). Primeval Cinema – An Audiovisual Philosophy. UK: Zarathustra Books. pp. 122 and 123. ISBN 9780993338618.
- Black, Anna (2016). ""...for a father hear a child!" Schubert's Ave Maria and the film 2BR02B". The Schubertian. The Schubert Institute (UK). July (91): 16–19.
- Masson, Sophie (19 October 2016). "2BR02B: the journey of a dystopian film–an interview with Leon Coward". Feathers of the Firebird (Interview).