• 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: Simple wave generating?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple wave generating?


  • Subject: Re: Simple wave generating?
  • From: Urs Heckmann <email@hidden>
  • Date: Wed, 28 Jan 2004 14:21:28 +0100

Hi Joost,

try this:

float phase += frequency/samplerate; // frequency i.e 440.0f, samplerate i.e. 48000.f

if ( phase >= 1.f ) phase -= 1.f;

float sinOutput = sin( 2.0f * PI * phase ); // PI = 3.14....
float sawOutput = 2.f * phase - 1.f;


where phase must be stored globally somewhere (not reinitialized each iteration)...

more sophisticated stuff: www.musicdsp.org

Cheers,

;) Urs

Am Mittwoch, 28.01.04, um 13:57 Uhr (Europe/Berlin) schrieb Joost Markerink:

Hello,
I'm sorry for the stupid question(newBee), but...

Is there an easy way (one/two liner) to generate a saw/sine wave with of a specific frequency?
(Cocoa developer tries to do C tricks)

Joost Markerink
email@hidden
_______________________________________________
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.

References: 
 >Simple wave generating? (From: Joost Markerink <email@hidden>)

  • Prev by Date: Simple wave generating?
  • Next by Date: Re: Streaming OS X audio over network
  • Previous by thread: Simple wave generating?
  • Next by thread: Re: Using NSMutableData for an audio buffer?
  • Index(es):
    • Date
    • Thread