[etoys-dev] ALSA Play & Record on X0-1.5

Derek O'Connell doc at doconnel.f9.co.uk
Mon Jun 7 03:09:53 EDT 2010


Sorry, long post, only read if you are interested in *both* play & 
record. If you are not bothered about recording then this is probably of 
no interest.

Latest results in effort to get both play & record working on the 
XO-1.5. This may seem more appropriate to vm-dev and ideally that would 
be the case but unless Etoys itself is tested then problems peculiar to 
the performance of one particular image over another might be overlooked 
(for example Scratch does recording in a much tighter loop so appears to 
cope with higher sampling rates than Etoys). Diagnosing these types 
problems is time consuming so I would be grateful if someone else wants 
to pick it up from this point.

Testing done on vanilla XO Etoys image with the attached version of 
vm-sound-ALSA which contains additional error checking to avoid apparent 
freeze when the XO suspends then resumes.

Playing...

- before playing/recording anything...
- SoundPlayer class>>initialize, set SamplingRate to 44100
- I don't think it's important but I turn reverb off (via class var)
- Open Sound Library and play a sound twice, first time will probably be 
at double speed, second time should be ok
- From then on playback should be ok

Recording...

- SoundRecorder>>initialise, set SamplingRate to 8092
- Recording not great quality but passable, no clicks (initial click is 
due to something else)
- If "preserveTrash"is enabled then deleted Sound Recorder continues to 
monitor sound or, worse, continues recording while in the trashcan. This 
is also true with preserveTrash disabled because of "undo" facility, at 
least until something else is deleted. This means Etoys can appear to 
freeze even when no Sound Recorder is visible.
- Even for 8092 recording will sometimes hang but unlike for 11025/22050 
there is plenty of time to actually get something recorded.
- I suspect underlying problem to be buffer overruns, badly handled ALSA 
errors or paging delays related to the use of flash memory on the XO... 
or a combination there-of.  *Note* that if left long enough things will 
actually unfreeze.

strace results during recording (and capturing a hang) show a stream of 
select() time-outs and EAGAIN errors on read()'s, eg:

      0.000061 select(8, [3 7], [], [3 7], {0, 0}) = 0 (Timeout)
      0.000082 read(3, 0x973e858, 4096)  = -1 EAGAIN (Resource 
temporarily unavailable)

...ending in a stream of...

      0.008931 --- SIGIO (I/O possible) @ 0 (0) ---
      0.000060 rt_sigreturn(0x4c01f15c)  = 0
      0.010951 --- SIGALRM (Alarm clock) @ 0 (0) ---
      0.000056 sigreturn()               = ? (mask now [])

The full strace in this case is ~10M so email me if you want a copy or 
reproduce yourself using "strace -s 64 -r -o <a-filename> squeak 
vm-sound-ALSA etoys.image" (run in /usr/share/etoys).

For anyone willing to adopt the problem the only suggestion I have is to 
wrap recording in the ALSA plugin in threaded-buffering similar to what 
I have done in vm-sound-pulse. Good luck!

-D






-------------- next part --------------
A non-text attachment was scrubbed...
Name: alsa-xo-1.5.tar.gz
Type: application/x-gzip
Size: 24470 bytes
Desc: not available
Url : http://lists.squeakland.org/pipermail/etoys-dev/attachments/20100607/f349946f/alsa-xo-1.5.tar-0001.gz


More information about the etoys-dev mailing list