Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/playfile.activity/synth.py
blob: d70d1c951350b02c2d57d4047017c89eaa23831b (plain)
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
# (c) Victor Lazzarini, 2008
#  Free software, licensed by GNU General Public License

import csndsugui
from sugar.activity import activity


class Synth(activity.Activity):

 def __init__(self, handle):
   activity.Activity.__init__(self, handle)    

   # colours
   bg  = (0x9000,0,0)
   fr  = (0x1000, 0x0000, 0x7000)

   # GUI window               
   win = csndsugui.CsoundGUI(self,bg)
   win.csd("synth.csd")
   txt = win.text("Synthesizer Panel",colour=fr)
   hbox = win.box(False)

   # oscillator frames
   box = win.box(parent=hbox)
   box1 = win.box(False, box)
   box2 = win.box(False, box)
   frame1 = win.framebox("osc 1", False, box1, fr)
   frame2 = win.framebox("osc 2", False, box2, fr)

   # oscillator 1 controls
   box = win.box(parent=frame1)
   win.button(box,"osc1")
   box = win.box(parent=frame1)
   win.slider(1.0,0.25,4.0,45,100,box,"pitch1", linear=False) 

   # oscillator 2 controls
   box = win.box(parent=frame2)
   win.button(box,"osc2")
   box = win.box(parent=frame2)
   win.slider(1.0,0.25,4.0,45,100,box,"pitch2", linear=False) 

   # filter & mixer frames
   box = win.box(parent=hbox)
   box1 = win.box(False, box)
   box2 = win.box(False, box)
   frame1 = win.framebox("filter", True, box1, fr)
   frame2 = win.framebox("mixer", False, box2, fr)

   # filter controls
   box = win.box(False, parent=frame1)
   win.slider(1000.0,20.0,20000.0,120,20,box,"frequency", False,linear=False)
   box = win.box(False, parent=frame1)
   win.slider(0.9,0.0,1.0,120,20,box,"resonance", False)

   # mixer controls
   box = win.box(parent=frame2)
   win.slider(0.0,0.0,100.0,45,180,box,"vol1") 
   box = win.box(parent=frame2)
   win.slider(0.0,0.0,100.0,45,180,box,"vol2") 
   box = win.box(parent=frame2)
   win.slider(0.0,0.0,100.0,45,180,box,"noise") 
   box = win.box(parent=frame2)
   win.slider(0.0,0.0,100.0,45,180,box,"mic") 

   win.play()