SoundRecorder sampleRate on OS X

Peter Moore pmoore at software.umn.edu
Fri Dec 10 21:42:20 UTC 2004


Thanks for the quick reply John.

SoundRecorder>> initialize looks like this (I haven't made any changes):

initialize
	"SoundRecorder new"

	stereo _ false.
	samplingRate _ 11025.
	recordLevel _ 0.5.
	self initializeRecordingState.

If I place a halt in SoundRecorder>>startRecording and step through the
method, I can see that it passes the value 11025 to
SoundRecorder>>primStartRecordingDesiredSampleRate:stereo:semaIndex.

I can also see that after the call to
SoundRecorder>>primGetActualRecordingSampleRate the sampleRate has been
changed to 44100.0.

So yes, it does seem to get ignored and forced to the higher sampling
rate.

-Peter Moore


On Fri, 10 Dec 2004, John M McIntosh wrote:

> > primGetActualRecordingSampleRate
> calls snd_GetRecordingSampleRate
> which makes the OS call
> SPBGetDeviceInfo() with a parm of siSampleRate
> which flows back a float of the sampling rate the hardware is set to.
>
> Now
> primStartRecordingDesiredSampleRate: samplesPerSec stereo: stereoFlag
> semaIndex: anInteger
> 	"Start sound recording with the given stereo setting. Use a sampling
> rate as close to the desired rate as the underlying platform will
> support. If the given semaphore index is > 0, it is taken to be the
> index of a Semaphore in the external objects array to be signalled
> every time a recording buffer is filled."
>
> sets or attempts to set the sampling rate, via startRecording
>
> So what have you set samplingRate to, and does it get ignored and set
> to 44,100?
>
> Older operating systems OS-9 allowed you to set sampling rates via a
> control panel, but that's missing in os-x
>
> On Dec 10, 2004, at 1:02 PM, Peter Moore wrote:
>
> > Hi everyone,
> >
> > Why is the SoundRecorder limited to recording at a sample rate of
> > 44100 on
> > OS X? Setting samplingRate has no effect because it will get
> > overwritten
> > by the call to SoundRecorder>>primGetActualRecordingSampleRate (always
> > 44100).
> >
> > I'm trying to record voice data for streaming, so 44100 samples per
> > second
> > is way more data than I need. Is this a limitation of OS X itself?
> > Maybe
> > it's something that got carried over from previous versions of MacOS?
> > Or
> > is this something that I can configure somewhere in the OS?
> >
> >
> > -Peter Moore
> >
> >
> >
> --
> ========================================================================
> ===
> John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
> ========================================================================
> ===
>
>



More information about the Squeak-dev mailing list