cocoa - A simple way to generate tones / sine waves on mac? (ruby would be nice) -
I am writing a program that involves playing a combination of sign waves and sine waves ... it must be run on the Mac, And I'm looking for a Simple API that I can use. I am opening up for ObjC, C, C ++, Ruby, Python, etc. .... I do not care about that language unless it has some lines of code. But Ruby would be good: -)
You can write to Linux on / dev / dsp, / dev / sound, but not on Mac. I know how a sine wave arises, but the problem is getting PCM samples that I make in audio hardware. I know about example code / developer / example / core audio / simple SDK / default optup, but there are several hundred lines of this ridiculous core audio / audioUNIT code and I want to work with it easy.
is a method
import, array, mathematics P = Pyudio.PyAudio () Stream = P is to use. Open (rate = 44100, channel = 1, format = pyaudio.paFloat32, output = true) stream.write (array.array ('f', (for .25 * math.sin (i / 10.) (44100)). Tostring ()) stream.close () p.terminate ()
is not a very clean code, but it works
PyAudio Not standard, but available via easy_install (I used python2.5)
Comments
Post a Comment