#!/usr/bin/env python import audio_output import gtk import gobject import struct a = "" b = "" GC = None green = None red = None blue = None def calculate_beat(): global a global b a = audio_output.generate_sine_note(440, 5) b = audio_output.generate_sine_note(420, 5) #a = audio_output.generate_sine_note(530, 5) #b = audio_output.generate_sine_note(400, 5) return False def unpack_blurb(blurb): return [struct.unpack(" 30000: break def redraw(widget, event): redraw_blurb(widget, a, green) redraw_blurb(widget, b, red) redraw_blurb(widget, audio_output.mix([a, b]), blue) def allocate_colors(widget): global GC global red global green global blue GC = widget.window.new_gc() red = widget.get_colormap().alloc_color("#a00000") green = widget.get_colormap().alloc_color("#00a000") blue = widget.get_colormap().alloc_color("#0000a0") drawing_area_1 = gtk.DrawingArea() drawing_area_1.connect("expose-event", redraw) drawing_area_1.show() window_1 = gtk.Window() window_1.add(drawing_area_1) window_1.connect("delete-event", gtk.main_quit) window_1.connect("realize", allocate_colors) window_1.show_all() calculate_beat() audio_output.play_blurb(audio_output.mix([a, b])) gtk.main()