File: Plet.schelp

package info (click to toggle)
supercollider 1%3A3.13.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 80,292 kB
  • sloc: cpp: 476,363; lisp: 84,680; ansic: 77,685; sh: 25,509; python: 7,909; makefile: 3,440; perl: 1,964; javascript: 974; xml: 826; java: 677; yacc: 314; lex: 175; objc: 152; ruby: 136
file content (73 lines) | stat: -rw-r--r-- 1,545 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
TITLE:: Plet
summary:: Define a value within the scope (namespace) of a Plambda
categories:: Streams-Patterns-Events>Patterns>Data Sharing
related:: Classes/Plambda, Classes/Pget

DESCRIPTION::
link::Classes/Plet::/link::Classes/Pget:: are used to share data between patterns inside of a link::Classes/Plambda::

Plet defines a variable containing a pattern or data for sharing within the scope of a link::Classes/Plambda::. 

Using the link::Classes/Pget:: class, the contents of this variable can then be accessed by key in other patterns within the link::Classes/Plambda::.

CLASSMETHODS::

METHOD:: new

ARGUMENT:: key
The name of the variable

ARGUMENT:: pattern
The contents of the variable

ARGUMENT:: return
If return is nil, the pattern will be returned.
If not nil, the contents of the return argument will be returned while the variable defined by the Plet will be set to the value of pattern

INSTANCEMETHODS::

METHOD:: storeArgs

METHOD:: embedInStream

ARGUMENT:: inval

METHOD:: pattern

METHOD:: silent

METHOD:: key

METHOD:: return

EXAMPLES::

code::
(
	/*

	Two patterns playing in parallel, 
	sharing data between eachother

	*/

	// a melody playing random scale degrees
	a = Pbind(
		\dur, 0.125, 
		\octave, 4,
		\degree, Plet(\melody, pattern: Pwhite(0,7))
	);

	// the bass, scale degrees sampled from the \melody variable defined above 
	b = Pbind(
		\dur, 0.5, 
		\octave, 3,
		\degree, Pget(\melody, default: 1, repeats: inf).trace
	);

	// Play the patterns in parallel
	Plambda(
		Ppar([a, b], inf)
	).play;
)
::