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

MIDI velocity normalization in midi2list #13

Closed
fabianostermann opened this issue Sep 6, 2023 · 3 comments
Closed

MIDI velocity normalization in midi2list #13

fabianostermann opened this issue Sep 6, 2023 · 3 comments

Comments

@fabianostermann
Copy link

Hey there!

I just stumbled over following line from c1/c1s2_symbolic_rep.py, where midi velocity in bytes is normalized to $[0,1]$:

velocity = note.velocity / 128.

Shouldn't it be vel/127.0, because midi velocity is in $[0,127]$, so that 0 maps to 0 and 127 maps to 1.0?

Quick link to the line of code I am referring to:
https://github.com/meinardmueller/libfmp/blob/424127f2cd8317f796ab1591f7c0ec408208e782/libfmp/c1/c1s2_symbolic_rep.py#L70C44-L70C44

Just let me know if I'm thinking wrong or why 128 may be the better choice here! :-)
Anyway, thank you very much for your great work in providing all these reference implementations!!!! 🎉

@meinardmueller
Copy link
Owner

Dear Fabian,
Good observation. Dividing by 128 indeed yields values between 0 and 127/128. Besides looking more natural than dividing by 127, there is no deeper reason. So, you are right!

  • Meinard

@fabianostermann
Copy link
Author

Ok, thanks for your clarification :-)
However, when I'm thinking further about it, this minor issue shouldn't yield severe problems when using the /128 version for any experimental data and tasks.
Thx!

@fzalkow
Copy link
Collaborator

fzalkow commented Sep 11, 2023

Thanks for catching this! I fixed it in this commit: 4e8c78d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants