Re: [Sndobj-devel] Python SNdIO /Core Audio SetSr
Status: Abandoned
Brought to you by:
veplaini
From: Victor L. <vic...@nu...> - 2007-08-09 19:56:41
|
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 |