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

Stopping, pausing and resuming playback #69

Closed
crisptrutski opened this issue Sep 9, 2015 · 4 comments
Closed

Stopping, pausing and resuming playback #69

crisptrutski opened this issue Sep 9, 2015 · 4 comments

Comments

@crisptrutski
Copy link
Member

crisptrutski commented Sep 9, 2015

Repeating @daveyarwood's idea from #67 here, because it's awesome

Would you prefer to have a :resume command or a :rewind command? (i.e. is rewind implicit with :play or not)

@daveyarwood
Copy link
Member

I think the default behavior of :play should be to play the score from the beginning (be kind, rewind!)

It would be cool if we could work in a way to optionally set start and end points, which could be either markers or minute/second markings, e.g.

:play from 0:20 to 0:30
:play from chorus1 to bridge

We could make the same feature available to the alda play task:

alda play --from 0:20 --to 0:30
alda play --from chorus1 --to bridge

@daveyarwood
Copy link
Member

Some notes on :stop and :pause:

  • Now that we have the server/client relationship, I'd like to try to keep the two experiences (sending commands to the server via the client, vs. an interactive Alda REPL session) as symmetrical as possible. Not only should you be able to :stop or :pause playback in a REPL session, you should also be able to communicate the same thing to the server from the client by running alda stop / alda pause.
  • Running :play by itself should resume playback if the current state is paused, otherwise start playing from the beginning of the currently loaded score -- think of the ▶button on a stereo.
  • I also like the idea of a dedicated :unpause / :resume command which resumes playback if we're in a paused state, otherwise it does nothing.

Implementation notes:

  • :stop/alda stop should be easy enough to implement. We could add a new multimethod to alda.sound to handle how to stop playback on each type.
    • For MIDI, calling setMute on every channel ought to do the trick.
    • We should also call the function that results from calling alda.sound/play! -- it's a thunk that stops playback of any subsequent notes. (Would it be better to restart the JSyn synthesis engine?)
  • :pause/alda pause will be a little trickier, but doable.
    • Each time playback is initiated, we could keep track of the millisecond timestamp.
    • To pause, we could:
      • note the current timestamp and subtract the start timestamp from it to get the current offset
      • stop playback (perform the same actions as :stop)
      • keep track of the paused state and the current offset
    • To unpause, we would just play the score starting from the paused offset.

@daveyarwood daveyarwood changed the title Support :stop and :pause commands in the REPL Stopping, pausing and resuming playback Mar 13, 2016
@daveyarwood daveyarwood added this to the 1.0.0 milestone Oct 16, 2016
@daveyarwood
Copy link
Member

daveyarwood commented Oct 16, 2016

Adding this to our 1.0.0 milestone -- I can't imagine the first stable Alda release still not being able to pause or stop your score!

@daveyarwood
Copy link
Member

Moved to alda-lang/alda-sound-engine-clj#3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants