Re: [Sndobj-devel] Python SNdIO /Core Audio SetSr
Status: Abandoned
Brought to you by:
veplaini
From: Victor L. <vic...@nu...> - 2007-08-10 18:46:17
|
Try outp = sndobj.SndCoreAudio(2, 512, 4, 32767.0, objsp ,256, 22050.0) There is no sndobj.SND_OUTPUT argument for SndCoreAudio (it always opens full-duplex). Victor > > Thanks for the pointer to the solution however > > now I've removed the constructor > > outp = sndobj.SndCoreAudio() > > and after constructing aif1,aif2 replaced it with > > objs[0]=aif1 > objs[1]=aif2 > objsp = objs.cast() > outp = sndobj.SndCoreAudio(2, 512, 4, 32767.0, objsp) > which as expected still produces output at the wrong > sampling rate however if I extend this to > outp = sndobj.SndCoreAudio(2, 512, 4, 32767.0, objsp , > sndobj.SND_OUTPUT, 256, 22050) > or > outp = sndobj.SndCoreAudio(2, 512, 4, 32767.0, objsp , 1) > or variants in between I get tracebacks similar to this > > File "aif.py", line 20, in <module> > outp = sndobj.SndCoreAudio(2, 512, 4, 32767.0, objsp, > 1) #, 256, 22050) #wrong args number > File "/Users/edh/Contracts/StAndrews_1/sndobj/sndobj.py" > , line 2803, in __init__ > this = _sndobj.new_SndCoreAudio(*args) > NotImplementedError: Wrong number of arguments for > overloaded function 'new_SndCoreAudio'. > Possible C/C++ prototypes are: > SndCoreAudio(int,int,int,float,SndObj **,UInt32,int > ,float) > SndCoreAudio(int,int,int,float,SndObj **,UInt32,int) > SndCoreAudio(int,int,int,float,SndObj **,UInt32) > SndCoreAudio(int,int,int,float,SndObj **) > SndCoreAudio(int,int,int,float) > SndCoreAudio(int,int,int) > SndCoreAudio(int,int) > SndCoreAudio(int) > SndCoreAudio() > > Best > Ed > > On 8/9/07, Victor Lazzarini <vic...@nu...> > > wrote: You will need to set the SR on all objects > > to 22050. It is generally the last argument > > (which defaults to 44100) of each object. You > > have done it with all SndObjs, but it looks > > like you left the SndCoreAudio to its default. > > You need to create it with the right SR. > > > > Victor > > > > > > > > Hi > > > I've been tinkering with PySndObj on the Mac . > > > BTW it built out of the box for python 2.5 with the > > > MacPython framework and appropriate build switches to > > > build the python wrapper. The examples work OK as does > > > the I have now got to the point where I'm able to > > > read an AIF file and providing it's a PCM file get it > > > to play back OK apart from when the sampling rate is > > > not the default 44100. In the case in question it is > > > 22050 but it plays back as if 44100. (Thanks BTW to > > > the wav file example post) I have tried the commented > > > options shown in the code below, I'm new to the API so > > > I'm not sure if this is a bug or I'm not setting the > > > sampling rate in the right place. So suggestions > > > welcomed. The example file is in the > > /Developer/Examples/Java/Sound source tree. > > > > import sndobj > > > fn = '22-new.aif' > > > #fn = 'sound.aif' > > > af = sndobj.SndAiff(fn,sndobj.READ,2) > > > sr = af.GetSr() > > > vs = af.GetVectorSize() > > > print sr,vs > > > T1 = sndobj.SndThread() > > > sndin = sndobj.SndIn(af,1) > > > outp = sndobj.SndCoreAudio() > > > aif1 = sndobj.SndIn(af,1) > > > #aif1 = sndobj.SndIn(af,1,vs,sr) > > > #aif1.SetSr(sr) > > > aif2 = sndobj.SndIn(af,2) > > > #aif2 = sndobj.SndIn(af,2, vs, sr) > > > #aif2.SetSr(sr) > > > outp.SetOutput(1,aif1) > > > outp.SetOutput(2,aif2) > > > T1.AddObj(af,sndobj.SNDIO_IN) > > > T1.AddObj(aif1) > > > T1.AddObj(aif2) > > > T1.AddObj(outp,sndobj.SNDIO_OUT) > > > T1.ProcOn() > > > time.sleep(5) > > > T1.ProcOff() > > > > > > TIA > > > Ed > > > > > > > > > > ---------------------------------------------------------- > > > --------------- This SF.net email is sponsored by: > Splunk Inc. Still grepping through log files to find > > > problems? Stop. Now Search log events and > > > configuration files using AJAX and a browser. Download > > > your FREE copy of Splunk now >> > > > http://get.splunk.com/ > > > _______________________________________________ > > > Sndobj-devel mailing list > > > Snd...@li... > https://lists.sourceforge.net/lists/listinfo/sndobj-devel > > |