Re: [Sndobj-devel] Using SndBuffer from Python
Status: Abandoned
Brought to you by:
veplaini
From: Art B. <ac...@in...> - 2010-04-14 14:54:44
|
OK, back off the road and checking back on this project. Any insights, Daniel or anyone? A simple loop-through of realtime audio doesn't seem like an unreasonable thing to attempt. Am I simply doing something wrong in my code, or is there some reason SndObj actually can't do this? - Art On Apr 5, 2010, at 4/5/10 7:26 PM, Daniel Skinner wrote: > I dont think i've ever connected sndobj to multiple hardware interfaces before which would be my first guess as to what to start looking at. You may have already done this successfully in other cases and noticed its related to the use of SndBuffer, is this the case? > > I may try and play around with this out of curiosity tomorrow, feed the line in of my audio interface to the line out of my built-in audio card. > > On Mon, Apr 5, 2010 at 9:08 PM, Art Botterell <ac...@in...> wrote: > Obviously I'm doing something wrong. I'm a SndObj newbie and a Python-only chap to boot. But I'm trying to get a simple buffered audio-in to audio-out loop to work... and apparently it's not quite as simple as I am. So I'm reaching out for guidance. > > I can substitute an Oscil for the SndRTIO and SndIn and I get a tone out, but somehow feeding the SndBuffer from the realtime input isn't the same. The following runs ok for the prescribed ten seconds, but I hear nothing coming out. > > #!/usr/bin/python > ##################################### > # Testing soundcard loopback > # (this doesn't work) > > import sndobj > import time > > # set all to 16-bit (thanks Daniel Skinner) > vec = 2**16 > > snd = sndobj.SndObj() > > # Set up the input thread to fill a buffer from soundcard input > inThread = sndobj.SndThread() > inp = sndobj.SndRTIO(1, sndobj.SND_INPUT, 512, 4, sndobj.SHORTSAM_LE, snd.GetInput(), vec, sndobj.DEF_SR, 'plughw:1,0') > sndin = sndobj.SndIn(inp, 1, vec) > inBuf = sndobj.SndBuffer(1,512) > inBuf.SetOutput(1, sndin) > inThread.AddObj(sndin) > inThread.AddObj(inBuf, sndobj.SNDIO_OUT) > > # Set up the output thread to play from the buffer over another soundcard output > outThread = sndobj.SndRTThread() > sound = sndobj.SndIn(inBuf) > outp = sndobj.SndRTIO(1, sndobj.SND_OUTPUT, 512, 4, sndobj.SHORTSAM_LE, snd.GetInput(), vec, sndobj.DEF_SR, 'plughw:0,0') > outp.SetOutput(1, sound) > outThread.AddObj(inBuf, sndobj.SNDIO_IN) > outThread.AddObj(sound) > outThread.AddObj(outp, sndobj.SNDIO_OUT) > > # Run both threads for ten seconds > inThread.ProcOn() > outThread.ProcOn() > time.sleep(10) > outThread.ProcOff() > inThread.ProcOff() > > ### EOF > > Thanks in advance for any light that can shine on this! > > - Art > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Sndobj-devel mailing list > Snd...@li... > https://lists.sourceforge.net/lists/listinfo/sndobj-devel > |