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!
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.
where, perhaps,
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.