views:

158

answers:

4

Okay this one may be a bit out from left field, but I'm going to try anyways.

A pad is a sort of ambient electronic sound that kind of 'hums'. Something like this .

How can I produce this in code? Using either Processing, OpenFrameworks, C, Objective-C or C++. Keep in mind I haven't been programming for that long.

I will be very impressed if this results in an answer!

Okay... Go!

+4  A: 

I've never heard the term "pad" as applied here, but it sounds like a synth organ sound, playing major chords.

As a start, to represent a single note, you could generate sin waves at the fundamental frequency of the note (say 440Hz if we're talking about an A Major) and the next few multiples of that (880, 1760, 3520) and sum them with some (diminishing) weights. Then add in the other notes of the chord (C# and E) rendered in the same way.

If this is sounding useful to you so far, I can expand if needed.

EDIT: By "some (diminishing) weights", I meant adding the overtones times some amplification, e.g.

F = 440;  // Hz
tone[t] = A * sin(t/F) + B * sin(t/(2*F)) + C * sin(t/(3*F)); // + etc, perhaps

where, perhaps,

A = 1.0;
B = 1.0/2.0;
C = 1.0/3.0;

or some such thing.

For an ADSR filter (look that up), you'll multiply the generated waveform by an amplification that increases from 0 to 1 during the "attack" period you choose, then drops during the "decay" period to some number you choose (perhaps 0.7), then drops to 0 linearly when you "release" the sustained note.

For echo/reverb, you can add the waveform back into itself with some delay, e.g.

D = 4410;  // 10 msec at 44.1 kHz., as an example value
tone[t] += 0.5 * tone[t-D];
Grumdrig
Yes, this is useful. I've already implemented it in processing and it is starting to sound good. A couple of things: 1. What do you mean by 'some diminishing weights'? 2. I've heard that long attacks, release phases and loud delay can also help, but don't know where to start on that programmatically. Any advice?
Eric Brotto
+2  A: 

I can't help you out with concrete code examples, but I'd say something akin to this sound sample of yours could be done with FM (Frequency Modulation) synthesis.

Before you write any code, you might want to download any software FM synthesizer from the internet (there are many freely available, some as standalone applications, some as VST plug-ins) and experiment a little, and if you can produce the sound you want, write the corresponding code. (By that time, chances are that you will know what combination of oscillators, frequencies etc. you need.)

stakx
+2  A: 

If you are not expereianced in sound programming, you should imho take a look at java sound, since its really easy to learn and use. I know you have tagged C* but i don't know if there is such a easy API or so.

Creating a sound is basiclly what grumdrig said, you "Just" have to combine differnt waves in such a manner that you like the sound. ;-)

InsertNickHere
+4  A: 

There's explaination of pad synthesis:

http://zynaddsubfx.sourceforge.net/doc/PADsynth/PADsynth.htm

el.pescado