• 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: Generation of a Waveform
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generation of a Waveform


  • Subject: Re: Generation of a Waveform
  • From: Doug Wyatt <email@hidden>
  • Date: Tue, 6 Dec 2005 07:03:11 -0800

On Dec 6, 2005, at 6:50, Linea Tessile srl wrote:
Hi people!

Does anybody know how create a waveform with a frequency of 5kHz and a period of 200µs ?

Thanks,
Alessandra


Here's how to generate a sine wave. From /Developer/Examples/ CoreAudio/SimpleSDK/DefaultOutputUnit/RenderSin.cpp:

double cycleLength = inSampleRate / frequency;

Float32 nextFloat = sin(j / cycleLength * (M_PI * 2.0)) * amplitude;

Frequency would be 5000. inSampleRate would typically be 44100 but could be something else depending on the hardware setting or if you're rendering to a file with a different sample rate.

amplitude is 0-1.

Doug



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Generation of a Waveform (From: Linea Tessile srl <email@hidden>)

  • Prev by Date: Generation of a Waveform
  • Next by Date: Re: +[NSData dataWithContentsOfURL:] leaks memory?
  • Previous by thread: Generation of a Waveform
  • Next by thread: NSLog and NSBezierPath etc...
  • Index(es):
    • Date
    • Thread