There is an explanation about why you can't really say what octave the melody is in.
You can list the key of a song in most cases, like
But when it comes to the melody your are dealing with a range. For example, the melody could have a highest note of
F5 and lowest note of
F4, sort of moving around
C5 in the middle. Such a melody is spanning two octaves.
The numbering of octaves starts on the
Actually you can't have any melody ranging one octave or greater fitting within a single octave.
You could have a song with a relatively small range sort of centered in the middle of
A4 with a few notes a step or two above/below, and then you could say the melody is in octave 4. But you wouldn't be able to classify all melodies in a consistent way like that.
So, you can give bpm and key as single values for a song, but the melody needs to be a range - two values.
You could get melody ranges from song books, but often those arrangements are not in the key of the recorded song. You probably are stuck with doing it by ear from recordings.
You probably should also look at standard vocal ranges https://en.wikipedia.org/wiki/Vocal_range and keep those in mind when writing a song.