audio library callback, timers, integrating a timeline and/or musical-grid...

Status
Not open for further replies.
Hello,
I'm interested in developing a sample-accurate musical-grid and timeline.

I'm generally trying to inform the timeline of the audio sample position, relative to each block/buffer of samples, not in free-running absolute time, but stuff like a play/record "head", and the general syncing of the timeline to audio samples passing, for example if there was a playlist of audio "clips" to play from given times on a timeline (musical time but this can be reduced to sample counts at this level/layer)

Additionally, I thought that I would ask thoughts/advice on how best to integrate the passage of time streaming audio with some time data structures.
Any additional ideas are, of course, welcome.

Am I confusing things that don't need to be related?

I had thought of starting by incrementing a counter with each sample number upon the audio callback, but I can't seem to find it yet. (the audio callback, or is there one defined in each audio I/O hw interface? i.e. input_i2s.cpp and it's DMA setup, which presumably arranges the audio engine state machine for starting?)

I'm generally a bit confused as to the state-machine of audio playback and/or recording, and if there is any higher level callback I didn't see one yet, so I can only presume that it's just the DMA pulling the interrupt? or?


I guess I'm generally fishing for high-level overview of the internals of the audio library and pulling the usual forum tricks...
(wasting a bit of your time to save me more time, selfish me, well, it will help other people and/or posterity I suppose, that's my excuse...)

The docs are great as far as the consuming API goes.
 
Last edited:
The audio library is interrupt driven in units of blocks, not individual samples. Out of the box its 128 sample
blocks at 44100 SPS, so about 3ms between interrupts. The library auto-configures one of the DACs or ADCs
as the interrupt source, and this drives the complete pipeline.

Inserting samples is done with the AudioPlayQueue (or AudioPlayMemory) classes as I understand it. The output
device will be driving the interrupts in this scenario, your code has to keep checking for when to queue up more
samples.

Have a look at the design tool for the library, which has documentation, and there's some web pages and a
video too.
 
Status
Not open for further replies.
Back
Top