9

I've searched the net but didn't found anything interesting. Maybe I'm doing something wrong.

I'm looking for sound synthesis API written on C, C++ or even Objective-C, which can synthesize different types of waves, effects are optional.

Tadas S's user avatar

Tadas S

1,97119 silver badges33 bronze badges

asked Aug 10, 2009 at 10:50

totocaster's user avatar

11

Here's a complete library/toolkit for FM (Frequency Modulation) synthesis:

link1 link2

If you have time to spare... creating simple sound synthesis from scratch is actually a fun endeavor. If you create a small buffer of 256 16 bit samples which represent either a sine. a sawtooth, block or pulse, you can copy these to a live audiobuffer (e.g. a small buffer (say 16kb)) which constantly loops. By staying ahead of the playposition, and constantly filling up the buffer with new values, you can create the soundoutput. You can use the small buffers to combine these in interesting ways (simplest is just to add them together (additive synthesis)).

The frequency of the tone can be manipulated by using a bigger or smaller sampling step through the small buffers. Amplitude can be manipulated by scaling the samples before putting them into the output buffer.

Great fun experimenting with this!

If you have this step nailed, you can add more sophisticated effects like filters (low pass, high pass, etc) and effects (reverbs, echoes, etc)

R

paulm's user avatar

paulm

5,9829 gold badges53 silver badges76 bronze badges

answered Aug 10, 2009 at 11:12

Toad's user avatar

Comments

5

Have you looked at the synthesis toolkit (STK)? It's in C++ (I don't think ObjC is the right language for audio synthesis, in fact audio units, Apple's own way of doing audio stuff, including generators/filters/effects... is in C++).

STK will run on Mac OS X, and iOS no problem (CoreAudio is supported), but will also run on Linux and Windows (Direct sound and ASIO), using RtAudio. It's really nicely done and lightweight, these guys have spent a lot of time thinking about it and it will definitely give you a big head start. It can handle loads of different audio file formats + midi (and hopefully OSC soon...).

There is also Create and CLAM which is huge, these include GUI components and many other things which you might or might not want. If you're only interested in doing sound synthesis I really recommend STK.

answered Oct 3, 2011 at 14:42

jbat100's user avatar

3 Comments

Is there a way to create an instrument with this that has a tick() which works on raw wav data/samples?

thanks, it looks like it can just be a case of populating STK frames from raw audio data :)

5

PortAudio is also a great C API that we used last semester in an audio programming course. It provides an audio callback...what more could you need!?

I haven't tried incorporating it with anything in Objective-C yet, but will report back when I do.

answered Feb 1, 2012 at 20:18

manderson's user avatar

Comments

3

Writing audio synthesis algorithms in C/obj-C is quite difficult in my opinion. I would recommend writing your signal processing algorithms using PureData and then use ZenGarden or libpd to embed and interpret the pd patches in your app.

Edit in 2024: Look for C++ libraries as others suggest in their answers, predata code is difficult to maintain, difficult to integrate with version control, and difficult to debug or optimize once the graphical abstraction is not enough.

answered Aug 29, 2011 at 14:40

Rafael Vega's user avatar

Rafael Vega

4,6555 gold badges35 silver badges51 bronze badges

Comments

2

Another C++ library is nsound:

http://nsound.sourceforge.net

One can generate any kind of modulated signal using the Generator class or using the provided Sine class. Each time-step can have it's own instantaneous frequency and phase offset.

You can also experiment with the Python module to prototype your algorithm quickly, then implement in C++. It can produce pretty matplotlib plots from Python and even from C++!

answered Mar 30, 2012 at 18:10

Nick's user avatar

Nick

2,45230 silver badges25 bronze badges

Comments

0

Have you looked at CSound? It's an incredibly flexible audio generation platform, and can handle everything from simple waveform generation to FM synthesis and all kinds of filters. It also provides MIDI support, and you can extend it by writing custom opcodes. There's a full C API and several C++ APIs as well.

answered Aug 10, 2009 at 11:27

Meredith L. Patterson's user avatar

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.