SoundRecorder sampleRate on OS X

John M McIntosh johnmci at smalltalkconsulting.com
Fri Dec 10 23:41:58 UTC 2004


Well on a G5 they say:


The iMac G5 has a stereo audio line input jack on the back panel. The  
audio input is designed to accept audio signals with input levels  
ranging from 150mVRMS (-14.3dBu) to 3VRMS (+11.8dBu). The input gain  
should be set according to the input level so as not to clip the input  
to the A/D converter in the CODEC. Input gain control is supported over  
a range of –4dB to +20dB. The input gain control can be accessed using  
the Audio Midi Setup application included in the  
“Applications/Utilities” folder. The default input gain setting is 0dB,  
which will accommodate an input level of 2VRMS (+8.2dBu), which is the  
typical output level from CD players, DVD players and other consumer  
audio equipment. With an input gain setting of 20dB, the minimum  
recommended input level is 150mVRMS (-14.3dBu), which will correspond  
to 3dB below full-scale on the A/D converter in the CODEC.

	▪ 	Input Sample Rates: 32KHz, 44.1KHz, 48KHz, 64KHz, 88.2KHz, 96KHz
	▪ 	
Bits per Sample: 16 or 24


I'll consider poking at things on the weekend, perhaps the core audio  
stuff will make a difference.

On Dec 10, 2004, at 1:42 PM, Peter Moore wrote:

> 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
>> ====================================================================== 
>> ==
>> ===
>>
>>
>
>
>
--
======================================================================== 
===
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