Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Audio programming basics

$
0
0

@davidspry wrote:

Recently I wrote an app using OF to sequence MIDI notes. It synchronises with an external clock (from Live, Logic, etc.) and broadcasts MIDI notes. Here’s a video of it being used.

However, I’d like to be able to generate the clock and some simple instruments internally, so I’m working on another sequencer with those goals in mind.

To generate a clock I’m simply counting the number of samples that are written to the audio buffer during the audioOut callback, which seems to work well. If there is a better way to do this, please tell me.

Generating audio for notes, on the other hand, seems quite tricky. I’m sure that generating a sine wave with an ADSR envelope will be easy to do on its own, but I’m struggling to imagine how my program should be laid out such that the sequencer can be queried during each audio callback and the appropriate n-samples array can be computed. If a note has a long decay, for instance, how can I continually write the decay to the buffer after the playhead has passed the note?

I’ve been looking at ofxPDSP and SoundBox to try to work out how this sort of thing is done, but I’m still confused, and given that this is a fairly niche subject, it’s tricky to find the answers to these question online. I would greatly appreciate it if someone could point me in the right direction!

Thank you.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles