Warning: THE VOID WIKI IS DEPRECATED. It is no longer being maintained, contains outdated and incorrect information, and will eventually be shut down. Please refer to the Void Handbook, https://docs.voidlinux.org/, for the official documentation. If you can't find the information you're seeking, please raise an issue at https://github.com/void-linux/void-docs/issues

Difference between revisions of "Sndio"

From Void Linux Wiki
Jump to navigation Jump to search
(Make a start on sndio)
 
m (Created proper references section; minor style amendments.)
Line 21: Line 21:
 
It is recommended to have all ALSA outputs at 0dB and control the volume through sndiod instead.
 
It is recommended to have all ALSA outputs at 0dB and control the volume through sndiod instead.
  
== Controlling Volume ==
+
== Controlling volume ==
 
sndiod controls application volume using MIDI messages, to do this without a MIDI device, {{pkg|aucatctl}} can be used.
 
sndiod controls application volume using MIDI messages, to do this without a MIDI device, {{pkg|aucatctl}} can be used.
  
Line 39: Line 39:
 
  $ aucatctl mpv0=0 sox0=100
 
  $ aucatctl mpv0=0 sox0=100
  
== Extra Utilities ==
+
== Extra utilities ==
 
sndio also provides two extra utilities, aucat and midicat.
 
sndio also provides two extra utilities, aucat and midicat.
  
Line 50: Line 50:
 
See [https://man.voidlinux.eu/midicat midicat(1)] for usage.
 
See [https://man.voidlinux.eu/midicat midicat(1)] for usage.
  
== Known Issues ==
+
== Known issues ==
  
 
=== Some programs play sound at maximum volume ===
 
=== Some programs play sound at maximum volume ===
Line 69: Line 69:
 
{{Note|An <b>alternative</b> option is to start sndiod with the <code>-a on</code> flag. This causes sndiod to take <b>exclusive</b> control of the audio device, instead of accessing it on demand.}}
 
{{Note|An <b>alternative</b> option is to start sndiod with the <code>-a on</code> flag. This causes sndiod to take <b>exclusive</b> control of the audio device, instead of accessing it on demand.}}
  
== sndio via ALSA<ref>https://github.com/raphael/linux-samus/issues/200</ref> ==
+
== sndio via ALSA<ref> purple mountains &mdash; [https://github.com/raphael/linux-samus/issues/200 OpenBSD sndio via ALSA on ARCH Linux works] (Github)</ref> ==
 
{{Warning|This has not been thoroughly tested, it is possible you may encounter sound issues, quality loss, sync issues, etc. You have been warned!}}
 
{{Warning|This has not been thoroughly tested, it is possible you may encounter sound issues, quality loss, sync issues, etc. You have been warned!}}
 
To get programs that only support outputting to ALSA to use sndio, create {{path|/$HOME/.asoundrc}} with these contents:
 
To get programs that only support outputting to ALSA to use sndio, create {{path|/$HOME/.asoundrc}} with these contents:
Line 104: Line 104:
 
This will create a signed 16 bit stereo ALSA output at 48000Hz.
 
This will create a signed 16 bit stereo ALSA output at 48000Hz.
  
== External Links ==
+
==References==
 +
<references/>
 +
 
 +
== External links ==
 
* [http://www.sndio.org/ Official Website]
 
* [http://www.sndio.org/ Official Website]
  

Revision as of 06:13, 29 January 2018

Medic template.svgThis article or section needs expansion.

Reason: An explanation of how to use sndio for network sound and controlling MIDI devices is needed. (Discuss)

sndio is a small audio and MIDI framework part of the OpenBSD project. It provides an optional sound server (sndiod) and a documented application programming interface to access either the server or the audio and MIDI hardware in a uniform way.

It is an alternative to the well known PulseAudio and jack sound servers.

Some prominent features of sndio include:

  • Performs re-sampling and format conversions.
  • Allows concurrent access to an audio device.
  • Split an audio device into sub-devices.
  • Allows one program to record what other programs play.
  • Control the volume of individual programs.
  • Route audio and MIDI data through a network and between programs.

Installation

# xbps-install -S sndio

To start the sound server sndiod:

# ln -s /etc/sv/sndiod /var/service

It is recommended to have all ALSA outputs at 0dB and control the volume through sndiod instead.

Controlling volume

sndiod controls application volume using MIDI messages, to do this without a MIDI device, aucatctl can be used.

aucatctl sends MIDI volume controller messages to adjust the volume of audio programs using the sndiod server for output.

Installation

# xbps-install -S aucatctl

Example

List available volume controls and their values:

$ aucatctl

Set master volume to maximum:

$ aucatctl master=127

Mute mpv and set sox to 100:

$ aucatctl mpv0=0 sox0=100

Extra utilities

sndio also provides two extra utilities, aucat and midicat.

aucat

The aucat utility can play, record, mix, and process audio files on the fly. Similar to that of aplay and arecord from ALSA. See aucat(1) for usage.

midicat

The midicat utility receives MIDI data from a given input MIDI port and/or sends it to a given output MIDI port. See midicat(1) for usage.

Known issues

Some programs play sound at maximum volume

Either the program is not configured to use sndio as its output or it does not support sndio. The program will play at maximum volume as it will connect to the master ALSA output, which should be configured to 0dB.

To prevent programs from exploding your speakers when they don't support sndio, create /etc/asound.conf with these contents:

pcm.null {
    type null
}

pcm.default null

This will cause programs that connect to ALSA instead of sndio to discard their output instead.

Note: An alternative option is to start sndiod with the -a on flag. This causes sndiod to take exclusive control of the audio device, instead of accessing it on demand.

sndio via ALSA[1]

Warning: This has not been thoroughly tested, it is possible you may encounter sound issues, quality loss, sync issues, etc. You have been warned!

To get programs that only support outputting to ALSA to use sndio, create /$HOME/.asoundrc with these contents:

pcm.sndio {
    type asym
    playback.pcm "sndio-play"
    hint {
        show on description "OpenBSD sndio"
    }
}

pcm.sndio-play {
    type plug
    slave {
        pcm "sndio-raw"
        rate 48000
        format s16_le
        channels 2
    }
}

pcm.sndio-raw {
    type file
    slave.pcm null
    format raw
    file "| aucat -f snd/0 -i -"
}

pcm.default sndio

This will create a signed 16 bit stereo ALSA output at 48000Hz.

References

  1. purple mountains — OpenBSD sndio via ALSA on ARCH Linux works (Github)

External links