[LAD] writing a bpm counter with (or without) ALSA

Arnold Krille arnold at arnoldarts.de
Sun Sep 26 21:24:35 UTC 2010


I think the answer belongs to the list. Maybe others will correct me...

On Sunday 26 September 2010 12:04:17 you wrote:
> Hi Arnold, your hint is a very revelation to me! I have spent the night
> thinking about it and now I have a question: if I drive the beat counter
> via the sampling-clock (you mean the internal clock of the sound card,
> right?) and the alsa process is in a blocking mode, the audio-thread
> become itself a sort of metronome where a chunk of data is a single tick,
> doesn't it?

The audio-thread becomes the metronome. But don't mix the chunks of data with 
the tick of your bars:beats:ticks.
You get block of samples from the device (to write to or read from), you know 
what samplingrate you use, you know how many samples you already processed. 
From that you calculate your clock.


BTW: It sounds as if you are just beginning to write audio-apps: Start with 
jack, its api for clients is easier then alsa's. At least that what I'm told, 
I never used the alsa-api. 
Another advantage of jack is that you get the global jack-transport for free. 
Which means your sampler/looper will sync with your other soft-synths and with 
your recording app.

Have fun,

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20100926/9f6bbce1/attachment.pgp>


More information about the Linux-audio-dev mailing list