[squeak-dev] recording sound on *nix via ALSA libs

David T. Lewis lewis at mail.msen.com
Wed Feb 25 01:21:51 UTC 2015


> On Sun, Feb 23, 2015 at 1:30 PM, tim Rowledge wrote:
> 
> On Sun, Feb 22, 2015 at 03:27:32PM -0500, David T. Lewis wrote:
> > On Sun, Feb 22, 2015 at 10:48:44AM -0800, tim Rowledge wrote:
> > > I?m attempting to hook up the scratch sound recording on Pi; which
> > > amongst other things requires setting up add-on hardware that may or
> > > may not work, be comprehendable, or even taste of the correct chocolate .
> > > 
> > > Before I get too lost in trying to work out why things don?t work I would
> > > love to know if anyone has been able to use ALSA libs to record on any
> > > machine/*nix version/hardware? Just knowing a workable configuration exists
> > > would be helpful.
> > 
> > On a trunk image, if I enable the shared flaps, then drag a "Sound" morph
> > from the Widgets flap, I can record and play awful sounding things with
> > an interpreter VM running whatever it gets hooked up to on my Ubuntu box.
> > 
> > If I specify -vm-sound-pulse, I get fairly good audio quality.
> > 
> > If I specify -vm-sound-ALSA, I get a primitive failure with this error on
> > the VM console:
> > 
> >   sound_StartRecording: snd_add_pcm_handler: Function not implemented
> > 
> > If I use a precompiled interpreter VM or Cog VM on my system, and specify
> > -vm-sound-ALSA, I get this error on the VM console:
> > 
> >   ALSA lib conf.c:3314:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so
> >   ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
> >   start_SoundRecording: snd_pcm_open: No such file or directory
> > 
> > The primitive failure is for primitiveSoundStartRecording in the SoundPlugin.
> > 
> > I think that the ALSA support code is out of date with respect to the
> > libraries provided in current Linux distributions.
> > 
> > There are several issues related to ALSA on bugs.squeak.org. This one looks
> > like the issue I am seeing, and may give you an idea of what needs to be done:
> > 
> >   http://bugs.squeak.org/view.php?id=7328
> 
> Thanks for trying that out Dave; it looks like at least I???m not getting any
> different errors, so that???s ??? good?
> ALSA really does seem to be a major cause of pain and gnashing of teeth.
>

I also found this old post from Derek O'Connell concerning ALSA sound
recording on the OLPC:

  http://lists.squeakland.org/pipermail/etoys-dev/2010-June/005040.html 

Derek explains some ALSA sound recording issues on the OLPC XO platform,
which I think are loosely equivalent to what you may need for the Raspberry
Pi. My poorly educated impression is that ALSA is considered outdated on
generic Linux distributions, but that it probably still serves as a workable
low end solution on minimalist platforms like the Pi.

I think that Derek implemented, or was at least involved in, the pulse audio
support for Squeak (the one that actually records and plays listenable sound
on my Ubuntu laptop). His post offers suggestions for fixing ALSA based on
what he did for pulse.

I believe that Derek's changes for ALSA were adopted by Ian in the trunk
code in SVN commit #2712 for sqUnixSoundALSA.c. That update is from 22 months
ago. The oscog branch is older (sqUnixSoundALSA.c update 4 years ago and not
changed since then), but is a larger file size so presumably contains various
other enhancements. I do not know if it includes Derek's changes.

I don't know if any of this is helpful, but I suspect that the OLPC platform,
though older, may be similar to Raspberry Pi in the sense that it runs on
low cost minimal hardware, and probably uses the smallest and simplest sound
support available.

I am getting the impression that updating the ALSA support would be a good
thing to do for low end platforms like the Pi.

Tim, is this something you plan to be working on? I appreciate your lack
of sympathy for all things *nix, but it does seem like this might be a
worthwhile effort for support of Scratch (and Etoys?) on the Pi.

Dave



More information about the Squeak-dev mailing list