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

Key on/off time estimator #29

Open
jpcima opened this issue Apr 30, 2018 · 3 comments
Open

Key on/off time estimator #29

jpcima opened this issue Apr 30, 2018 · 3 comments
Assignees

Comments

@jpcima
Copy link
Collaborator

jpcima commented Apr 30, 2018

I started an experimental branch to make an estimation of envelope times and compare with real times.
It's unclean code but here for experiment purposes. link.

This estimate method is more oriented towards precision than performance.
There is some difficulty in finding an exact result, but I have expectation for error to be in the magnitude of milliseconds.

I have some questions, probably stupid

  1. how to launch delay measurements? "Recalculate all sounding delays" seems not to do anything
  2. when I launch the emulator benchmark I have very significant variations of results. what to do about this?
Attack time (ms) 3313 real, 3333 estimate
Attack time (ms) 4540 real, 3333 estimate
Attack time (ms) 0 real, 3333 estimate
  1. do instruments have a definition of the field NTS/Note-Sel (from OPL3 register 08)? do I set 0 for NTS?
@Wohlstand
Copy link
Owner

Wohlstand commented Apr 30, 2018

Recalculate all sounding delays

It does calculation of non-empty voices. And when voices are presented, it works very long if it uses Nuked (it is used by default). Empty non-sounding voices are skipping to don't waste time on them.

Also, I have made the thing to detect 5 seconds of silence and then break the scan. That usually happens when no sound was produced.

when I launch the emulator benchmark I have very significant variations of results. what to do about this?

That because of error which is caused by capturing of data from the generated wave analysis and it's not accurate as you see.

do instruments have a definition of the field NTS/Note-Sel (from OPL3 register 08)? do I set 0 for NTS?

I think, it's just unused as I see...

@jpcima
Copy link
Collaborator Author

jpcima commented Apr 30, 2018

I have just continued progress on this, and now I also have the model for the release phase.
This part of implementation will be easier but must take into account the starting level defined by the sustain parameter.

For a validation basis, it would be great if I can run it over all instruments, and instruct it to compare the normal measurement vs estimate.

I think, it's just unused as I see...

NTS has impact on computing the effective envelope rate. I think it controls how note frequency affects the scaling. I think, as I just copied the computation out of Nuked code.

release

EDIT this is envelope rate computation according to NTS:

    unsigned effective_rate = 4 * rate;
    if (!ksr)
        effective_rate += block >> 1;
    else
        effective_rate += (block << 1) | ((fnum >> (9 - nts)) & 1);

@jpcima
Copy link
Collaborator Author

jpcima commented May 1, 2018

I have made a quick and dirty write-up to explain math in the time estimation code, since it's not really obvious to understand at the first look. For reference here it is.
https://github.com/jpcima/opl3-time-measurement/blob/master/docs/master.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Maybe later
Development

No branches or pull requests

2 participants