feat: Start/End and Reverse Parameters for Tone.Sampler#1397
Open
LoopBraker wants to merge 4 commits intoTonejs:devfrom
Open
feat: Start/End and Reverse Parameters for Tone.Sampler#1397LoopBraker wants to merge 4 commits intoTonejs:devfrom
LoopBraker wants to merge 4 commits intoTonejs:devfrom
Conversation
Allows playing a portion of a sample without requiring loop mode.
This enables smooth playback from arbitrary positions with the
envelope's fadeIn applied to prevent clicking artifacts.
Usage: sampler.triggerAttack("C4", time, velocity, startTime, endTime)
Adds a `reverse` property to Sampler that enables reversed sample playback.
When combined with start/end parameters in triggerAttack, allows playing
portions of samples backwards while still benefiting from the envelope's
fadeIn/fadeOut to prevent clicking artifacts.
Usage:
sampler.reverse = true;
sampler.triggerAttack("A4", time, velocity, 0.5, 1.0); // plays 1.0s->0.5s reversed
…xactly at the end position
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1397 +/- ##
==========================================
- Coverage 98.98% 98.85% -0.13%
==========================================
Files 204 204
Lines 23138 23211 +73
Branches 1017 1027 +10
==========================================
+ Hits 22901 22943 +42
- Misses 237 268 +31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR extends
Tone.Samplerwith two new features that enable more flexible sample playback, inspired by Autotel:1. Start/End Parameters for
triggerAttackAdded optional
startandendparameters totriggerAttack()allowing playback of specific portions of a sample without requiring loop mode.Signature change:
2. Reverse Playback Support
Added a
reverseproperty that plays samples backwards. When combined with start/end parameters, the offsets are automatically recalculated to maintain intuitive behavior.Implementation Details
ToneBufferSource's existingstartandplaybackRatecapabilitiesNew Example
Added samplerRange.html demonstrating: