Hacker News new | ask | show | jobs
by svennidal 643 days ago
Nice. Although, it bothers me that the shorter lines are lower pitched than the longer lines. Don’t know why, but intuitively I feel like the pitch should go down as the line gets longer.
3 comments

Fixed

  //const lengthFactor = clamp(lineLength / 200, 0.5, 2); // outdated // Adjust between 0.5x and 2x
  const lengthFactor = clamp(200 / lineLength, 0.5, 2); //Reason: This aligns the instrument with the physical properties of real-world instruments, making it more intuitive and educational.
Wow, much better! Good job!
It probably bothers anyone that has a physics or music background.
I mean, that's how a tuning fork, bell, string, or chime works in the real world. Frequency is inversely proportional to wave length.
Right, which is why longer strings play lower notes.