Re: Beep ( frequency, duration)
Re: Beep ( frequency, duration)
- Subject: Re: Beep ( frequency, duration)
- From: Michael Crawford <email@hidden>
- Date: Mon, 29 Dec 2014 14:12:07 -0800
> Depending on what your overall goal is
In this particular case, all I wanted was to learn how to spit audio
samples directly into the sound driver.
My input does come from another thread, reading ogg vorbis, flac, wave
or mp3 files that write into a circular buffer. When the buffer is
full a mutex blocks the input thread; when the buffer is empty it
feeds silence - zeros - into the sound driver.
Michael David Crawford, Consulting Software Engineer
email@hidden
http://www.warplife.com/mdc/
Available for Software Development in the Portland, Oregon Metropolitan
Area.
On Mon, Dec 29, 2014 at 1:14 PM, Wim Lewis <email@hidden> wrote:
>
> 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
_______________________________________________
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