[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] python->OSC->scsynth



Hello;
 
I try to make a simple test for control scsynth from supercollider, but i hear nothing:
 
[code]
 
[Supercollider SynthDef:]
 

(

SynthDef("sinecdote", { arg freq= 440;

Out.ar(0, SinOsc.ar(freq))

}).store

)

[Python code:]

import osc

import subprocess

import time

import os, sys

import random

path = os.path.dirname(sys.argv[0])

pathname = os.path.abspath(path)

subprocess.Popen("scsynth -u 57110", shell=True)

time.sleep(1)

osc.init()

osc.sendMsg("/d_load", ["%s/synthdefs/sinecdote.scsyndef" %(pathname)], "127.0.0.1", 57110)

osc.sendMsg("/s_new", ["sinecdote","1000"], "127.0.0.1", 57110)

osc.sendMsg("/n_run", ["1000", "1"], "127.0.0.1", 57110)

time.sleep(1)

for i in range(10):

     time.sleep(1)

     rate = random.uniform(100.0, 400.0)

     print i,":",rate

     osc.sendMsg("/n_set", ["1000", "freq", "%s" %(rate)], "127.0.0.1", 57110)

time.sleep(5)

osc.sendMsg("/quit", [], "127.0.0.1", 57110)

[\end code]

I work in a linux machine with sudo permissions, where is the problem?

Thanks...