Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

midiratio could be more precise #5016

Open
elgiano opened this issue Jun 14, 2020 · 2 comments
Open

midiratio could be more precise #5016

elgiano opened this issue Jun 14, 2020 · 2 comments
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. not a big issue

Comments

@elgiano
Copy link
Contributor

elgiano commented Jun 14, 2020

Not a big issue but sometimes annoying, especially in obvious cases:

12.midiratio // -> 1.9999999999945
2.pow(12/12) // -> 2.0 

When I think about Henry Partch (roughly) saying that equal temperament is a lie compared to just intonation, this gets particularly annoying :)

Looking at the source code, it seems like midicps/cpsmidi use more precise constants than midiratio/cpsoct... anyone know if this is a bug or intended for some reason I can't understand?

return (float64)440. * std::pow((float64)2., (note - (float64)69.) * (float64)0.08333333333333333333333333);

inline float64 sc_midiratio(float64 midi) { return std::pow((float64)2., midi * (float64)0.083333333333); }

Environment

  • SuperCollider version: 3.11.1
  • Operating system: Arch Linux

Steps to reproduce

12.midiratio // -> 1.9999999999945
2.pow(12/12) // -> 2.0 

Expected vs. actual behavior

I would expect 12.midiratio to be exactly 2.0

@elgiano elgiano added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. not a big issue labels Jun 14, 2020
@mossheim
Copy link
Contributor

this looks like a bug to me! possibly just missed in 4249e321. that other code is from the initial commit.

however, this stuff is in the public plugin interface (include/plugin_interface), which means we need to be a bit careful about how to fix things there...

@simonperrier11
Copy link

Just came across the same issue in 3.13.0, macOS 13.5.2

@dyfer dyfer mentioned this issue Oct 3, 2023
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. not a big issue
Projects
None yet
Development

No branches or pull requests

3 participants