File: Stretcher

package info (click to toggle)
cecilia 2.0.5-2.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,440 kB
  • ctags: 833
  • sloc: tcl: 9,786; sh: 1,085; makefile: 69; csh: 13
file content (107 lines) | stat: -rw-r--r-- 3,589 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<info>
Stretcher/Granulator 
Jean Piche - 1996
index controls starting point for each grain
grain pitch controls the range of random pitch deviation from nominal pitch
randamp/randfreq control range and frequency of random deviation of index
randpan control range of pan deviation for each grain
gain is overall gain
grain_dur is the duration of each grain
streams controls the number of grain overlapping (density)
3 or 4 streams (overlaps) for real time  
ksmps < 50 for good quality
</info>
<tk_interface>
cgraph 	index 		-label   Index -unit samples -min 0 -max 1 -func "0 0 1 1 " 
cgraph 	graindur 		-label  "Grain Duration" -unit x -rel log -min 0.005 -max 1 -init .1 
cgraph 	randindexamp 		-label  "Range of Random\nIndex Dev" -unit %  -min  0 -max .5 -init  0 
cgraph 	randindexfreq 		-label  "Freq of Random\nIndex Dev" -unit Hz -rel log  -min .1 -max 30 -init 1 
csepar

cgraph	 pitch 		-label  "Pitch of Grains" -rel log -unit x -min 0.05 -max 5 -init 1.0 
cgraph	 randpitch 		-label  "Random Pitch\nof Grains" -rel lin -unit % -min 0.000 -max 1 
cgraph 	randpan 		-label  "Random Pan" -unit % -min  0 -max 1 -init 0 
csepar
cgraph 	gain 		-label  Gain -unit x -rel log -min .1 -max 30 -init 1 
cpopup 	envtype 		-label  "Envelope type" -val "sine square half bell"

cslider	no_of_streams  		-label  "No. of Overlaps" -rat i -res 1 -min 1 -max 32  -init 3

cslider 	duree_totale 		-label  Time -unit sec. -rat i -res .01 -min 1 -max 600 -init 60
cslider 	seed 		-label  "Random Seed" -rat i -uni " " -res .001 -min .001 -max 1 -init .5
cfilein	source		-label  Source
</tk_interface>
<mono>

</mono>
<stereo>
	instr 99
gilen 	= 	[sinfo source frames]
gifact	=	(gilen/ftlen(12))
ginom	=	(sr/gilen)*gifact* [sinfo source sr] /sr
giseoder	=	[seed]
giolaps	init	 [no_of_streams]
gkrandamp	randi	gkrandindexamp, gkrandindexfreq, giseoder
gkranp	randi	gkrandpan*0.5, 1/gkgraindur, giseoder*.9456
				endin



				instr 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32

ilast	init  	i(gkindex)
ilastdur	init  	i(gkgraindur)
krandpit	rand	gkrandpitch, giseoder*.409 *(p1/20)

reset:
	idel	= 	p1*(i(gkgraindur)/giolaps)
	ipit	=	ginom* (1+i(krandpit*.25))*i(gkpitch)
	iran	=		1+i(gkrandamp)+i(gkrandindexamp)
	index   	= 	(p1*((i(gkindex)-ilast)/giolaps)+ilast) *(iran) *gifact
	idur	=		p1*((i(gkgraindur)-ilastdur)/giolaps)+ilastdur
	ilast 	= 	i(gkindex)
	ilastdur	=		i(gkgraindur)
	ienv	=		i(gkenvtype)+15

    timout	0, idur, go
	reinit reset
go:
    kenv		oscil	gkgain, 1/idur, ienv	
    atab		oscil	kenv, ipit, 12, index
    atab2		oscil	kenv, ipit, 14, index
rireturn	

adel	delay	atab, idel
adel2	delay	atab2, idel
			
outs	adel * (gkranp+.5) , adel2* (gkranp-.5)
				endin
</stereo>
<quad>

</quad>
<score>
#tcl
proc makeScore {} {
	global  value realArr
	set size [findgenSize [sinfo source frames]]
	set thescore "f11 0 8192 10 1\n"
	append thescore "f12 0 $size -1 \"$value(source)\" 0 4 1\n"
	if {[sinfo source chn] != "2"} {
	append thescore "f14 0 $size -1 \"$value(source)\" 0 4 1\n"
	} else {
	append thescore "f14 0 $size -1 \"$value(source)\" 0 4 2\n"
}
	append thescore "f15 0 8192 19 .5 1 0 0 \n"
	append thescore "f16 0 8192 7 0 50 1 8092 1 50 0\n"
	append thescore "f17 0 8192 7 0 50 1 4050 1 50 0 4072 0 \n"
	append thescore "f18 0 8192 7 0 50 1 8100 0 40 0 \n"
	append thescore "i99  0.001  [expr $value(duree_totale)+0.0] \n"
		for {set num 1} {$num <= $value(no_of_streams)} {incr num 1} {
		    append thescore "i$num 0.002 $value(duree_totale)\n"
		}
	return $thescore
}

makeScore
</score>