Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Synth linked to mouse movements

Hi,

I would like to build an experiment where the movements produce sounds.The frequency of the sound would vary according to vertical movements and some other dimension (maybe the volume ? If anyone has a better idea i'm listening) would vary according to horizontal movements.

Here is my first try :

from __future__ import division
from openexp.synth import synth
my_mouse = mouse()
my_mouse.show_cursor(show=True)
my_canvas = canvas()
start = clock.time()
while clock.time()-start <=10000:
        button, position, timestamp = my_mouse.get_click(timeout=20)
        while my_mouse.get_pressed() == (1,0,0):
            (x,y), time = my_mouse.get_pos()
            # freq from 100 to 900
            freq = (800 - (y + 400)) + 100
            # volume from 0.2 to 2.2
            volume = 0.2 + (x + 640)/320
            my_synth = synth(exp, freq=freq, length=50, attack=10)
            my_synth.volume = volume
            my_synth.stop()
            my_synth.play()
            #self.sleep(50)

Not very pleasant for the ears. Does anyone has an idea to make this better ?

Comments

Sign In or Register to comment.