Re: [Sndobj-devel] Python SNdIO /Core Audio SetSr
Status: Abandoned
Brought to you by:
veplaini
From: Edward H. <ed....@gm...> - 2007-08-10 20:41:05
|
Problem is the constructor still expects 8 args not the 7 you suggest I introduced the sndobj.SND_OUTPUT argument to provide the 8th. I think this is a prototyping issue in SWIG though my close familiarity with SWIG predates the C++ extensions. However I note the the cpp source constructor is SndCoreAudio::SndCoreAudio(int channels,int bufframes, int buffnos, float norm, SndObj** inObjs, UInt32 dev, int vecsize, float sr) i.e. 8 args the 6th being the device. The python traceback remains as follows irrespective of whether 7 or 8 args are provided or whether sndobj.SND_OUTPUT or a python int is passed. File "aif.py", line 20, in <module> outp = sndobj.SndCoreAudio(2, 512, 4, 32767.0, objsp, 256, 22050.0) #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() I suspect that the constructor is looking for a C++ Uint32 in the 6th argument but where to pick an appropriate one from? if sndobj.DEF_DEV is substituted for the 6th arg the following traceback is obtained: 22050.0 256 which is reasonable enough as this is another function reference. Python(620,0xa000d000) malloc: *** Deallocation of a pointer not malloced: 0x613158; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug Python(620,0xa000d000) malloc: *** Deallocation of a pointer not malloced: 0x709458; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug Python(620,0xa000d000) malloc: *** Deallocation of a pointer not malloced: 0x7bdcf0; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug I can't see anything obvious in SndCoreAudio.h or AudioDefs.i Ed On 8/10/07, Victor Lazzarini <vic...@nu...> wrote: > 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 > > > > |