Interpreting note-ons as note-offs should be fairly easy, since (at
least as far as I can tell) the same event instance is used in both
cases, with mNextIsNoteOn being used to detect whether a note-on or a
note-off should be emitted. Simply xoring that with whether playback
is reversed should work.
That will not work. There's no provision to "read" midi sequence
structures in reverse, nor would you want to. Going backwards in MIDI is
a real problem because MIDI messages are effectively state changes. If
the MIDI message is "change control 10 to value 50", how do you play
that backwards?
That wouldn't (as Steve hinted to) work for the other events, though,
as pitch change and similar would apply to everything behind it
instead of ahead of it. Ignoring those during reverse playback could
work, but ideally we'd need to find the place where it changes and
work backwards (I can't think of a practical way of doing that).
The "standard" way sequencers deal with this is to replay state changes
like pitch bend from the beginning up to the place you want to start
when you want to move to an earlier time point in a sequence. This is
pretty awkward for trying to play something in reverse. I think I would
be inclined to "bite the bullet" and do it right: produce a new sequence
that plays in reverse and use it to go backward.
I found a neat thing with portmidi: it supports passing a custom time
method (see PmTimeProcPtr). I don't know entirely how well it'd work,
but it may simplify some things if we could just pass the audio time
to that. If it supports negative time flow (which I doubt, but it
might) then that'd solve all problems for us, even.
No, as someone else said, time has to increase monotonically.
Forward scrubbing probably shouldn't be that hard, as it only needs
adjusting the rate of time. Backwards scrubbing will be more
complicated, but for basic notes it should be manageable. Seeking,
though, suddenly seems fairly difficult, since the skips could skip
over note-ons, or worse, note-offs. I'm not sure how best to
implement that.
Of course, Audacity already allows you to move to any time location and
start playing. This is/was implemented by playing back MIDI state
changes, suppressing note-ons, until you get to the desired time point.
You might think that when you press "play", you want to send note-ons
for all notes that should already be playing at the starting time, but I
think the implementation I did ignored notes that started before the
start time. Note-offs would be sent for these according to the sequence,
but they should be harmless.
For example, on stop, do we send an "all notes off" message
(we probably should). On resuming from Pause, do we resend note on
messages for notes that have not reached their note off message?
(not essential, but probably a good idea).
Yes, all notes off is set on pausing and stopping. However, resuming
doesn't currently resent messages for notes that haven't finished
yet. I'm not sure if that would work well - consider a piano; when
it's first pressed it makes the main noise. If it were paused and
unpausing the middle, you'd only want the sustained portion, not the
first part. Resending paused notes would make it seem like they
started over again, not that they were paused and unpaused - I don't
/think/ it's possible to achieve that effect in midi.
That was my conclusion as well. Of course if you had an organ pedal tone
that lasted for 1 minute, then pausing/continuing in the middle would
kill the pedal tone, which would be musically wrong, but at least it
would not be too surprising or unexpected that we only turn notes on
when we see note-on messages.
--Poke
On Wed, Jun 7, 2017 at 12:48 AM, Steve the Fiddle
Post by Federico MiyaraOne possibility is to send an automatic note-off for any
time-reversal
Post by Federico Miyarasituation for all notes that are currently being played, and
from then on to
Post by Federico Miyarainterpret note-ons as note-offs and viceversa. It would allow to
test a
Post by Federico Miyararetrogradation of a melody in real time without the (in general
undesirable)
Post by Federico Miyaraartifact of envelope reversing.
That's a clever idea Federico, but in practice there is no guarantee
that the note off velocity will be meaningful rather than padding. For
the purpose of scrubbing, we could ignore (filter out) some data, such
as velocity, patch change, after touch, control change - perhaps
everything except note on and note off. It does need to be carefully
though through.
Even forward play requires some consideration of note on / note off.
For example, on stop, do we send an "all notes off" message (we
probably should). On resuming from Pause, do we resend note on
messages for notes that have not reached their note off message? (not
essential, but probably a good idea).
Steve
Post by Federico MiyaraFederico
On Tue, Jun 6, 2017 at 2:12 PM, Gale Andrews
Post by Gale AndrewsSo, the simplest option, although audio Play-at-Speed without
You meant "with" ?
Post by Gale Andrewspitch change would IMO be very desirable, is to accept that
Play-at-Speed for MIDI just "moves the score faster".
Gale
A user might expect scrubbing, or play-at-speed, or nontrivial
time track,
Post by Federico Miyarasimply to apply to the as-rendered sound. To do that would
require us first
Post by Federico Miyarato render MIDI for ourselves. There was mention of doing that
perhaps with
Post by Federico Miyarasome third party library. However I count that beyond 2.2.0
scope unless
Post by Federico Miyarasomeone surprises me.
Or a user might reasonably expect as Steve says that these
timeline changes
Post by Federico Miyaraapply to MIDI events, thus changing tempo only. But what then
should it
Post by Federico Miyaramean when the selection to play includes a combination of Wave
and MIDI
Post by Federico Miyaratracks?
Or would the ideal be to give the choice among these two
behaviors to the
Post by Federico Miyarauser?
The best simple answer to these questions in 2.2.0 is simply to
evade them.
Post by Federico MiyaraJust disallow MIDI playback in such cases. Should that pop up a
warning or
Post by Federico Miyarajust silently exclude the MIDI tracks from the playback?
PRL
------------------------------------------------------------------------------
Post by Federico MiyaraCheck out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
https://lists.sourceforge.net/lists/listinfo/audacity-devel
<https://lists.sourceforge.net/lists/listinfo/audacity-devel>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
https://lists.sourceforge.net/lists/listinfo/audacity-devel
<https://lists.sourceforge.net/lists/listinfo/audacity-devel>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
https://lists.sourceforge.net/lists/listinfo/audacity-devel