1342
Comment:
|
1261
improved formatting
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
homepage: http://sndobj.sourceforge.net/#python |
homepage: http://sndobj.sourceforge.net/#python |
Line 4: | Line 3: |
# | == Code Examples == Some examples not available in [http://downloads.sourceforge.net/sndobj/PySndObj.pdf?modtime=1169813301&big_mirror=0 the manual]. |
Line 6: | Line 6: |
# '''Available examples not in manual (please add):''' _________________________________ 1- |
{{{#!python |
Line 16: | Line 8: |
[[BR]]#and alternating L-R output [[BR]]#any issue, contact renato.fabbri@gmail.com [[BR]]#AND/OR contact SndObj mailing list |
#and alternating L-R output #any issue, contact renato.fabbri@gmail.com #AND/OR contact SndObj mailing list |
Line 21: | Line 13: |
[[BR]]import time | import time |
Line 24: | Line 16: |
[[BR]]osc = sndobj.Oscili(tab, 440, 10000) [[BR]]noise = sndobj.Randh(100000, 10000) |
osc = sndobj.Oscili(tab, 440, 10000) noise = sndobj.Randh(100000, 10000) |
Line 28: | Line 20: |
[[BR]]y=2 | y=2 |
Line 31: | Line 23: |
[[BR]]outp.SetOutput(x, osc) [[BR]]outp.SetOutput(y, noise) |
outp.SetOutput(x, osc) outp.SetOutput(y, noise) |
Line 35: | Line 27: |
[[BR]]osc.SetFreq(440,mod) | osc.SetFreq(440,mod) |
Line 38: | Line 30: |
[[BR]]mod.SetFreq(2, mod2) | mod.SetFreq(2, mod2) |
Line 41: | Line 33: |
[[BR]]mod3 = sndobj.Oscili(tab, q, 1000) [[BR]]noise.SetFreq(1000, mod3) |
mod3 = sndobj.Oscili(tab, q, 1000) noise.SetFreq(1000, mod3) |
Line 45: | Line 37: |
[[BR]]thread.AddObj(mod) [[BR]]thread.AddObj(mod2) [[BR]]thread.AddObj(mod3) [[BR]]thread.AddObj(osc) [[BR]]thread.AddObj(noise) [[BR]]thread.AddObj(outp, sndobj.SNDIO_OUT) |
thread.AddObj(mod) thread.AddObj(mod2) thread.AddObj(mod3) thread.AddObj(osc) thread.AddObj(noise) thread.AddObj(outp, sndobj.SNDIO_OUT) |
Line 58: | Line 50: |
[[BR]]y=1 | y=1 |
Line 61: | Line 53: |
[[BR]]y=2 | y=2 |
Line 63: | Line 55: |
[[BR]]outp.SetOutput(y, noise) [[BR]]time.sleep(1) [[BR]]n +=1 |
outp.SetOutput(y, noise) time.sleep(1) n +=1 |
Line 68: | Line 60: |
}}} |
homepage: http://sndobj.sourceforge.net/#python
Code Examples
Some examples not available in [http://downloads.sourceforge.net/sndobj/PySndObj.pdf?modtime=1169813301&big_mirror=0 the manual].
1 #simple synth with band limited noise, oscilators,
2 #and alternating L-R output
3 #any issue, contact renato.fabbri@gmail.com
4 #AND/OR contact SndObj mailing list
5
6 import sndobj
7 import time
8
9 tab = sndobj.HarmTable()
10 osc = sndobj.Oscili(tab, 440, 10000)
11 noise = sndobj.Randh(100000, 10000)
12
13 x=1
14 y=2
15
16 outp = sndobj.SndRTIO(2)
17 outp.SetOutput(x, osc)
18 outp.SetOutput(y, noise)
19
20 mod = sndobj.Oscili(tab, 2, 560)
21 osc.SetFreq(440,mod)
22
23 mod2=sndobj.Oscili(tab, 4, 50)
24 mod.SetFreq(2, mod2)
25
26 q=2
27 mod3 = sndobj.Oscili(tab, q, 1000)
28 noise.SetFreq(1000, mod3)
29
30 thread = sndobj.SndThread()
31 thread.AddObj(mod)
32 thread.AddObj(mod2)
33 thread.AddObj(mod3)
34 thread.AddObj(osc)
35 thread.AddObj(noise)
36 thread.AddObj(outp, sndobj.SNDIO_OUT)
37
38 thread.ProcOn()
39
40 n=0
41 while n < 8:
42 if x==1:
43 x=2
44 y=1
45 else:
46 x=1
47 y=2
48 outp.SetOutput(x, osc)
49 outp.SetOutput(y, noise)
50 time.sleep(1)
51 n +=1
52
53 thread.ProcOff()
2- (Write/paste your example here)