-
Notifications
You must be signed in to change notification settings - Fork 993
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
Loop.restart (or is there a way of doing this now?) #1304
Comments
It's totally possible that I completely misunderstood what you are trying to acchieve. If so, I am sorry! |
Hi. There might be something in your suggestion - I may need to think about the approach. However, just in case it helps - I have a screenshot: This is an example of a sample where the shaded region represents where it will loop. The thin black line is the playhead (where we are now in the sample). Rather than me trying to find the BPM and loop based on that, it's more about the sample length. Once I've got a sample that loops perfectly, I then want to try and audition a simple beat based on the BPM information I've extracted. I don't know if you're familiar, but the workflow is like a cross between an MPC and TrackLib's website. I've never found a sampling workflow where I've been able to feel like I'm working quickly, so as soon as I found tone.js I decided to give it a go. So, the workflow would be:
I'm at the final step and, because the number of beats/bars is unknown, the beat ( If the beat were a sample, this would be simple and it might be the direction I go in for now. But I really like the idea of the Beat being a proper sequenced instrument that I can tweak and then either "bookmark" the idea or throw it away. |
I'm new to tone.js so I may be off course. Have you tried creating a second transport for your extracted loop (possibly syncing it to the default transport) and looping the newly created transport? |
Assuming there's no architectural reason, then yes, two transports would work. One would be "BPM-less" and the transport would be simply about starting the main sample loop, but the other could have a BPM and that would be adjusted by the user. |
If you have a portion of the sample then you would know the start (0) and the end (L) either in seconds or in samples. From that you would be able to calculate the resulting BPM. If the dark region happens to be 0.5s then the BPM would be 120. If the sample length is L in seconds then the BPM = 60/L. (again: I might be totally off) |
I can't decide if this would be a new feature, or I just haven't found the right combination of tools.
The feature you'd like
Loop.restart
I have very specific use case.
getTransport.start()
triggers a Player with audio that loops. The BPM at this stage is unknown and, even when we do know it, it shouldn't be used to control the looping of the audio. The player starts and it uses the built-inloop: true
. The player loops every "audio duration" - this is fine.I'd like to audition a
Loop
(which will have a BPM) with that sample, so when the sample starts playing at position zero, the Loop should start. However, the when the sample ends (or as it starts) theLoop
should restart - clear and reschedule all events, regardless of where it's up to inprogress
.Any alternatives you've considered
Unfortunately, it doesn't seem like calling
loop.stop()
and thenloop.start();
works. Even if you try to force a clearing of the future events (usingcancel
and -Infinity), then thestart
doesn't seem to reschedule the events from Transport Time Zero. I have thought that this is because of the fact that stop schedules the status to becomestopped
and at the pointstart();
is called, the status isn't (yet) stopped.... but at this point I got in knots trying to understand transport time and events.Let me know if that's the correct path to go down. Or, if the answer is to make my own Loop class, that's fine, but I didn't want to do that if there's a better solution.
I hope this makes sense.
The text was updated successfully, but these errors were encountered: