Re: Beep ( frequency, duration)
Re: Beep ( frequency, duration)
- Subject: Re: Beep ( frequency, duration)
- From: Jens Alfke <email@hidden>
- Date: Sun, 28 Dec 2014 12:56:29 -0800
> On Dec 28, 2014, at 12:05 PM, Raglan T. Tiger <email@hidden> wrote:
>
> Is it possible with Cocoa to generate a tone of a specified frequency and duration to play synchronously?
You might be able to do this with AVFoundation, or you may need to descend to the C-based CoreAudio APIs.
I don't think there's any built-in frequency generator component … and in any case you haven't specified what waveform you want — sine? square? sawtooth? triangle? You'll probably want to create a "wavetable" (an array of samples that contains one complete cycle of the waveform), import that as an audio source, and then play it as a loop.
In any case, fasten your seat belt and prepare for some turbulence. I've found Apple's audio APIs to be the second most difficult and frustrating ones to work with on the platform (after crypto/security.)
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden