Hacker News new | past | comments | ask | show | jobs | submit login

I wish I had a better ear and could tell you what sounds funny to me about the piano at the top. Can anyone explain why it sounds off to me?



Taking a guess at what you're noticing but might not have a framework/vocabulary for...

It sounds like FM synthesis[0] to me (so either an embedded FM software synthesizer or simply replaying samples of FM synthesis), so the timbre is quite unlike a "real" piano or PCM samples of a real piano. Timbre is a kind of "color" of "quality" of a sound - in my head it's similar to how different materials feel different to the touch. A violin and a trumpet can play the same "note" but their sounds have very different timbres. An apple and a ball might both appear red but have different surface textures.

The "piano" in the app sounds like the piano patches (presets) on FM-based synthesizers from the 1980s[1], where the designers tried to approximate the timbre of a piano using the limited (but fun!) possibilities of FM, while the transients and harmonics produced by a real acoustic piano are more complex.

The pitches and temperament sound OK to me, so I think what you are are hearing is the timbre. That is, the app is playing the "right" notes, but it's as if you're hearing a "different instrument", albeit one that is an early digital approximation of a piano sound.

[0] https://en.wikipedia.org/wiki/Frequency_modulation_synthesis

[1] e.g. the Yamaha DX7; here's one of its "piano" sounds for comparison: https://www.youtube.com/watch?v=F3rrjQtQe5A&t=214s


Mixing sharps and flats? I chose c as root and db (d flat) is in the image...but so is f# (f sharp).

I have no problems explaining ie fb (f flat) or e# (e sharp) etc, in certain circumstances, but I'm a great believer in: don't mix the two (sharps and flats).


I think it is more a pitch thing. Playing the scale up from C, the F sounds off. Not sure why. My first guess was it was a sample just playing at different speeds and that was causing some issues.


You have a better ear than you think! I tried it again (and actually tried all the notes this time...) and the F is definitely flat. It's particularly noticeable in the 5th octave (i.e. if you play C5 D5 E5 F5), but all the F's appear to have the issue. I verified (by ear) against Pianoteq set to equal temperament.

The other notes sound OK. The A and B might be a tiny bit flat too but my ear isn't good enough, and if they're flat they're nowhere near as far off as the F. OP, how are you specifying notes/pitches to the synthesizer?


I implemented the synthesizer from scratch. Honestly I'm not super familair with digital synthesizer theory and for the implementation, mostly I referred to this article https://keithwhor.com/music/

The code of my implementation is at https://github.com/JNKKKK/pianochord.io/blob/master/src/libs...

I guess it't not a good choice to implement that part on my own, since there are many good libraries out there, like tone.js. I will probably deprecate my own synthesizer implementation and use tone.js.


Your F, defined on line 26 [0], is 3Hz off according to this reference table[1]. 346.23 should be 349.23. Just a typo?

All credit to @issa's ear. And yes, while you'd be unlikely to have encountered this bug if you were just telling a good existing synth to play an F, it's cool that you implemented the synth from scratch! Whether it's a good choice depends on the project goals.

[0] https://github.com/JNKKKK/pianochord.io/blob/master/src/libs...

[1] https://pages.mtu.edu/~suits/notefreqs.html


Ah! Nice catch!! I didn't even notice that. My expectation for this project is focusing mainly on the music theory part and visualization. So I guess using a good existing synth will make my life eaiser.

Thanks again!


ha. Full disclosure, I spent a decade as a professional musician and another decade as an audio engineer at a recording studio. I've just always had terrible pitch. Grew up completely tone deaf, but managed to train myself to hear notes eventually over the years. These days I'm very out of practice, but I could tell SOMETHING sounded funny. In case this didn't come through, the site is amazing!




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: