Re: Beep ( frequency, duration)
Re: Beep ( frequency, duration)
- Subject: Re: Beep ( frequency, duration)
- From: Wim Lewis <email@hidden>
- Date: Mon, 29 Dec 2014 13:14:09 -0800
On Dec 29, 2014, at 2:12 AM, Michael Crawford <email@hidden> wrote:
> for ( int i = 0; i < inNumberFrames; ++i ){
> *sample++ = sin( twoPi * ( now / 100.0 ) );
> now += 1.0;
> }
Depending on what your overall goal is, it might be easier to use the software MIDI synthesizer instead of computing the samples yourself— if you want a bandlimited start and end, or even a music-like attack/decay/release envelope or a spectrum more complicated than a pure sine wave, using something like the AVMIDIPlayer class might free you from a bunch of realtime requirements and bookkeeping.
(On the other hand, I’ve never tried using it, so I don’t know if its simple API hides a well of frustration.)
_______________________________________________
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