Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] Score rewinding

Date2005-05-08 23:15
FromMichael Gogins
SubjectRe: [Cs-dev] Score rewinding
Thanks for your prompt response, Istvan. My responses are interspersed below. In general, now that we're talking about these issues, let's try to imagine how we can improve Csound to work better as a plugin for other hosts. In addition to MIDI and audio input and output in that context, we need Start, Pause, Stop, and Seek functions.

VST is mostly on Windows and the Mac, but the csoundapi~ object by Lazzarini will be able to use these functions on Linux, and so would a DSSI plugin or a Jack implementation that works with ALSA MIDI.

>> The purpose of the isScorePending and setScorePending calls is tell the
> > API client whether or not Csound will synthesize pending Csound score events,
> > and for the API client to tell Csound to synthesize pending Csound score events.
> 
> So, does this mean that setScorePending is 1 normally (although it defaults to
> 0 at this time), and when zero, events from the score should be skipped ?
> Or delayed until pending is set to 1 again ?

When zero, events from the score should be delayed, until pending is set to 1 again. In other words, this is the Csound "Pause" button.

> Unfortunately it is SetScoreOffsetSeconds that is more problematic than
> rewinding the score (as the operation of the latter can be defined more
> exactly). It has the following limitations:
>   * works by entering a special "fast forward" mode, when kperf()
>     does not perform any notes, or do any audio I/O; also, note events
>     are discarded. One major disadvantage is that seeking to the requested
>     time is slow: while it is faster than normal performance, you may still
>     need to wait a few seconds if minutes are skipped.
>     Perhaps this is why it seems to "hang" ?

No, my experience was that "fast forward" is plenty fast enough to be imperceptible, or at any rate it used to be fast enough, at least for the moderately complex scores (up to a hundred bars, several hundreds of notes) that I was working with.

>   * can only seek forward (otherwise you need to rewind first)
>   * as notes that would start during the skipped period are removed, you
>     can get unexpected results due to skipping global "always on" notes
>     (for reverb etc.). A note that starts at time zero is not skipped,
>     however.

This may or may not be a problem. Cubase can be counted on to deliver "note off" events for all hanging notes, and I would imagine other VST hosts would do the same. I have a very complex orchestra with 15 instruments, a global mixer, a heavy reverb, and it was all working peachy keen, including looping, stopping, and restarting. My implementation did not attempt to always play notes at time 0, but I see your point about that. I did not try to loop this particular orchestra in the middle of a piece. So the always on stuff may be a problem, but perhaps scores intended for VST performance could be written to work around this problem by starting all the actual notes after some bars of silence (I used to do that anyway, to give my orchestra a chance to compile before the notes came in). In any event, I think the API would benefit from an "AllNotesOff" call. 

Even if VST orchestras can't have "always on" events, the score rewinding would still be very useful as global effects could always be provided by other plugins.

Possibly, another API to retrieve the instrument numbers for "always on" instruments could be used, maybe along with a new opcode for instruments to tell Csound they should be "always on".  That's getting pretty baroque... but it might be useful in other contexts.

>   * should be called between csoundPreCompile and csoundCompile, or after
>     csoundCompile before performance. Calling after csoundCreate will not
>     work because either csoundPreCompile or csoundCompile would reset first.

I'm sorry, but I'm not sure what you mean here. Can you go into more detail?

Best,
Mike





-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-05-09 12:17
FromIstvan Varga
SubjectRe: [Cs-dev] Score rewinding
Michael Gogins wrote:

> When zero, events from the score should be delayed,
 > until pending is set to 1 again. In other words, this
 > is the Csound "Pause" button.

Then I cannot implement it yet (I think it may need major changes that would
possibly involve having to update the opcode library, and it is unclear how in
certain situations score pause should behave).
However, as it has always been a stub (and the only change is that I moved
the statics to ENVIRON), how could it work earlier ?

> I'm sorry, but I'm not sure what you mean here. Can you go into more detail?

I meant that this will not work (as csoundCompile implies csoundReset):

ENVIRON *csound = csoundCreate(NULL);
csoundSetScoreOffsetSeconds(csound, FL(10.0));
csoundCompile(csound);


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-05-09 12:29
FromIstvan Varga
SubjectRe: [Cs-dev] Score rewinding
Michael Gogins wrote:

> This may or may not be a problem. Cubase can be counted on to deliver "note off"
 > events for all hanging notes, and I would imagine other VST hosts would do 
the same.

No, the issue is not that notes are not turned off (event processing - including
removing exired notes - is still done, except inserting new notes). The problem
is that long notes that would start during the skipped period but end after the
skip time are deleted entirely rather than being shorter. It may be possible to
allow note inits in the "fast forward" mode - obviously at the expense of making
it slower - but it is not sure if all opcodes and instruments would behave well
in that case.
The score notes that start at time zero are not deleted because the 'a'
statement that is created to skip the requested amount of time is executed
after the init pass of score (but not real time) notes at the same time.
This has the useful side effect that a long "always on" note for reverb etc.
is not removed if it starts at zero (which is usually the case, unless there
are multiple sections, each with its own effect note).


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net