Re: [LAD] Csound question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Fons!

Mar 6 2022, Fons Adriaensen has written:
...
What I want to achieve is to take some action when instr 85 ends.
There is the release opcode, triggered, when an instrument is in its
last control cycle (k-cycle):
if (release() == 1) then
  ; last action, i.e.:
  schedulek(86, 0, iDuration)
endif

This should work. I am not completely sure about release. Some actions
it won't can't perform. But, when the duration of the instrument is
known, set before, then there are other options. This can only be done,
if the instrument is not played live from MIDi or something.

instr 85
  ; Set the duration:
  if (p3 < giDur) then ; make sure it lasts at least giDur seconds
  	  xtratim(giDur - p3) ; add the extra amount
	endif

	; Make sure instr 86 is played, when this instrument event ends
	schedule(86, giDur, iSomeDuration)
	...
endin

schedule should only be triggered at init time, i.e. when the current
event is started. The schedulek version should be triggered, whenever it
is needed, i.e. based on some runtime condition. There are more
"realtime" aspects to schedulek which can be used.
...
i84 0 0.1 i85 + 1 ; p3 is just a dummy
...
I think this should fail because of two things: I think the + (increased
time counter) is related to instruments, so 85 would take the values
from 84. Not sure though. One second is a long duration, unless the
duration is expected to be longer this might fail. I am not 100% sure
about p3/duration handling. But I think you can extend the duration with
xtratim or a release envelope, but not shorten it.

Lastly, no scheduling is given to instrument 86. This is best done in
the score.

Yet another way, if the given structure is best suited, used instrument
84 as a "main program":
instr 84
  iDelay = filelen($INPFILE)
  schedule(85, 0, iDelay) ; you can add more parameters
  schedule(86, iDelay, iSometime) ; again more parameters are possible
endin

This will perform the action once. Instrument 84 does not need to run
for long. You can even add this as the last line:
  turnoff
This will terminate the instrument, once those calculations and actions
are taken.

You can slim it down, by having the processing of the input in
instrument 84 as well, unless even instrument 85 should be started with
a delay, because of other preparation work.

Sorry, for the long mail. Every single option is viable, depending on
needs, style and structure, one may suite better than another. I'm sure
there are even more solutions, depending on the context. Should multiple
files be processed, should there be repitition, etc.

HTH.

Best wishes,

Jeanette

--
 * Website: http://juliencoder.de - for summer is a state of sound
 * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
 * Audiobombs: https://www.audiobombs.com/users/jeanette_c
 * GitHub: https://github.com/jeanette-c

Our imagination
Taking us to places
We have never been before... <3
(Britney Spears)
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
https://lists.linuxaudio.org/listinfo/linux-audio-user




[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux