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

Create a Loop one Tone.Sampler #1282

Open
stailer opened this issue Sep 26, 2024 · 1 comment
Open

Create a Loop one Tone.Sampler #1282

stailer opened this issue Sep 26, 2024 · 1 comment

Comments

@stailer
Copy link

stailer commented Sep 26, 2024

Hello,

is possible create a loop dynamic from Tone.Sampler ?
This is my code :

`public playSampleOnKeyPress(key: string): void {
const note = this.keyToNoteMap[key];

if (note && this.sampler.loaded && !this.activeNotes.has(key)) {
  this.sampler.triggerAttack(note);
  this.activeNotes.add(key);
}

}

public releaseSampleOnKeyRelease(key: string): void {
const note = this.keyToNoteMap[key];

if (note && this.sampler.loaded && this.activeNotes.has(key)) {
  this.sampler.triggerRelease(note);
  this.activeNotes.delete(key);
}

}`

on key press sound is started , if i use another keypress in same time , started too, all is OK. example : I can play chord or play a melody.

But i would like use a sample with a loop. How to do it in my code ?

thanks !

@stailer
Copy link
Author

stailer commented Sep 27, 2024

resolved :)
i use dynamic instance from Tone.Player for manage my loops with interface from WaveSurfer... Samples are preloaded with Tone.Sampler in browser cache.

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

1 participant