# Open-source audio components

Applies to Drumless Studio 1.0.7 Test 4 and the subsequent 1.0.7 release.

Source archives, SHA-256 checksums, licences, build scripts and replacement
instructions are available without signing in:

https://drumless-studio.com/legal/open-source

The audio build uses FFmpeg and libsndfile under LGPL-2.1-or-later, LAME under
LGPL-2.0-or-later, mpg123 and Python-SoXR under LGPL-2.1-or-later, and lameenc under
LGPL-3.0. Other codec and toolchain components retain their own notices.
See the source manifest and the `licenses` folder supplied with the application.

## Using a modified FFmpeg build

1. Build compatible Windows x64 `ffmpeg.exe` and `ffprobe.exe` from the published
   sources and instructions, or obtain compatible replacements of your choice.
2. Place both executables in a folder you control, for example
   `C:\Users\YourName\DrumlessLibraries\bin`.
3. Close Drumless Studio completely. In PowerShell, set the variable for your
   Windows account, using the actual absolute path:

   ```powershell
   [Environment]::SetEnvironmentVariable('DRUMLESS_FFMPEG_DIR', 'C:\Users\YourName\DrumlessLibraries\bin', 'User')
   ```

4. Start the app from a process with the updated environment. To test immediately,
   also set `$env:DRUMLESS_FFMPEG_DIR` to that path in the PowerShell session and
   launch the installed app from that session. Signing out and back in refreshes
   the environment for Start-menu launches.

Both executables must be present. Invalid explicit paths produce an error instead
of silently claiming to load a replacement. The app needs audio decoding,
FFprobe JSON output, resampling, raw float PCM output, WAV and 320 kbps MP3 export.

## Using modified Python audio libraries

The backend uses CPython 3.11 on Windows x64. Compatible modified libraries can be
loaded from a folder you control through `DRUMLESS_NATIVE_LIBRARY_DIR`.

The folder may contain any of these replacements:

```text
DrumlessLibraries/
  lameenc.cp311-win_amd64.pyd
  soxr/
    soxr_ext.cp311-win_amd64.pyd
  _soundfile_data/
    __init__.py
    libsndfile_64bit.dll
```

For libsndfile, create an empty `_soundfile_data/__init__.py` beside your DLL.
For SoXR, replacing only the extension preserves the bundled Python wrapper;
a complete modified `soxr` package with its own `__init__.py` is also supported.
Keep compatible module names and interfaces. Include any additional runtime DLLs
your build needs in the replacement folder.

Close Drumless, then set the variable in the same way as the FFmpeg variable:

```powershell
[Environment]::SetEnvironmentVariable('DRUMLESS_NATIVE_LIBRARY_DIR', 'C:\Users\YourName\DrumlessLibraries', 'User')
```

Only these library modules use the replacement search path. You are explicitly
choosing to run code from that folder. The installation directory does not need
to be writable, and administrator access is not required.

To return to the supplied libraries, remove the variables and restart the app
from an environment without them:

```powershell
[Environment]::SetEnvironmentVariable('DRUMLESS_FFMPEG_DIR', $null, 'User')
[Environment]::SetEnvironmentVariable('DRUMLESS_NATIVE_LIBRARY_DIR', $null, 'User')
Remove-Item Env:DRUMLESS_FFMPEG_DIR -ErrorAction SilentlyContinue
Remove-Item Env:DRUMLESS_NATIVE_LIBRARY_DIR -ErrorAction SilentlyContinue
```

These permissions come from the component licences and are preserved by the
Drumless Studio EULA. No change to WindowsApps ownership or permissions is needed.
