There are notes that go well together, and notes that don't.
Notes whose frequencies are a simple integer ratio go well together, such as: 1:1 (unison), 1:2 (octave), 2:3 (perfect fifth).
Notes whose frequencies don't have a nice relationship sound dissonant, such as 220:233.08.
Copy the following into a test.html file and try it with your browser.
What's not correct is your assumption of how a piano works. A piano does not produce pure sine waves, which is what you are attempting to do.
The majority of piano notes are generated by felt hammers hitting multiple detuned wound metal strings. (Note that a correctly tuned piano will have each of the three strings at a different pitch. The centre string ...