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

Sequencer.reset doesn't propagate to backend #46

Closed
tharvik opened this issue Jul 12, 2024 · 3 comments
Closed

Sequencer.reset doesn't propagate to backend #46

tharvik opened this issue Jul 12, 2024 · 3 comments

Comments

@tharvik
Copy link
Contributor

tharvik commented Jul 12, 2024

when using a "split" sequencer, it doesn't forward the reset to the backend.
I'm adding a PR showing that in tests.

I was thinking of looping the sequencer quite regularly, such as every seconds, with smth like the following but it doesn't behave as expected.

let mut seq = Sequencer::new(true, 1);
seq.push(0.0, 0.4, Fade::Smooth, 0.0, 0.0, Box::new(bassdrum(0.2, 180.0, 60.0)));

let _stream = start_audio(sequencer.backend());
loop {
    thread::sleep(Duration::from_secs(1));
    seq.reset();
}
@SamiPerttu
Copy link
Owner

Thanks for the report, a fix has been committed. I'm not sure if you can get a steady beat that way - it depends on the system scheduler. But it's a fun experiment. I've been thinking about looping in Sequencer and, to get more precise results, I believe I can support looping in some fashion, I'm just not sure what is the best way to expose this functionality.

@tharvik
Copy link
Contributor Author

tharvik commented Jul 16, 2024

I'm not sure if you can get a steady beat that way - it depends on the system scheduler. But it's a fun experiment.

yeah, under some load, it losses precision. I made it work by having a whole different idea: a LoopingUnit which resets its contained unit after a set amount of time. I can then run it direclty to have a repeated note (avoiding the sequencer altogether).

I've been thinking about looping in Sequencer and, to get more precise results, I believe I can support looping in some fashion, I'm just not sure what is the best way to expose this functionality.

building on my previous idea: simply resetting all units after a certain time gives a good "physical sequencer feel" IMO. that would require to keep events around so maybe update this argument to smth like Option<Duration> (None: do not keep anything, Some(f64::INFINITY): keep always and only replay on reset, Some(…): loop).

@SamiPerttu
Copy link
Owner

A looping unit is a nice idea too, I'm putting it on the TODO list with sequencer looping.

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

2 participants