[linux-audio-user] Python and Jack

Cesare Marilungo cesare at poeticstudios.com
Thu Dec 7 13:37:03 EST 2006


Renato Fabbri wrote:
> Hi all,
>
> I am trying to output some audio through jack using the sndobj library. I get only a short beep..
>
> Usind the sndobj library on python, pysndobj, here is a simple case of what, in my head, should output a left channel sinusoid for 3s:
>
> ___
> from sndobj import *
> import time
>
> tab = HarmTable()
> osc = Oscili(tab, 440,16000)
>
> jack = SndJackIO('theremin')
>
> jack.SetOutput(1, osc)
>
> osc.DoProcess()
>
> jack.Write()
>
> time.sleep(3)
>
> del jack
> del osc
>
> _________
>
> help?
> renf
>   
Ciao Renato,

your code doesn't work here, either.

I think you should use a thread, like it's explained in the SndOsc manual.

Here's a modified version of your code. I've tested it and it works:

from sndobj import *
import time

tab = HarmTable()
osc = Oscili(tab, 440,16000)

jack = SndJackIO('theremin')
jack.SetOutput(1, osc)

thread = SndThread()
thread.AddObj(osc)
thread.AddObj(jack, SNDIO_OUT)

thread.ProcOn()
time.sleep(3)
thread.ProcOff()


Ciao,

c.

-- 
http://www.cesaremarilungo.com




More information about the Linux-audio-user mailing list