ALSAseq and timing.
Hi, i'm trying to implement a proper timing control in a sequencer client implementation,
but i have a question not covered in the documentation. Basically, does alsalib or alsa
do any kind of timing conversion or something at the time of the event arrival?
what i mean is, basically my seq client app (a softsynth) has to to take care of _all_ kind of timings?
(direct/timestamp absolute and relative/tick), or does alsa proovide some method (for timing conversion or something) so i can easily parse those? This is basically so i can process audio in large blocks and sync properly with the audio being played, even if there is a certain latency. I checked out
some existing apps (timidity and iiwusynth) and none seem to bother about checking the time of
the event, so they'll screwup when using bigger audio buffersizes. Has this been ever implemented?
Thanks!
Juan Linietsky
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Re: ALSAseq and timing (and audio plugins)
Hi Juan,
the ALSA sequencer has for every queue internally a queue for events scheduled in absolute time and in tick/beats. According to the internal time reference the event is dispatched at the required (real) time.
For softsynth applications the events should be dispatched ahead of time (depending on the buffer size/latency in the synthesis application). At this moment there is no provision to register a listner with a negative pre-delay. A (feasable and logical) application workaround is to configure this pre-delay in the application generating the events (if known), or otherwise when the event is not known ahead it can't do better than 'play as soon as possible' anyhow.
If your synth works with a large buffer size you'll need to calculate the start of trigger from the timestamp in the event.
For better support of softsynths I'm thinking about a special hook in alsa-lib (userland) or jack/laspda where for the audio fragment/buffer an array with the alsa sequencer events is supplied.
The sample buffer (to be output) has:
- # number of samples
- channels, sample rate & other sample specific parameters
- start time of buffer
- end time of buffer
- array of events
The start & end time are needed to determine the current pitch the transport is doing (ie. to cope with varispeed) Playing the stream backwards would remain a big challange still..
Reality is that I'm very tight on my free time, so don't expect to see code soon....
Cheers,
Frank.
Quoted 33 lines · Juan Linietsky
Hi, i'm trying to implement a proper timing control in a sequencer client implementation,
but i have a question not covered in the documentation. Basically, does alsalib or alsa
do any kind of timing conversion or something at the time of the event arrival?
what i mean is, basically my seq client app (a softsynth) has to to take care of _all_ kind of timings?
(direct/timestamp absolute and relative/tick), or does alsa proovide some method (for timing conversion or something) so i can easily parse those? This is basically so i can process audio in large blocks and sync properly with the audio being played, even if there is a certain latency. I checked out
some existing apps (timidity and iiwusynth) and none seem to bother about checking the time of
the event, so they'll screwup when using bigger audio buffersizes. Has this been ever implemented?Thanks!
Juan Linietsky
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Signature · 11 lines
+---- --- -- - - - - | Frank van de Pol -o) A-L-S-A | [email protected] /\\ Sounds good! | http://www.alsa-project.org _\_v | Linux - Why use Windows if we have doors available? ------------------------------------------------------- This sf.net email is sponsored by: Dice - The leading online job board for high-tech professionals. Search and apply for tech jobs today! http://seeker.dice.com/seeker.epl?rel_code=31