Skip to content

Commit

Permalink
Add ability to trim audio clips from start position (#3291)
Browse files Browse the repository at this point in the history
* Initial stab at trimming the start of audio

* Refactor audio clip view for improved marker handling and rendering

- Adjusted visibility logic for start and end markers to enhance user interaction.
- Updated rendering logic to differentiate between blinking and static marker states.
- Improved comments for clarity and maintenance.
- Implemented non-destructive start trimming functionality, allowing for better audio editing.
- Fixed minor issues related to marker toggling and display updates.

This commit builds upon the initial implementation of start trimming and enhances the overall user experience in the audio clip view.

* - Implemented non-destructive trimming functionality for start markers, allowing for more flexible audio editing.
- Fixed issues related to marker toggling.

TODO - Currently trimming from the start results in the prior audio becoming hidden and the new play head moves to column one. Should change this so the new playhead does not move and the hidden audio is greyed out.

* Button handling

* Restore button actions

* Put audio trim from start behind a feature flag

* Build tidy.

* improve audio clip marker handling

* Cleaned up formatting in settings.cpp and audio_clip_view.h

* Use predefined color constants.

* refactor: standardize AudioClip reference handling in audio_clip_view.cpp

* Refactor coloring code

* Add assignment operator to RGB class in rgb.h

* Refactor LED colour handling in waveform and pad LED rendering following recommended changes in audio_clip_view.

#3291 (comment)

* Formatting fixes.

* Update settings.cpp

* minor formatting fix

* Update toolchain to v22 (#3307)

Should reduce the Docker image size, and fixes formatting on OSX/Linux

* fix(audio): improve audio clip view null checks and recording state

- Add null checks for audio clip pointer
- Reinstated linear recording checks
- Clean up comments

* fix: restore macro handling in audio clip view

Restore macro activation functionality when clicking side column while holding
song button. This was accidentally removed during audio clip trimming changes.

* refactor(audio-clip): improve sample length handling restore comments

* refactor(audio-clip): improve sample length handling restore comments

* docs(rgb): improve assignment operator documentation

* feat(audio): add trim from start of audio clip feature documentation

Adds new feature setting to enable trimming from start of audio clips

* Update community features docs on start trimming

* Add reference to PR for start trimming

* Update community features docs on start trimming (2)

* Update community features docs on strart trimming

* Fix conflict

---------

Co-authored-by: Sapphire Koser <[email protected]>
Co-authored-by: Sean Ditny <[email protected]>
  • Loading branch information
3 people authored Feb 1, 2025
1 parent 76d14f4 commit 93333f1
Show file tree
Hide file tree
Showing 17 changed files with 300 additions and 208 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ set the stutter configuration independently of the song configuration if you wis
#### <ins>Audio Clips</ins>
- Added audio output modes, and changed audio clip monitoring to be seperate from source selection. Monitoring is now on
when the output is a SAMPLER or a LOOPER, chosen by turning the select knob in an audio clip.
- Added the ability to trim from the start of an audio clip without reversing it (enable in Community Features menu).

#### <ins>Instrument Clip View</ins>

Expand Down
16 changes: 16 additions & 0 deletions docs/community_features.md
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,18 @@ for the Lumi Keys Studio Edition, described below.
- While Lumi has limited options for MPE separation, it will be configured to align with the dominant MPE range
defined on the Deluge (upper or lower dominant).

### 4.11.0 - Audio Clip View - Trimming Clips

- ([#3291]) Added a new `STRING_FOR_COMMUNITY_FEATURE_TRIM_FROM_START_OF_AUDIO_CLIP` feature to allow users to trim from the start of a clip without needing to reverse it.
- Pressing a pad in the first column of an audio clip now makes it flash green allowing you to move the start position. The new start position snaps to column one.
- You can revert to an earlier portion by pressing undo (or reverse the clip and altering as before).
- This lets you easily alter the start of an audio clip without time stretching.
- Previously, this was only possible by reversing the audio clip and trimming the start as if it were the end.
- This feature is `OFF` by default and can be set to `ON` or `OFF` via `SETTINGS > COMMUNITY FEATURES`.

See this demo for more details:
[Audio Clip View - Trimming Tips](https://www.youtube.com/watch?v=iWhVUsx40Mg&t=45s&ab_channel=RonCavagnaro).

## 5. Community Features Menu (aka Runtime Settings)

In the main menu of the Deluge (accessed by pressing both "SHIFT" + the "SELECT" encoder) there is
Expand Down Expand Up @@ -1240,6 +1252,8 @@ Note: these settings are saved to `SETTINGS/CommunityFeatures.XML` on your SD ca
* When On, the number of `TAP TEMPO` button presses to engage `TAP TEMPO` is changed to `FOUR (4)` to avoid mistakingly changing tempo.
* `Horizontal menus (HORI)`
* When On, some menu items render in horizontal menus, with multiple items visible and editable at the same time.
* `Trim from start of audio clips (TRIM)`
* When On, the ability to trim from the start of an audio clip without needing to reverse it is enabled.

## 6. Sysex Handling

Expand Down Expand Up @@ -1576,6 +1590,8 @@ different firmware

[#3285]: https://github.com/SynthstromAudible/DelugeFirmware/pull/3285

[#3291]: https://github.com/SynthstromAudible/DelugeFirmware/pull/3291

[Automation View Documentation]: features/automation_view.md

[Arpeggiator Documentation]: features/arpeggiator.md
Expand Down
13 changes: 8 additions & 5 deletions docs/menu_hierarchies.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ NOTE: These options can change depending on how your default resolution is set
- Grid View Loop Pads (LOOP)
- OFF
- ON
- Trim from start of audio clips (TRIM)
- OFF
- ON
</details>

Firmware Version (FIRM)
Expand Down Expand Up @@ -548,7 +551,7 @@ The Song menu contains the following menu hierarchy:
- Pan
- Reverb Sidechain (SIDE)
- Volume Ducking (VOLU)

- Stutter (STUT)
- Quantize (QTZ)
- Reverse (REVE)
Expand Down Expand Up @@ -843,7 +846,7 @@ The Sound menu contains the following menu hierarchy:
- Pan
- Reverb Sidechain (SIDE)
- Volume Ducking (VOLU)

- Stutter (STUT)
- Use Song Settings (SONG)
- Quantize (QTZ)
Expand Down Expand Up @@ -1228,7 +1231,7 @@ The Kit FX menu contains the following menu hierarchy:
- Pan
- Reverb Sidechain (SIDE)
- Volume Ducking (VOLU)

- Stutter (STUT)
- Use Song Settings (SONG)
- Quantize (QTZ)
Expand Down Expand Up @@ -1430,7 +1433,7 @@ The CV menu contains the following menu hierarchy:
- Gate
- Sync
NOTE: These options can change depending on how your default resolution is set

- Off
- 2-Bar
- 1-Bar
Expand Down Expand Up @@ -1804,7 +1807,7 @@ The Audio Clip menu contains the following menu hierarchy:
- Pan
- Reverb Sidechain (SIDE)
- Volume Ducking (VOLU)

- Stutter (STUT)
- Use Song Settings (SONG)
- Quantize (QTZ)
Expand Down
8 changes: 8 additions & 0 deletions src/deluge/gui/colour/rgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ class RGB {
/// Blue channel
channel_type b = 0;

/// Copies RGB values from a colour
constexpr RGB& operator=(const RGB& other) {
r = other.r;
g = other.g;
b = other.b;
return *this;
}

/**
* @brief Construct a monochrome (white) shade
*
Expand Down
1 change: 1 addition & 0 deletions src/deluge/gui/l10n/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@
"STRING_FOR_COMMUNITY_FEATURE_GRID_VIEW_LOOP_PADS": "Grid View Loop Layer Pads",
"STRING_FOR_COMMUNITY_FEATURE_ALTERNATIVE_TAP_TEMPO_BEHAVIOUR": "Alternative Tap Tempo Behaviour",
"STRING_FOR_COMMUNITY_FEATURE_HORIZONTAL_MENUS": "Horizontal menus",
"STRING_FOR_COMMUNITY_FEATURE_TRIM_FROM_START_OF_AUDIO_CLIP": "Trim from start of audio clips",

"STRING_FOR_TRACK_STILL_HAS_CLIPS_IN_SESSION": "Track still has clips in session",
"STRING_FOR_DELETE_ALL_TRACKS_CLIPS_FIRST": "Delete all track's clips first",
Expand Down
1 change: 1 addition & 0 deletions src/deluge/gui/l10n/g_english.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ PLACE_SDRAM_DATA Language english{
{STRING_FOR_COMMUNITY_FEATURE_GRID_VIEW_LOOP_PADS, "Grid View Loop Layer Pads"},
{STRING_FOR_COMMUNITY_FEATURE_ALTERNATIVE_TAP_TEMPO_BEHAVIOUR, "Alternative Tap Tempo Behaviour"},
{STRING_FOR_COMMUNITY_FEATURE_HORIZONTAL_MENUS, "Horizontal menus"},
{STRING_FOR_COMMUNITY_FEATURE_TRIM_FROM_START_OF_AUDIO_CLIP, "Trim from start of audio clips"},
{STRING_FOR_TRACK_STILL_HAS_CLIPS_IN_SESSION, "Track still has clips in session"},
{STRING_FOR_DELETE_ALL_TRACKS_CLIPS_FIRST, "Delete all track's clips first"},
{STRING_FOR_CANT_DELETE_FINAL_CLIP, "Can't delete final Clip"},
Expand Down
1 change: 1 addition & 0 deletions src/deluge/gui/l10n/g_seven_segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ PLACE_SDRAM_DATA Language seven_segment{
{STRING_FOR_COMMUNITY_FEATURE_ALTERNATIVE_PLAYBACK_START_BEHAVIOUR, "STAR"},
{STRING_FOR_COMMUNITY_FEATURE_GRID_VIEW_LOOP_PADS, "LOOP"},
{STRING_FOR_COMMUNITY_FEATURE_ALTERNATIVE_TAP_TEMPO_BEHAVIOUR, "TAPT"},
{STRING_FOR_COMMUNITY_FEATURE_TRIM_FROM_START_OF_AUDIO_CLIP, "TRIM"},
{STRING_FOR_TRACK_STILL_HAS_CLIPS_IN_SESSION, "CANT"},
{STRING_FOR_DELETE_ALL_TRACKS_CLIPS_FIRST, "CANT"},
{STRING_FOR_CANT_DELETE_FINAL_CLIP, "CANT"},
Expand Down
2 changes: 1 addition & 1 deletion src/deluge/gui/l10n/seven_segment.json
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@
"STRING_FOR_COMMUNITY_FEATURE_ALTERNATIVE_PLAYBACK_START_BEHAVIOUR": "STAR",
"STRING_FOR_COMMUNITY_FEATURE_GRID_VIEW_LOOP_PADS": "LOOP",
"STRING_FOR_COMMUNITY_FEATURE_ALTERNATIVE_TAP_TEMPO_BEHAVIOUR": "TAPT",
"STRING_FOR_COMMUNITY_FEATURE_TRIM_FROM_START_OF_AUDIO_CLIP": "TRIM",

"STRING_FOR_TRACK_STILL_HAS_CLIPS_IN_SESSION": "CANT",
"STRING_FOR_DELETE_ALL_TRACKS_CLIPS_FIRST": "CANT",
Expand Down Expand Up @@ -450,7 +451,6 @@
"STRING_FOR_WRONG_SIZE": "SIZE FAIL",
"STRING_FOR_BAD_KEY": "KEY FAIL",

"STRING_FOR_CLIP_CLEARED": "CLEAR",
"STRING_FOR_SAMPLE_CLEARED": "CLEAR",
"STRING_FOR_NOTES_CLEARED": "CLEAR",
"STRING_FOR_AUTOMATION_CLEARED": "CLEAR",
Expand Down
1 change: 1 addition & 0 deletions src/deluge/gui/l10n/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ enum class String : size_t {
STRING_FOR_COMMUNITY_FEATURE_GRID_VIEW_LOOP_PADS,
STRING_FOR_COMMUNITY_FEATURE_ALTERNATIVE_TAP_TEMPO_BEHAVIOUR,
STRING_FOR_COMMUNITY_FEATURE_HORIZONTAL_MENUS,
STRING_FOR_COMMUNITY_FEATURE_TRIM_FROM_START_OF_AUDIO_CLIP,

STRING_FOR_TRACK_STILL_HAS_CLIPS_IN_SESSION,
STRING_FOR_DELETE_ALL_TRACKS_CLIPS_FIRST,
Expand Down
4 changes: 3 additions & 1 deletion src/deluge/gui/menu_item/runtime_feature/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ SettingToggle menuAlternativePlaybackStartBehaviour(RuntimeFeatureSettingType::A
SettingToggle menuEnableGridViewLoopPads(RuntimeFeatureSettingType::EnableGridViewLoopPads);
SettingToggle menuAlternativeTapTempoBehaviour(RuntimeFeatureSettingType::AlternativeTapTempoBehaviour);
SettingToggle menuHorizontalMenus(RuntimeFeatureSettingType::HorizontalMenus);
SettingToggle menuTrimFromStartOfAudioClip(RuntimeFeatureSettingType::TrimFromStartOfAudioClip);

std::array<MenuItem*, RuntimeFeatureSettingType::MaxElement - kNonTopLevelSettings> subMenuEntries{
&menuDrumRandomizer,
Expand All @@ -72,7 +73,8 @@ std::array<MenuItem*, RuntimeFeatureSettingType::MaxElement - kNonTopLevelSettin
&menuAlternativePlaybackStartBehaviour,
&menuEnableGridViewLoopPads,
&menuAlternativeTapTempoBehaviour,
&menuHorizontalMenus};
&menuHorizontalMenus,
&menuTrimFromStartOfAudioClip};

Settings::Settings(l10n::String name, l10n::String title) : menu_item::Submenu(name, title, subMenuEntries) {
}
Expand Down
Loading

0 comments on commit 93333f1

Please sign in to comment.