Skip to content

Developer's Guide

David Braun edited this page Sep 22, 2021 · 17 revisions

Linux

To build DawDreamer on Linux, refer to the steps inside the Dockerfile and or the Github actions.

Docker

To build an image with the Dockerfile, run:

docker build -t dawdreamer .

Pre-requisite software:

Environment Variables:

These are case-sensitive.

  • PYTHONMAJOR: 3.8
  • pythonLocation:
    • C:\Python38 on Windows
    • /Library/Frameworks/Python.framework/Versions/3.8 on macOS

Build libsamplerate

Windows

cd thirdparty/libsamplerate
mkdir build_release
cmake -DCMAKE_BUILD_TYPE=Release -Bbuild_release
cd build_release
msbuild libsamplerate.sln /property:Configuration=Release

macOS

cd thirdparty/libsamplerate
mkdir build_release
cmake -DCMAKE_BUILD_TYPE=Release -Bbuild_release
make --directory=build_release

Build Faust

Linux

Faust on Linux relies on the Ubuntu package service, so if you used the Dockerfile, no extra steps are necessary. For Windows and macOS, Faust features depend on precompiled libraries in thirdparty/libfaust. If you'd like to compile these yourself, please follow the instructions for TD-FAUST (Downloading TouchDesigner is not necessary).

Windows

Run the latest win64.exe installer from FAUST's releases. After installing, copy C:/Program Files/Faust/share/faust to C:/share/faust. The reason is that we're using C:/Python38/python.exe, so the sibling directory would be C:/share/faust.

macOS

Open the latest .dmg installer from FAUST's releases. Copy Faust-2.X.X/share/faust/ to either /usr/local/share/faust or /usr/share/faust.

Building DawDreamer

You can find a working Linux Makefile, Visual Studio Solution, and Xcode Project in the Builds/ folder. If you want to make changes, the best way is to get JUCE's Projucer and open DawDreamer.jucer.

Windows

With the Projucer, open DawDreamer.jucer. Use it to create a Visual Studio solution and then build in Release mode. Visual Studio might not find Python due to it being related to an environment variable. If so, replace the include paths with absolute paths that don't use environment variables. Otherwise, just run msbuild Builds/VisualStudio2019/DawDreamer.sln /property:Configuration=Release in an x64 Native Tools Command Prompt for VS 2019. Note the post-build command, which moves the recently built dawdreamer.dll to C:/Python38. This command should also move thirdparty/libfaust/win-x64/Release/bin/faust.dll to this directory.

Now you can import dawdreamer:

python
>> import dawdreamer as daw
>> engine = daw.RenderEngine(44100,512)

In order to build in Debug, you must unzip thirdparty/libfaust/win-x64/Debug/bin/faust.zip into faust.dll in the same folder. You'd also have to compile libsamplerate similarly, replacing debug in the instructions with release.

MacOS

The macOS Deployment Target is 10.15. This can be changed from either the Projucer or in Xcode.

Use Projucer and DawDreamer.jucer to create an Xcode project or use Builds/MacOSX/DawDreamer.xcodeproj. Run

xcodebuild -configuration Release -project Builds/MacOSX/DawDreamer.xcodeproj/
mv Builds/MacOSX/build/Release/dawdreamer.so.dylib Builds/MacOSX/build/Release/dawdreamer.so
otool -L Builds/MacOSX/build/Release/dawdreamer.so
install_name_tool -change @rpath/libfaust.2.dylib @loader_path/libfaust.2.dylib Builds/MacOSX/build/Release/dawdreamer.so
otool -L Builds/MacOSX/build/Release/dawdreamer.so

Note that the otool commands above don't serve a functional purpose. They just display the before and after of the change made with the install_name_tool command.

Move dawdreamer.so to a directory of your choice. Then find thirdparty/libfaust/darwin-x64/Release/libfaust.a, rename it to libfaust.2.dylib and place it next to dawdreamer.so.

Then try DawDreamer:

python3
>> import dawdreamer as daw
>> engine = daw.RenderEngine(44100,512)

Building a Wheel (optional)

Clone faustlibraries to DawDreamer/dawdreamer/faustlibraries

Inside the root of this DawDreamer repo, build a wheel:

py -m build --wheel on Windows, or on macOS: python -m build --wheel.

Then install the wheel:

pip install dist/dawdreamer.whl or something similar.

Tests

Go to the tests directory and run python -m pytest .

To get more verbose output, run python -m pytest -s .

You can replace python with a specific Python version or executable path.

Clone this wiki locally