File: DiskOut.rtf

package info (click to toggle)
supercollider 1%3A3.4.5-1wheezy1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 26,972 kB
  • sloc: cpp: 116,645; lisp: 64,914; ansic: 10,725; python: 3,548; perl: 766; ruby: 487; sh: 152; makefile: 117; xml: 13
file content (64 lines) | stat: -rw-r--r-- 2,066 bytes parent folder | download
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
{\rtf1\mac\ansicpg10000\cocoartf102
{\fonttbl\f0\fnil\fcharset77 Monaco;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue191;\red96\green96\blue96;
\red191\green0\blue0;\red0\green0\blue191;\red96\green96\blue96;\red191\green0\blue0;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural

\f0\fs18 \cf2 \
\
	\cf0 ////////////////////Write To Disk\cf2 \
	(\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\cf2 	s = \cf3 Server\cf2 .local;\
	\cf3 SynthDef\cf2 (\cf4 "help-SinOsc"\cf2 ,\{ \cf3 arg\cf2  out=0;\
		\cf3 Out\cf2 .ar(out,\
			\cf3 SinOsc\cf2 .ar(\cf3 LFNoise1\cf2 .kr(7,200,800), 0, 0.25)\
		)\
	\}).load(s);\
	\
	\cf3 SynthDef\cf2 (\cf4 "help-DiskOut"\cf2 , \{ arg\cf0  bufNum=0;\cf2 \
			\cf3 DiskOut\cf2 .ar(\cf0 bufNum\cf2 , \cf3 In\cf2 .ar(0,2));\
	\}).load(s)\
	)\
	\
	\cf5 //run a sound source\
\cf2 	a = \cf3 Synth\cf2 (\cf4 "help-SinOsc"\cf2 );\
	\
	\cf5 // allocate a disk i/o buffer\
\cf2 	b = \cf3 Buffer\cf2 .new(s,65536,2);\
	b.write(\cf4 "diskouttest2.aiff"\cf2 , \cf4 "aiff"\cf2 , \cf4 "int16"\cf2 , 0, 0, \cf3 true\cf2 );\
	\
	r = \cf3 Synth\cf2 (\cf4 "help-DiskOut", [\\bufNum, b.\cf0 bufnum]\cf2 );\
	\
	\cf5 //stop recording\
\cf2 	r.free;\
	\
	\cf5 //stop sound\
\cf2 	a.free;\
	\
	\cf5 //quit server\
\cf2 	s.quit;\
	\
	////////////////////Read From Disk: doesn't work yet like this\
	\
	s.boot;\
	\
	\cf0 (\
\cf6 		SynthDef\cf0 (\cf7 "help-DiskIn"\cf0 , \{  arg bufNum=0;\
			\cf6 Out\cf0 .ar(0, \cf6 DiskIn\cf0 .ar(2, bufNum));\
		\}).load(s)\
	)\
\cf2 \
	\cf8 // allocate a disk i/o buffer\
\cf0 	b = \cf6 Buffer\cf0 .cueSoundFile(s, \cf7 "diskouttest2.aiff"\cf0 , \cf7 1\cf0 , 65536,2);\
	\cf2 \
	\cf0 r = \cf6 Synth\cf0 (\cf7 "help-DiskIn", [\\bufNum, b.\cf0 bufnum]);\cf2 	\
	r.free;	\
	\
	b.free;\
	\
	\cf0 b = \cf6 Buffer\cf0 .cueSoundFile(s, \cf7 "diskouttest2.aiff"\cf0 , \cf7 1\cf0 , 65536,2);\cf2 \
	\cf0 r = \cf6 Synth\cf0 (\cf7 "help-DiskIn", [\\bufNum, b.\cf0 bufnum]);	\
	r.free;\cf2 \
	\
	}