To calculate this, we first have to define exactly what a melody is. And we go off the rails immediately.
Michael Seifert calculated the number of unique 4/4 measures of music consisting of 16th notes and notes constrained to a single octave. But that's not every melody. The calculation does not count measures that use triplets or other tuplet rhythms, are written in time signatures other than 4/4, span more than an octave, have rests, or even use quarter notes or any rhythms at all besides 16th notes! If we add all these elements into the mix, we can recalculate how many unique measures are possible. But that still isn't the number of melodies possible.
Melodies can last more than one measure, so now you need to consider what happens if you combine our unique measures together. Be sure not to forget that melodies can start or end partway through a measure, and also that notes can start on one measure and end on the next! But that gives us all the different combinations of notes possible while ignoring how they're played. Elements like dynamics, articulation, and phrasing play an enormous role in giving melodies their character, such that two melodies with the exact same notes but performed differently can sound very different from each other. You hear this all the time: Think about a super hero movie that uses a quiet version of the main theme when it looks like all is lost.
But that still isn't what a melody is. The same melody played by two different instruments can sound very different. There same melody played at a different tempo can mean something else entirely. And then you get into philosophical ideas about whether a melody can be separated from its harmony. There are cases where the exact same recording of the same melody hits totally different depending on the chord progression it's sitting on top of.
Don't forget about microtonality and alternative tuning systems! And then you have pieces like Threnody for the Victims of Hiroshima, a truly bone-chilling orchestral piece that uses totally unhinged wailing strings to paint the horrors of the nuclear bomb in a way that cannot begin to be described with traditional notes or rhythms. The score is a sea of wavy lines and curves instructing players how to create their textures without tying them down to tonality.
At this point, we should just give up counting notes. Let's just go the whole way and say that every single unique sound wave is a different melody. How do you even begin to count those -
Aha! We can count the number of unique audio files we can generate! Strictly speaking, it's impossible to perfectly capture every single possible unique sound wave using digital technology, but the differences are so incredibly subtle that it is utterly beyond human ability to tell the difference. And counting unique sound files is easy. Let's say we want to count every single WAV file 1 gigabyte or smaller in size as a unique melody. Each byte in a WAV file is a number from 0 to 255, and there are one billion bytes in a gigabyte. Including all the WAV files smaller than 1GB, there are 2*(256^1000000000)-1 different possible melodies. It's an incomprehensibly big number, but we did it.
Except we didn't. The same WAV file played out of two different speakers will sound different - sometimes dramatically so. And then there are the different types of speakers. You have stereo speakers, mono speakers like built into a phone, headphones (which have significantly different psychoacoustic effects than speakers that aren't clamped on your ears) - and there are massive PA systems used in stadiums and concert halls, enormous surround sound systems used in movie theaters, speakers in stores playing background music...
You could argue that all of these are really the same melody. But it's not just a theoretical idea, there are pieces of music that pointedly use unique sound setups as a core part of their identity. In high school band, we played some pieces with randomized elements where we got off the stage, spread ourselves around the audience, and then played luxurious walls of sound, bathing the audience in rich acoustics from all directions. Stage musicals will sometime have singers walk around the audience, giving a sense of intimacy that isn't possible on stage - or with two speakers. Pushing this kind of idea especially far, the VR game Rez Infinite procedurally generates its music directly in response to the player and enemies' actions. Using VR, this is in surround sound, with the direction notes come from being used as an ever-changing cue of where the player needs to be paying attention. The soundtrack album doesn't even include the final boss music, which is so completely generated on the fly that rendering a single canonical version of the music isn't possible. For all these pieces of music, the way they are heard is an integral part of what defines their melodies. A recording of the same piece played out of stereo speakers is fundamentally an incomplete facsimile of the original musical statement.
The lesson behind all of this is, as long as people are making music, they will always be pushing the boundaries of what music is. If the same twelve notes get old, we'll play with microtonality and alternate tunings and noisescapes. If 4/4 rhythms get old, we'll play with tuplet rhythms and unusual time signatures. If listening to music with our two ears gets old, we'll invent whole new ways of transmitting musical sounds, like VR and IMAX surround sound, that reconextualize what the most basic ideas of space mean in music. And when we've exhausted all of those possibilities, our descendents will discover and explore new boundaries in music.
I am optimistic that we will never run out of fresh musical ideas, even if the ideas we can conceptualize now are, strictly speaking, finite. Music, as with any art form, is a malleable thing with no concrete definition. When we've run out of space to explore the ideas we're aware of now, new ideas to challenge will come into view.