Revision 11 as of 2007-11-28 10:29:06

Clear message

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)

Unable to edit the page? See the FrontPage for instructions.