syncloop

syncloop — Synchronous granular synthesis.

Description

syncloop is a variation on syncgrain, which implements synchronous granular synthesis. syncloop adds loop start and end points and an optional start position. Loop start and end control grain start positions, so the actual grains can go beyond the loop points (if the loop points are not at the extremes of the table), enabling seamless crossfading. For more information on the granular synthesis process, check the syncgrain manual page.

Syntax

asig syncloop kamp, kfreq, kpitch, kgrsize, kprate, klstart, \
      klend, ifun1, ifun2, iolaps[,istart, iskip]

Initialization

ifun1 -- source signal function table. Deferred-allocation tables (see GEN01) are accepted, but the opcode expects a mono source.

ifun2 -- grain envelope function table.

iolaps -- maximum number of overlaps, max(kfreq)*max(kgrsize). Estimating a large value should not affect performance, but execeeding this value will probably have disastrous consequences.

istart -- starting point of synthesis in secs (defaults to 0).

iskip -- if 1, the opcode initialisation is skipped, for tied notes, performance continues from the position in the loop where the previous note stopped. The default, 0, does not skip initialisation

Performance

kamp -- amplitude scaling

kfreq -- frequency of grain generation, or density, in grains/sec.

kpitch -- grain pitch scaling (1=normal pitch, < 1 lower, > 1 higher; negative, backwards)

kgrsize -- grain size in secs.

kprate -- readout pointer rate, in grains. The value of 1 will advance the reading pointer 1 grain ahead in the source table. Larger values will time-compress and smaller values will time-expand the source signal. Negative values will cause the pointer to run backwards and zero will freeze it.

klstart -- loop start in secs.

klend -- loop end in secs.

Examples

Here is an example of the syncloop opcode. It uses the file syncloop.csd.

Example 1049. Example of the syncloop opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac  ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o syncloop.wav -W ;;; for file output any platform
</CsOptions> 
<CsInstruments>

sr = 44100 
ksmps = 32 
0dbfs  = 1 
nchnls = 2

instr 1
		
iolaps  = 2
igrsize = 0.01
ifreq   = iolaps/igrsize
ips     = 1/iolaps

istr    = p4  /* timescale  */
ipitch  = 1   /* pitchscale */

asig	syncloop 1, ifreq, ipitch, igrsize, ips*istr, .3, .75, 1, 2, iolaps
	outs	 asig, asig

endin
</CsInstruments>
<CsScore>
f1 0 0 1 "beats.wav" 0 0 0
f2   0   8192   20   2   1

i1 0 6 .5
i1 7 6 .15
e
</CsScore>
</CsoundSynthesizer> 


Credits

Author: Victor Lazzarini
January 2005

New plugin in version 5

January 2005.