• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting sample rate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting sample rate


  • Subject: Re: Setting sample rate
  • From: Bill Stewart <email@hidden>
  • Date: Mon, 22 Jul 2002 17:34:07 -0700

on 7/22/02 3:08 PM, Tracy Lakin wrote:

> I have similar experience, although from Obj-C/C/C++.
>
> I wrote an audio file player in order to test the Audio Unit I wrote, as there
> is no other way to test. Well, the DAVE example program to a degree is
> worthwhile, but I needed to test with real world songs, not generated audio
> from MIDI.
>
> (ASIDE: DAVE needs the Jaguar Audio Frameworks to build, but once built, will
> run under 10.1.4/10.1.5. I've found it crash prone under Jaguar and 10.1.x.)

It needs the CoreAudio-Java that is in the Java Software Update of around
January this year... And will compile and build and run with that update
installed.

> I'm using the default audio output device. Setting its Stream Format away from
> 44.1k/float/Stereo does not seem to work. When you ask for the format after
> setting to other than 44.1k/float/Stereo, you get back the original
> 44.1k/float/Stereo. No error is reported, it just does not seem to take.

That's because builtin hardware only has stereo 44.1K. I'm not sure what
you're setting here - the device, the output unit - which scope...

> If you are going to use the converters, I would use AudioConverterFillBuffer
> and not AudioConverterConvertBuffer. I was not able to get
> AudioConverterConvertBuffer to work. I believe others have posted similar
> results to this list.
>
> I recommend using the "standard" format of 44.1k/float throughout your audio
> chain. This seems to work well. I am converting manually, though, in my Audio
> Unit, from AIFF files to this standard format. This ended up being the easiest
> to get working and maintain, while keeping up performance.
>
> Caveats:
> Since I'm writing the player only to demo and test my Audio Unit, I just kept
> trying things until they worked. That is, I was focused on getting a demo
> program "good enough," so I'm not doing extensive testing on the Audio calls.
>
> Also, I'm developing under 10.1.5, started on 10.1.4. I gave up on the WWDC
> Jaguar seed, as it was too unreliable (for me, anyway). I have not received
> any seeds past that one, so I can't speak for fixes in Jaguar.

Nor should you be:) Jaguar seeds, including the WWDC one, are done under NDA

Bill

> Tracy
>
> Tracy Lakin
> Senior Software Engineer
> www.octiv.com
>
>
>> -----Original Message-----
>> From: Albert Russel [mailto:email@hidden]
>> Sent: Monday, July 22, 2002 12:24 AM
>> To: email@hidden
>> Subject: Setting sample rate
>>
>>
>> Somehow I can not set the device properties with
>> AudioDeviceSetProperty. I
>> keep getting the kAUdioDeviceUnsupportedFormatError, anyone
>> here with more
>> succes and some code samples? This did not work:
>>
>> count = sizeof(deviceFormat);
>> err = AudioDeviceGetProperty(device, 0, false,
>> kAudioDevicePropertyStreamFormat, &count, &deviceFormat);
>> if (err != kAudioHardwareNoError) {
>> fprintf(stderr, "OSXAudio: get
>> kAudioDevicePropertyStreamFormat error
>> %ld\n", err);
>> return;
>> } else if (deviceFormat.mFormatID != kAudioFormatLinearPCM) {
>> fprintf(stderr, "OSXAudio: mFormatID != kAudioFormatLinearPCM\n");
>> return;
>> }
>>
>> deviceFormat.mSampleRate = 8000;
>> deviceFormat.mChannelsPerFrame = 2;
>> deviceFormat.mBytesPerPacket = 8;
>> deviceFormat.mFramesPerPacket = 1;
>> deviceFormat.mBytesPerFrame = 8;
>> deviceFormat.mBitsPerChannel = 32;
>>
>> count = sizeof(deviceFormat);
>> err = AudioDeviceSetProperty(device, 0, 0, 0,
>> kAudioDevicePropertyStreamFormat, count, &deviceFormat);
>> if (err != kAudioHardwareNoError) {
>> fprintf(stderr, "OSXAudio: set
>> kAudioDevicePropertyStreamFormat error
>> %ld\n", err);
>> return;
>> }
>>
>>
>> If I change the SampleRate to 44100 it works fine.
>>
>> I would be happy if I could get my hands on more
>> documentation than Apple's
>> "Audio and MIDI on Mac OS X". Also the famous sine wave
>> sample code does not
>> help me for this problem.
>> _______________________________________________
>> coreaudio-api mailing list | email@hidden
>> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/coreaudio-api
> Do not post admin requests to the list. They will be ignored.
> _______________________________________________
> coreaudio-api mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/coreaudio-api
> Do not post admin requests to the list. They will be ignored.


mailto:email@hidden
tel: +1 408 974 4056
__________________________________________________________________________
"Thousands of years ago, cats were worshipped as gods. We have never
forgotten this."
__________________________________________________________________________
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

References: 
 >RE: Setting sample rate (From: "Tracy Lakin" <email@hidden>)

  • Prev by Date: RE: Setting sample rate
  • Next by Date: Re: Sample rate conversion of audio input device
  • Previous by thread: RE: Setting sample rate
  • Next by thread: MIDI data with timestamps in the future?
  • Index(es):
    • Date
    • Thread