Skip to content
Snippets Groups Projects
Commit 0f963790 authored by David Trattnig's avatar David Trattnig
Browse files

More docs.

parent a1b4fb48
No related branches found
No related tags found
No related merge requests found
Pipeline #1022 canceled
...@@ -9,6 +9,7 @@ This document outlines the steps on how to configure an audio interface with Eng ...@@ -9,6 +9,7 @@ This document outlines the steps on how to configure an audio interface with Eng
- [Audio Device Configuration](#audio-device-configuration) - [Audio Device Configuration](#audio-device-configuration)
- [ALSA](#alsa) - [ALSA](#alsa)
- [Disabe an existing Pulse Audio Server](#disabe-an-existing-pulse-audio-server)
- [Defining the default audio device](#defining-the-default-audio-device) - [Defining the default audio device](#defining-the-default-audio-device)
- [Setting the output device using a device ID](#setting-the-output-device-using-a-device-id) - [Setting the output device using a device ID](#setting-the-output-device-using-a-device-id)
- [Setting the input device](#setting-the-input-device) - [Setting the input device](#setting-the-input-device)
...@@ -29,13 +30,32 @@ Out of the box Engine Core is configured to use ALSA `default` output. The input ...@@ -29,13 +30,32 @@ Out of the box Engine Core is configured to use ALSA `default` output. The input
## ALSA ## ALSA
Before starting, you need to ensure not having a Pulse Audio server running on your system. On Linux distributions like Ubuntu, PulseAudio is pre-installed and it can be tricky turning it off. You might even think about uninstalling PulseAudio altogether, as there are scenarios where the driver gets restarted upon ALSA device requests. Yes, even with having the PulseAudio service disabled and `autospawn = no` set in your PulseAudio configuration. Having PulseAudio running in the background while thinking running native ALSA can be the root many evil latency problems. In such scenario audio is passed through all of these layers: When using your audio device with ALSA you are pretty close to the actual hardware. It can be relatively hard to find some good settings though.
**Documentation:** While the [*Official ALSA*](https://www.alsa-project.org/wiki/Documentation) documentation is not an easy read, there is a superb [*ALSA, exposed!*](https://rendaw.gitlab.io/blog/2125f09a85f2.html#alsa-exposed) documentation available too.
### Disabe an existing Pulse Audio Server
Before starting, you need to ensure not having a Pulse Audio server running on your system. On Linux distributions like Ubuntu, PulseAudio is pre-installed and it can be tricky turning it off.
Having PulseAudio running in the background while thinking running native ALSA can be the root many evil latency problems. In such scenario audio is passed through all of these layers:
Audio Interface <--> ALSA <--> Pulse Audio <--> ALSA Plugin <--> Audio Stream Audio Interface <--> ALSA <--> Pulse Audio <--> ALSA Plugin <--> Audio Stream
If you only want to do a quick ALSA test, without removing your nicely working PulseAudio server, you can prefix your bash commands with `pasuspender ...`. This disables PulseAudio only as long the passed executable is running. First stop PulseAudio from restarting automatically
**Documentation:** While the [*Official ALSA*](https://www.alsa-project.org/wiki/Documentation) documentation is not an easy read, there is a superb [*ALSA, exposed!*](https://rendaw.gitlab.io/blog/2125f09a85f2.html#alsa-exposed) documentation available too. ```conf
nano ~/.pulse/client.conf
(autospawn = no)
```conf
```bash
systemctl --user stop pulseaudio.socket
systemctl --user stop pulseaudio.service
```
You might even think about uninstalling PulseAudio altogether, as there are scenarios where the driver gets restarted upon ALSA device requests. Yes, even with having the PulseAudio service disabled and `autospawn = no` set in your PulseAudio configuration.
If you only want to do a quick ALSA test, without removing your nicely working PulseAudio server, you can prefix your bash commands with `pasuspender ...`. This disables PulseAudio only as long the passed executable is running.
### Defining the default audio device ### Defining the default audio device
...@@ -161,6 +181,10 @@ alsa_buffer_length="10" ...@@ -161,6 +181,10 @@ alsa_buffer_length="10"
alsa_frame_size="2048" alsa_frame_size="2048"
``` ```
If you don't experience any buffer underruns in the logs you can try to decrease the buffer size to for example `4096` or `2048`.
In case you get plenty of buffer unterruns then try to increase the buffer size and possibly the frame size to twice the given value.
#### (B) Unbuffered audio #### (B) Unbuffered audio
When enabling unbuffered audio you can access the (almost ;) real-time capabilities of ALSA. When enabling unbuffered audio you can access the (almost ;) real-time capabilities of ALSA.
...@@ -197,7 +221,7 @@ Now perform following steps to find the correct frame-size: ...@@ -197,7 +221,7 @@ Now perform following steps to find the correct frame-size:
The total steps needed and resulting values might be different based on your system and audio interface. The total steps needed and resulting values might be different based on your system and audio interface.
After you have found your own personal frame-size, use the value for the `frame_size` in the `engine-core.ini` config. Then start the engine and double-check the logs there. After you have found your own personal frame-size, use the value for the `alsa_frame_size` in the `engine-core.ini` config. Then start the engine and double-check the logs there.
## Pulse Audio ## Pulse Audio
......
...@@ -53,7 +53,7 @@ You probably have set a wrong or occupied device ID. The device could be reserve ...@@ -53,7 +53,7 @@ You probably have set a wrong or occupied device ID. The device could be reserve
## How to avoid stutter, hangs, artifacts or in general glitchy sound? ## How to avoid stutter, hangs, artifacts or in general glitchy sound?
This can have various reasons, but first of all it's good to check the `engine-core.log` logs. This can have various reasons, but first of all it's good to check the `engine-core.log` logs. Also check your CPU usage. Lastly review the settings of your audio device.
**Incorrect ALSA buffer settings**: If the ALSA settings provided by your system are not working cleanly the `engine-core.ini` settings provide to option to override parameters such as `alsa_buffer`. The correct settings are individual to the used soundcard but in general this is a tricky topic. In our case we had more success using PulseAudio or JACK instead. Recommendations are welcome. **Incorrect ALSA buffer settings**: If the ALSA settings provided by your system are not working cleanly the `engine-core.ini` settings provide to option to override parameters such as `alsa_buffer`. The correct settings are individual to the used soundcard but in general this is a tricky topic. In our case we had more success using PulseAudio or JACK instead. Recommendations are welcome.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment