Every time I see this I strongly disagree with @prokopetz’s claim that the main, intentional gag is that the language tutor can’t hear the music—the joke is that this is simply what it’s like to have a best friend with a joke to share. Cosmo and Don could speak this number and it would have the same intent in the story—it wouldn’t be as incredible or clear, but it would still convey that Cosmo and Don have a tremendous amount of love and fun between them.
Singin’ in the Rain uses its musical numbers one of two ways: they are either songs performed in-universe as real musical numbers by or for Monumental Pictures, or they are used as extra-universe expressions of fondness between characters. Lena doesn’t have a big villain number. RF never sings about the weight of running a Hollywood studio. Songs—outside the ones everyone in-universe knows are being sung—are a secret language between Don, Cosmo, and Kathy. It’s a subtle meta structure that boosts the narrative impact of Don, Cosmo, and Kathy as people who genuinely like each other and connect in a way outside studio system politics. Look at the purely intimate songs that aren’t staged as studio numbers:
Make ‘Em Laugh—Cosmo is connecting with Don, trying to cheer him up
You Were Meant For Me—Don is connecting with Kathy, beginning their romance
Moses Supposes—Don and Cosmo are connecting as friends by making fun of the same thing
Good Morning—Don, Cosmo, and Kathy are connecting as friends who just shared an all-nighter and came up with a new idea
Singin’ in the Rain—Don is singing because of his connection with Kathy, having just shared a kiss with her
It’s also important to note that some songs transition from in-universe studio numbers to more personal songs—All I Do Is Dream of You is seen by everyone at the house party as a planned musical number, but for Don it’s the first time he really sees Kathy past their spat in the car. Would You is in-universe a song from The Dancing Cavalier, but it transforms into a personal connection song as Don sings it to Kathy at the premiere.
I’m bringing all this up because this is an exceptional way to use musical structure. It’s de rigueur to insist that every musical song further the story, but that’s typically taken to mean that the songs contribute to the plot. Singin’ in the Rain doesn’t do that. Instead, it uses its musical numbers —where it places them, who sings them, who “sees” them—to convey the emotional story, to subtly clue you in on who in this story really matters, who is really connected and really loving each other. It matters that the Hollywood studios are shifting from a silent system to a musical system that Cosmo, Don, and Kathy already naturally speak with, and it matters that these three are, or become, so comfortable with this change that it saves them. They are the only people in this story who shift easily between numbers planned for them by the studio and singing straight out of nowhere. Their songs are their way of sharing something with each other, to the point that the songs and their love for each other merge into the same thing—which is why it feels so right when singing (connecting) becomes the norm for Hollywood by the end of the movie.
Singin’ in the Rain is often thought of as the best musical ever made, and it’s not because the songs are throwaway gags—if that were true, it would be like every other songbook musical that commits to a joke for one song and then forgets it. The songs in Singin’ in the Rain reinforce the strength and love shared between our main three heroes, and constantly recontextualize what it means to shift from one worldview—the artificial lie of the silent movies and singing for other people—to a new one, where conveying love for another person is seen and heard by everyone. I said earlier the songs are about showing fondness, or connection—which is true—but if I’m being honest, I think Singin’ in the Rain is really about sharing joy with another person. It’s about the joy of being with someone you love.