| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Most information on this page is either plain wrong or dangerous half-truth. It is retained because it serves as a bad example i n Ross Bencina's excellent article http://www.rossbencina.com/code/real-time-audio-programming-101-time-waits-for-nothing.
This page discusses the theory of real time sound processing: latency, buffer sizes and process callback model.
This page is intended for you if:
The theory is not Jack specific and can be applied to other real time processing too (video for example).
When you process sound using Jack then your program will work in callback mode. That means you don't open a processing thread but your code will be called on Jack's own processing thread. Effects must do processing on the callback method provided by the effect:
int process(jack_nframes_t nframes, void *arg);
This way the processing latency will be the possible minimum.
Small latency is important when using Jack to host a MIDI instrument or an audio effect of a guitar for example. If latency is too big, the sound will come out of the system decades after the musician has hit the string of the guitar.
If the synchronous data flow can not be achieved because a processing step does not finish in time then the output buffer of line-out will become empty. So some silence or random samples will be sent to the D/A converter. Both are recognized as noise when amplified...
Processing audio data with a line in, two plugins and a line out happens this way:
Jack system works in periods. In each period it processes a fixed size buffer full of data.
Let's say the length of buffer in samples is N ant the time of a buffer is T. Each period processes N samples and the periods start when the input buffer is filled by data after sampling input for T.
The latency of this system is built from the following factors:
| Back | FazBrowse Home | New Git URL |