Difference between revisions of "Linux Audio"

From S23Wiki
Jump to: navigation, search
Line 10: Line 10:
  
 
Source: an audio input, typically an Analog audio from a sound card such as a microphone. Can also can be a loop back / monitor of an audio output (Sink)
 
Source: an audio input, typically an Analog audio from a sound card such as a microphone. Can also can be a loop back / monitor of an audio output (Sink)
 +
 +
 +
A very nice audio mixer with graphical options for setting up and choosing inputs / outputs (as below) is [http://freedesktop.org/software/pulseaudio/pavucontrol/ pavucontrol]
 +
  
 
== Output ==
 
== Output ==

Revision as of 13:39, 27 May 2013

Linux Audio with Pulse Audio

Pulse Audio is a popular audio system for Linux.

Its basic command line app is "pacmd"

Terminology:

Sink: an audio output, typically an Analog audio output such as a sound card.

Source: an audio input, typically an Analog audio from a sound card such as a microphone. Can also can be a loop back / monitor of an audio output (Sink)


A very nice audio mixer with graphical options for setting up and choosing inputs / outputs (as below) is pavucontrol


Output

List available sound outouts

# pacmd list-sinks 
Welcome to PulseAudio! Use "help" for usage information.
>>> 2 sink(s) available.
  index: 0
	name: <alsa_output.pci-0000_00_1b.0.analog-stereo> 
	flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY FLAT_VOLUME DYNAMIC_LATENCY
	state: RUNNING
...  
  * index: 14
	name: <alsa_output.usb-Behringer_BCD3000-00-BCD3000.analog-surround-40>
	driver: <module-alsa-card.c>
	flags: HARDWARE DECIBEL_VOLUME LATENCY FLAT_VOLUME DYNAMIC_LATENCY
	state: RUNNING
...

Change Default Output Device

# pacmd "set-default-sink ${Device Index}"

or

# pacmd "set-default-sink ${Device Name}"

E.G.

# pacmd "set-default-sink 14"
Welcome to PulseAudio! Use "help" for usage information.
>>> >>> 
or
# pacmd set-default-sink alsa_output.usb-Behringer_BCD3000-00-BCD3000.analog-surround-40
Welcome to PulseAudio! Use "help" for usage information.
>>> >>> 


List Apps using sound outputs

# pacmd list-sink-inputs
Welcome to PulseAudio! Use "help" for usage information.
>>> 2 sink input(s) available.
	index: 1994
		driver: <protocol-native.c>
		flags: 
		state: RUNNING
		sink: 0 <alsa_output.pci-0000_00_1b.0.analog-stereo>
...
			application.process.id = "12170"
			application.process.binary = "java"
...
	index: 2106
		driver: <protocol-native.c>
		flags: START_CORKED 
		state: RUNNING
		sink: 14 <alsa_output.usb-Behringer_BCD3000-00-BCD3000.analog-surround-40>
...		
			application.process.id = "22083"
			application.icon_name = "media-player-banshee"
...


Move App to another output device

# pacmd "move-sink-input ${App Index}  ${Device Index}"

# pacmd "move-sink-input 1994 0"
Welcome to PulseAudio! Use "help" for usage information.
>>> >>> 


Input

List available sound inputs

# pacmd list-sources

 # pacmd list-sources
Welcome to PulseAudio! Use "help" for usage information.
>>> 4 source(s) available.
    index: 0
	name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>
...	
	properties:
		device.description = "Monitor of Built-in Audio Analog Stereo"
		device.class = "monitor"
...
  * index: 1
	name: <alsa_input.pci-0000_00_1b.0.analog-stereo>
...
	used by: 0
	linked by: 0
	module: 4
	properties:
		alsa.name = "VT1708S Analog"
		alsa.id = "VT1708S Analog"
		alsa.card_name = "HDA Intel PCH"
		device.profile.name = "analog-stereo"
		device.profile.description = "Analog Stereo"
		device.description = "Built-in Audio Analog Stereo"
	ports:
		analog-input-microphone-front: Front Microphone (priority 8500, available: unknown)
		analog-input-microphone-rear: Rear Microphone (priority 8200, available: unknown)
		analog-input-linein: Line In (priority 8100, available: unknown)
	active port: <analog-input-microphone-front>
...
    index: 28
	name: <alsa_output.usb-Behringer_BCD3000-00-BCD3000.analog-surround-40.monitor>
	properties:
		device.description = "Monitor of BCD3000 Analog Surround 4.0"
		device.class = "monitor"
...
    index: 29
	name: <alsa_input.usb-Behringer_BCD3000-00-BCD3000.analog-4-channel-input>
...
	used by: 0
	linked by: 0
		alsa.name = "USB Audio"
		alsa.id = "USB Audio"
		alsa.card_name = "BCD3000"
		device.profile.name = "analog-4-channel-input"
		device.profile.description = "Analog 4-channel Input"
		device.description = "BCD3000 Analog 4-channel Input"
		alsa.mixer_name = "USB Mixer"
...


pacmd help

#pacmd help
Welcome to PulseAudio! Use "help" for usage information.
>>> Available commands:
   help                      Show this help
   list-modules              List loaded modules
   list-cards                List cards
   list-sinks                List loaded sinks
   list-sources              List loaded sources
   list-clients              List loaded clients
   list-sink-inputs          List sink inputs
   list-source-outputs       List source outputs
   stat                      Show memory block statistics
   info                      Show comprehensive status
   load-module               Load a module (args: name, arguments)
   unload-module             Unload a module (args: index)
   describe-module           Describe a module (arg: name)
   set-sink-volume           Set the volume of a sink (args: index|name, volume)
   set-source-volume         Set the volume of a source (args: index|name, volume)
   set-sink-mute             Set the mute switch of a sink (args: index|name, bool)
   set-source-mute           Set the mute switch of a source (args: index|name, bool)
   set-sink-input-volume     Set the volume of a sink input (args: index, volume)
   set-source-output-volume  Set the volume of a source output (args: index, volume)
   set-sink-input-mute       Set the mute switch of a sink input (args: index, bool)
   set-source-output-mute    Set the mute switch of a source output (args: index, bool)
   set-default-sink          Set the default sink (args: index|name)
   set-default-source        Set the default source (args: index|name)
   set-card-profile          Change the profile of a card (args: index|name, profile-name)
   set-sink-port             Change the port of a sink (args: index|name, port-name)
   set-source-port           Change the port of a source (args: index|name, port-name)
   suspend-sink              Suspend sink (args: index|name, bool)
   suspend-source            Suspend source (args: index|name, bool)
   suspend                   Suspend all sinks and all sources (args: bool)
   move-sink-input           Move sink input to another sink (args: index, sink)
   move-source-output        Move source output to another source (args: index, source)
   update-sink-proplist      Update the properties of a sink (args: index|name, properties)
   update-source-proplist    Update the properties of a source (args: index|name, properties)
   update-sink-input-proplist Update the properties of a sink input (args: index, properties)
   update-source-output-proplist Update the properties of a source output (args: index, properties)
   list-samples              List all entries in the sample cache
   play-sample               Play a sample from the sample cache (args: name, sink|index)
   remove-sample             Remove a sample from the sample cache (args: name)
   load-sample               Load a sound file into the sample cache (args: name, filename)
   load-sample-lazy          Lazily load a sound file into the sample cache (args: name, filename)
   load-sample-dir-lazy      Lazily load all files in a directory into the sample cache (args: pathname)
   kill-client               Kill a client (args: index)
   kill-sink-input           Kill a sink input (args: index)
   kill-source-output        Kill a source output (args: index)
   set-log-level             Change the log level (args: numeric level)
   set-log-meta              Show source code location in log messages (args: bool)
   set-log-time              Show timestamps in log messages (args: bool)
   set-log-backtrace         Show backtrace in log messages (args: frames)
   play-file                 Play a sound file (args: filename, sink|index)
   dump                      Dump daemon configuration
   dump-volumes              Debug: Show the state of all volumes
   shared                    Debug: Show shared properties
   exit                      Terminate the daemon