I'm putting together a blind-friendly virtual machine (VM), based on Ubuntu, 
VirtualBox, and Vagrant.  I'm installing a variety of audio- and 
accessibility-related software, with the (eventual) objective of letting folks 
use any or all of them from the command line.  These pages provide some 
background and list the explicitly installed APT packages:

  http://pa.cfcl.com/item?key=Areas/Content/Overviews/Perkify_Intro/main.toml
  http://pa.cfcl.com/item?key=Areas/Content/Overviews/Perkify_Pkg_List/main.toml

Everything installs without error and some test commands (e.g., aplay, play, 
speaker-test) work when I try them out in the build environment.  However, when 
I halt the VM and bring it back up again, I don't get any audio output.  I 
suspect that some software may be starting up automagically, doing things that 
I never explicitly requested, etc.  I'm hoping that someone on this list can 
help me to resolve these issues.

# Setup

My .profile contains the line "export AUDIODRIVER=alsa"

Each of these commands produces the expected sound, when run in the build 
environment:

$ speaker-test -s1
$ play -q foo.ogg  

When I run the following command in the build environment, nothing is listed 
under "default":

$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
jack
    JACK Audio Connection Kit
pulse
    PulseAudio Sound Server
default
sysdefault:CARD=Intel
    HDA Intel, STAC9221 A1 Analog
    Default Audio Device
...

However, in the restored environment, "default" reports "Playback/recording 
through the PulseAudio sound server":

$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
jack
    JACK Audio Connection Kit
pulse
    PulseAudio Sound Server
default
    Playback/recording through the PulseAudio sound server
sysdefault:CARD=Intel
    HDA Intel, STAC9221 A1 Analog
    Default Audio Device
...

As a starting point, I'd like to know how restore the "default" value, so that 
things play again.  Then, I'd like to find out what is clobbering things, so 
that I can prevent that from happening.  Help?

-r


P.S.  FWIW, my customization and provisioning code for ALSA (in the 
Vagrantfile) looks like this:

  def cust_alsa(vm)
  #
  # Customize the VM's audio settings, based on the host's operating system.

    vm.provider :virtualbox do |vb|
      audio = case RUBY_PLATFORM
        when /darwin|mac os/;                             'coreaudio'
        when /bccwin|cygwin|emc|mingw|mswin|msys|wince/;  'dsound'
        when /linux/;                                     'alsa'
      end

      vb.customize [ 'modifyvm',  :id,
        '--audio',                audio,
        '--audiocontroller',      'hda',
        '--audioout',             'on'
      ]
    end
  end

  def prov_alsa(vm)
  #
  # Provision support for ALSA
  #
  # This code is adapted from Christoph Neumann's vagrant-audio Vagrantfile
  # (in https://github.com/christoph-neumann/vagrant-audio), with help from
  # Clemens Ladisch and Eric Zuck.  See also `./cust_alsa.rb`.
  #
  # For details, see:
  #   https://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvm-general
  #   https://www.vagrantup.com/docs/virtualbox/configuration.html
  #     #vboxmanage-customizations

    vm.provision "shell", inline: <<SHELL
extra=linux-modules-extra-$(uname -r)
echo "extra: $extra" #!T
apt-get install -y linux-image-generic $extra alsa-utils

sudo usermod -aG audio vagrant

cat <<CONF > /etc/asound.conf
pcm.!default {
  type plug
  slave.pcm "hw:0,1"
}
CONF

sudo modprobe snd
sudo modprobe snd-hda-intel
sleep 2
sudo amixer -c 0 set Master playback 100% unmute
SHELL
  end



_______________________________________________
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user

Reply via email to