Beethoven was not born deaf, but deaf wounded later causing him to learn before then.
As for his ability to compose melodies who is deaf, has been followed by a special method. He has Beethoven piano detects vibrations through his legs and sit on the floor sometimes to feel the music and the sense of hearing to compensate.