User-Defined Opcode Database

PartikkelSimpB

The same as PartikkelSimpA, but with a time pointer input

Download UDO File

Description

The same as PartikkelSimpA, but with a time pointer input

Syntax

apartikkel PartikkelSimpB ifiltab, apnter, kgrainamp, kgrainrate, kgrainsize, kcent, kposrand, kcentrand, icosintab, idisttab, iwin

Initialization

ifiltab: function table with the input sound file (usually with GEN01)
icosintab: function table with cosine (e.g. giCosine ftgen 0, 0, 8193, 9, 1, 1, 90)
idisttab: function table with distribution (e.g. giDisttab ftgen 0, 0, 32768, 7, 0, 32768, 1)
iwin: function table with window shape (e.g. giWin ftgen 0, 0, 4096, 20, 9, 1)

Performance

apnter: pointer into the function table (0-1)
kgrainamp: multiplier of the grain amplitude (the overall amplitude depends also on grainrate and grainsize)
kgrainrate: number of grains per seconds
kgrainsize: grain duration in ms
kcent: transposition in cent
kposrand: random deviation (offset) of the pointer in ms
kcentrand: random transposition in cents (up and down)

Code

  opcode PartikkelSimpB, a, iakkkkkkiii

ifiltab, apnter, kgrainamp, kgrainrate, kgrainsize, kcent, kposrand, kcentrand, icosintab, idisttab, iwin	xin

/*amplitude*/
kamp		= 		kgrainamp * 0dbfs
/*transposition*/
kcentrand	rand 		kcentrand; random transposition
iorig		= 		1 / (ftlen(ifiltab)/sr); original pitch
kwavfreq	= 		iorig * cent(kcent + kcentrand)	
/* other parameters */
imax_grains	= 		1000; maximum number of grains per k-period
idist		=		1; scattered distribution
async		=		0; no sync input
awavfm		=		0; no audio input for fm

aout		partikkel 	kgrainrate, idist, idisttab, async, 1, iwin, \
				-1, -1, 0, 0, kgrainsize, kamp, -1, \
				kwavfreq, 0, -1, -1, awavfm, \
				-1, -1, icosintab, kgrainrate, 1, \
				1, -1, 0, ifiltab, ifiltab, ifiltab, ifiltab, \
				-1, apnter, apnter, apnter, apnter, \
				1, 1, 1, 1, imax_grains
		xout		aout
  endop

Examples

<CsoundSynthesizer>
<CsOptions>
-o dac
</CsOptions>
<CsInstruments>

0dbfs		=		1

/*Uses the file fox.wav which is part of the Csound Manual*/

giCosine	ftgen		0, 0, 8193, 9, 1, 1, 90;cosine
giDisttab	ftgen		0, 0, 32768, 7, 0, 32768, 1; for kdistribution 
giFile		ftgen		0, 0, 0, 1, "fox.wav", 0, 0, 1; soundfile (just first channel if stereo)
giWin		ftgen		0, 0, 4096, 20, 9, 1; window

  opcode PartikkelSimpB, a, iakkkkkkiii
/* The same as PartikkelSimpA, but with a time pointer input.
ifiltab:	function table with the input sound file (usually with GEN01)
apnter:	pointer into the function table (0-1)
kgrainamp:	multiplier of the grain amplitude (the overall amplitude depends also on grainrate and grainsize)
kgrainrate:	number of grains per seconds
kgrainsize:	grain duration in ms
kcent:		transposition in cent
kposrand:	random deviation (offset) of the pointer in ms
kcentrand:	random transposition in cents (up and down)
icosintab:	function table with cosine (e.g. giCosine ftgen 0, 0, 8193, 9, 1, 1, 90)
idisttab:	function table with distribution (e.g. giDisttab ftgen 0, 0, 32768, 7, 0, 32768, 1)
iwin:		function table with window shape (e.g. giWin ftgen 0, 0, 4096, 20, 9, 1)
*/

ifiltab, apnter, kgrainamp, kgrainrate, kgrainsize, kcent, kposrand, kcentrand, icosintab, idisttab, iwin	xin

/*amplitude*/
kamp		= 		kgrainamp * 0dbfs
/*transposition*/
kcentrand	rand 		kcentrand; random transposition
iorig		= 		1 / (ftlen(ifiltab)/sr); original pitch
kwavfreq	= 		iorig * cent(kcent + kcentrand)	
/* other parameters */
imax_grains	= 		1000; maximum number of grains per k-period
idist		=		1; scattered distribution
async		=		0; no sync input
awavfm		=		0; no audio input for fm

aout		partikkel 	kgrainrate, idist, idisttab, async, 1, iwin, \
				-1, -1, 0, 0, kgrainsize, kamp, -1, \
				kwavfreq, 0, -1, -1, awavfm, \
				-1, -1, icosintab, kgrainrate, 1, \
				1, -1, 0, ifiltab, ifiltab, ifiltab, ifiltab, \
				-1, apnter, apnter, apnter, apnter, \
				1, 1, 1, 1, imax_grains
		xout		aout
  endop

instr 1
apnt		phasor		1/(ftlen(giFile)/sr)
icent		=		p6
apartikkel	PartikkelSimpB	giFile, apnt, .1, 100, 30, icent, 0, 0, giCosine, giDisttab, giWin
		out		apartikkel
endin

</CsInstruments>
<CsScore>
;i1	st	dur	skip	speed	cent
i1	0	2.757	0	1	0	
i1	3	3	1.2	.5	400
i1	6	5.514	0	-1.5	-400
e
</CsScore>
</CsoundSynthesizer>

Credits

joachim heintz 2010


Previous Home Next
SinesToSSTI   TableDumpSimp