[sdiy] New to list - and DSP development

Ryan Williams destrukto at cox.net
Mon Nov 29 08:47:16 CET 2004


Kenneth Elhardt wrote:
> 3)  If anybody has any soft synth programming experience, what is the normal
> way to keep a softsynth generating data at 44.1KHz.  Since Mac's and PC's
> usually only have 1ms clocks it's not like I can sync up to a 44.1KHz clock.
> Do you simply wait for the current sound buffer to finish playing and that
> acts as your limit?  Or do you set up some kind of 44.1KHz interrupt?  Or is
> there some other better way?

I have a small amount of experience writing soft synths for a PC but I 
think it should be about the same on the mac.  I use PortAudio for C or 
RtAudio for C++. those are pretty nice multiplatform audio APIs that 
will handle all of the sound card interfacing for you. basically you 
initialize the sound driver, set sample rate, buffer size, and specify a 
call back funtion. your callback will provide you with a buffer to fill 
when it's ready for more data.

http://www.portaudio.com/
http://www.music.mcgill.ca/~gary/rtaudio/

> 4)  Also I assume I generate sound in one buffer while another plays.  On
> the Mac it's possible to jump to a call back routine when the buffer
> finishes playing.  Is that the method used to switch to the 2nd buffer to
> start playing and is that fast enough so no glitches occur?

I'm not exactly sure what happens underneath those APIs above but the 
sources should give you a good example of how it's done.

> Thanks for any tips.  I hope this isn't too far off topic, but it's part of
> the initial process of getting out products that are more on topic.
> 
> -Elhardt
> 
> 

ryan



More information about the Synth-diy mailing list