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

more detailed information about "duration" #4

Closed
Schran4er opened this issue May 19, 2023 · 4 comments
Closed

more detailed information about "duration" #4

Schran4er opened this issue May 19, 2023 · 4 comments

Comments

@Schran4er
Copy link

Thank you for your work.

Do you mind helping me out with a little bit more information about the "mean_duration" parameter for the expert description?
The only detailed information about duration that I can find in the paper is: "Mean duration is quantized to 32 logarithmically spaced intervals in [0, 128] positions (12 positions per quarter note)."
If I understand this correctly, this would imply that a duration value of 1 is equal to a note being played for 1/12 quarter notes, whereas a duration value of 32 would mean that it is played for 128/12 quarter notes. However, looking at the generated results from the example descriptions, this doesn't seem to be the case.

Kind regards, and thank you in advance!

@dvruette
Copy link
Owner

Absolutely! Here we're talking about the mean duration, which is computed as follows (in pseudocode):

# 1 position == 1/12 quarter note
mesh = np.logspace(0, 7, 32+1, base=2) # log space between 1 and 128 positions (~2.5 bars)

mean_durations = []
for bar in bars:
  mean_duration = mean(duration_in_positions(note)) for note in bar.notes)
  mean_duration = quantize_to_mesh(mean_duration, mesh)
  mean_durations.append(mean_duration)

Note that the mean duration is only used for the description and does not correspond 1:1 with the duration indices for notes. In case you're referring to note durations: In the REMI+ representation, note durations are actually quantized to a different mesh, which is chosen in a way to have a high resolution for shorter notes and a lower resolution for longer notes (see constants.py for the exact mesh).

I hope this helps, lmk if you still have questions.

@Schran4er
Copy link
Author

Thank you very much for the quick response, this already helps me a lot!

Now, just out of curiousity, if "mean duration does not correspond 1:1 with the duration indices for notes": how does it correspond then? Or are you referring to the quantization to the different mesh in REMI+?

@dvruette
Copy link
Owner

Yes, exactly, I’m referring to the fact that a different mesh is used for quantizing mean durations vs. note durations. To get actual durations from REMI+/description tokens, you’d have to first de-quantize them by indexing the respective mesh.

@Schran4er
Copy link
Author

Alright, thx again! I'll let you know if I have any more questions.

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

2 participants