[ecasound] Bug in db system (Possible cause of sync problems)

New Message Reply Date view Thread view Subject view Author view Other groups

Subject: [ecasound] Bug in db system (Possible cause of sync problems)
From: S. Massy (theanaloguekid@tak.net.dhis.org)
Date: Fri Jun 08 2001 - 04:11:42 EEST


Ok, I have found a bug in the double-buffering system that might also
be the cause of the sync problems when doing multi-track recording
Kai mentioned some time ago. It would appear that the current
position in the file is the one up to which the stream has been
buffered and not up to what has been processed, this triggers an
inconsistency between the current position in the cs and the current
position in the file. But an example will speak more clearly:

$ ecasound -i:cdda.wav -o:alsa,sbl -c -z:db
****************************************************************************
* ecasound v2.0.1 (C) 1997-2001 Kai Vehmanen *
****************************************************************************
(eca-session) Interactive mode enabled.
(eca-chainsetup) Using double-buffer of 100000 sample frames.
- [ Chainsetup/Enabling audio inputs ] -------------------------------------
(eca-audio-objects) Audio object "cdda.wav", mode "read".
(audio-io) Format: s16_le, channels 2, srate 44100, interleaved.
- [ Chainsetup/Enabling audio outputs ] ------------------------------------
(eca-audio-objects) Audio object "alsa", mode "write".
(audio-io) Format: s16_le, channels 2, srate 44100, interleaved.
ecasound ('h' for help)> getpos
0.000
ecasound ('h' for help)> ai-select cdda.wav
ecasound ('h' for help)> ai-getpos
0.000
ecasound ('h' for help)> t
- [ Controller/Processing started ] ----------------------------------------
ecasound ('h' for help)> - [ Engine/Init - mixmode "simple" ] ------------------
---------------------
(eca-main) Prefilling i/o buffers.
s
- [ Controller/Processing stopped ] ----------------------------------------
ecasound ('h' for help)> getpos
2.212
ecasound ('h' for help)> ai-getpos
4.470
ecasound ('h' for help)>

As you can see a lag as been introduced between the current position
in the cs and the current position in the input file itself. As a
result, doing "rw 2" would not take you two seconds back in the file
but would restart about the SAME point in the file. This, of course,
leads to all sorts of unpleasantnesses and problems. The solutions I
see to that would be to either maintain two position variables for the
file (one expressing the point to which data has been buffered and one
expressing the point to which the data has actually been processed) or
to substract the amount of data in the buffer (which is known in
samples) and to reset the current position with that value whenever
something happens during the processing (stop/rewind/forward/etc.).

NOTE: Of course, the greater the amount of buffered audio is the more
obvious this problem becomes.

Regards,
S. Massy

--
To unsubscribe send message 'unsubscribe' in the body of the
message to <ecasound-list-request@wakkanet.fi>.


New Message Reply Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri Jun 08 2001 - 04:11:30 EEST