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

Rendering issues of notes with user-defined lengths #1873

Closed
4 tasks done
theGreatWhiteShark opened this issue Oct 8, 2023 · 3 comments
Closed
4 tasks done

Rendering issues of notes with user-defined lengths #1873

theGreatWhiteShark opened this issue Oct 8, 2023 · 3 comments
Labels

Comments

@theGreatWhiteShark
Copy link
Contributor

theGreatWhiteShark commented Oct 8, 2023

When toying with user-defined note lengths and samples provided in #1852 I came across a couple of rendering issues:

  • Manual tempo changes are not reflected in notes which are currently rendered (e.g. using the BPM widget to increase speed from 60 to 360) (an edge case. I admit it :D )
  • When manually adjusting the length of a note, the note just sounds bad. The waveform is just cut at the end and a click/crack/distortion follows each and every note. Since we already have code for handling ADSR, how about a quick release phase at the end of such notes?
  • When activating filtering (clicking the BYP button in the Instrument Editor), all custom note lengths are discarded and the entire sample is played back. We could of course argue that activating the filtering and setting a non-zero resonance shouldn't be discarded either. But then the original sample should only be played back till the user-defined length and everything that follows is the result of resonance filtering.
  • Creating a note with user defined length and reducing the length of the pattern to be smaller than the length of the note -> note will ring beyond end of the pattern.
@cme
Copy link
Contributor

cme commented Oct 9, 2023

Agree with this reasoning ADSR: changing the length of the note should effectively move the Release point, and also filtering.

I guess I would recommend that before doing anything much else in renderNote*, it would probably be wise to just entirely remove renderNoteNoResample to avoid duplication of effort. It's slower than the NoResample variant, but not that much slower. Optimisation without duplication can be a later activity (which I plan to do!)

@theGreatWhiteShark
Copy link
Contributor Author

I guess I would recommend that before doing anything much else in renderNote*, it would probably be wise to just entirely remove renderNoteNoResample to avoid duplication of effort.

Any volunteer? 😄 But you are right, of course. Just hoped I could implement the drumkit map stuff without large detours. But sample rendering is too important to postpone it till 1.3.0.

I would start by checking/adding some unit tests. They should step on our toes if just a single frame of rendered audio is different. So we can at least check for unintended side effects while refactoring.

@theGreatWhiteShark
Copy link
Contributor Author

There is another issue with the notes having custom lengths:

Defining a length

long

and shrinking the pattern so it ends prior to the note

short

leaves the note length unaffected. It will ring on.

I think it would feel more natural if the custom note length is truncated at the end of the pattern.

theGreatWhiteShark added a commit to theGreatWhiteShark/hydrogen that referenced this issue Oct 18, 2023
- `Note::SelectedLayerInfo` was refactored to comply with your naming conventions
- `Note::SelectedLayerInfo::nNoteLength` was introduced to store the length of a note once it is first rendered in the `Sampler`. Doing it at each rendering cycles causes issues on manual tempo changes.
- `Sampler::handleTimelineOrTempoChange` does now also scale the part of a note/sample still left for rendering in case rendering already has begun. This is important in case of manual tempo changes for notes with user defined length.

Addresses hydrogen-music#1873
theGreatWhiteShark added a commit to theGreatWhiteShark/hydrogen that referenced this issue Oct 18, 2023
in case a custom note length was defined and the pattern length was reduced afterwards it is now ensured that the custom length is truncated at the end of the pattern. Else, the note could ring beyond what is visually indicated to be its end.

Addresses hydrogen-music#1873
theGreatWhiteShark added a commit to theGreatWhiteShark/hydrogen that referenced this issue Oct 19, 2023
custom note lengths are used to trigger the release of a note and the `Sampler` will play them back till the additional release frames are rendered. Previously, the custom length was used to stop audio rendering of a note creating a pronounced artifact.

From the looks of the code it is very likely that this worked for a long time but was broken just recently. Well, happens. But should not happen again as custom note lengths are now covered by the unit tests and even a tiny tweak on the release knob for the test song should make them fail.

Addresses hydrogen-music#1873
theGreatWhiteShark added a commit to theGreatWhiteShark/hydrogen that referenced this issue Oct 25, 2023
custom note lengths are used to trigger the release of a note and the `Sampler` will play them back till the additional release frames are rendered. Previously, the custom length was used to stop audio rendering of a note creating a pronounced artifact.

From the looks of the code it is very likely that this worked for a long time but was broken just recently. Well, happens. But should not happen again as custom note lengths are now covered by the unit tests and even a tiny tweak on the release knob for the test song should make them fail.

Addresses hydrogen-music#1873
theGreatWhiteShark added a commit to theGreatWhiteShark/hydrogen that referenced this issue Oct 29, 2023
- `Note::SelectedLayerInfo` was refactored to comply with your naming conventions
- `Note::SelectedLayerInfo::nNoteLength` was introduced to store the length of a note once it is first rendered in the `Sampler`. Doing it at each rendering cycles causes issues on manual tempo changes.
- `Sampler::handleTimelineOrTempoChange` does now also scale the part of a note/sample still left for rendering in case rendering already has begun. This is important in case of manual tempo changes for notes with user defined length.

Addresses hydrogen-music#1873
theGreatWhiteShark added a commit to theGreatWhiteShark/hydrogen that referenced this issue Oct 29, 2023
in case a custom note length was defined and the pattern length was reduced afterwards it is now ensured that the custom length is truncated at the end of the pattern. Else, the note could ring beyond what is visually indicated to be its end.

Addresses hydrogen-music#1873
theGreatWhiteShark added a commit to theGreatWhiteShark/hydrogen that referenced this issue Oct 29, 2023
custom note lengths are used to trigger the release of a note and the `Sampler` will play them back till the additional release frames are rendered. Previously, the custom length was used to stop audio rendering of a note creating a pronounced artifact.

From the looks of the code it is very likely that this worked for a long time but was broken just recently. Well, happens. But should not happen again as custom note lengths are now covered by the unit tests and even a tiny tweak on the release knob for the test song should make them fail.

Addresses hydrogen-music#1873
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants