# Danielfm Workstation Audio Role

This role configures workstations for professional audio production and
low-latency audio handling. It sets up:

- Audio group permissions and limits for real-time audio processing
- CPU DMA latency optimizations for audio performance
- PipeWire/JACK configuration for professional audio workflows
- GRUB configuration for audio-optimized boot parameters
- System-level audio optimizations and udev rules

## Requirements

- A Linux system with systemd
- Root privileges for system configuration changes

## Role Variables

Available variables are listed below, along with default values.

**Whether to install the real-time kernel (Debian-based systems only):**
```yaml
audio_rt_kernel: false
```

**Whether to disable CPU mitigations (`mitigations=off`) for potentially lower latency.**
**WARNING: Disabling CPU mitigations has security implications and may make your system more vulnerable.**
```yaml
audio_disable_cpu_mitigations: false
```

## Dependencies

None.

## Example Playbook

```yaml
- hosts: localhost
  connection: local
  roles:
    - danielfm.workstation.audio
```

## What This Role Configures

**System-Level Audio Optimization:**
- `/etc/security/limits.d/99-audio.conf` - Sets audio group limits for real-time processing
- `/etc/sysctl.d/local.conf` - Kernel parameters for audio optimization
- `/etc/udev/rules.d/99-cpu-dma-latency.rules` - CPU latency rules for audio devices
- User added to `audio` group for real-time permissions

**Boot Configuration:**
- GRUB configuration with `threadirqs` kernel parameter for interrupt handling
- Optional `mitigations=off` parameter (when `audio_disable_cpu_mitigations` is enabled)
- Automatic GRUB configuration update after changes

**Audio Software Configuration:**
- `~/.config/pipewire/jack.conf.d/clients.conf` - PipeWire JACK client configuration
- Real-time kernel installation option (Debian only)
- KXStudio repository setup (Debian only)

## Important Notes

- **Security Warning**: The `audio_disable_cpu_mitigations` option disables CPU
  security mitigations and should only be used when absolutely necessary for audio
  performance
- GRUB configuration changes require a system reboot to take effect
- Real-time permissions require the user to log out and back in after role execution
- This role is optimized for professional audio production workflows

## License

MIT

## Author Information

This role was created by Daniel Martins.
