Setup and Installation

Requirements

Here are the basic requirements and dependencies that you need to satisfy in order to use the library:

  1. A C++20 compiler

  2. git

  3. CMake 3.5.1 or higher

Additionally, the following libraries are dragged as submodules:

  1. The Cycfi infra library

  2. portaudio Audio I/O library.

  3. portmidi MIDI I/O library.

C++20

Q currently supports the MacOS, Windows and Linux. In the Mac, we support both XCode. Q is tested with XCode 10 and XCode 11. In Windows, we support Windows 10 with Visual Studio 2022. In Linux, we support both Clang and gcc. Get the latest version with a C++20 compiler. The CLion IDE is supported on all platforms.

Git

Clone the Q DSP library and its submodules:

git clone --recurse-submodules https://github.com/cycfi/Q.git

CMake

Make sure you have CMake 3.5.1 or higher. Follow the installation procedure for your platform.

Generating the Project using CMake

There are multiple ways to generate a project file using CMake depending on your platform and desired IDE, but here are some examples for MacOS 10.14, Windows 10 and, and Ubuntu 16.04:

MacOS

Using XCode:

  1. CD to the Q library: cd Q

  2. Make a build directory: 'mkdir build'

  3. CD to the the Q/build directory: cd build

  4. Invoke cmake: cmake -G"Xcode" ../

If successful, cmake will generate an XCode project in the build directory.

Windows

  1. CD to the Q library: cd Q

  2. Make a build directory: 'mkdir build'

  3. CD to the the Q/build directory: cd build

  4. Invoke cmake: cmake -G"Visual Studio 17 2022" ../

If successful, cmake will generate an Visual Studio solution project in the build directory.

Linux

Using dpkg packaging system, stock g++ compiler and CodeBlocks.

  1. Install portaudio dependencies: sudo apt-get install libasound-dev

  2. CD to the Q library: cd Q

  3. Make a build directory: 'mkdir build'

  4. CD to the the Q/build directory: cd build

  5. Invoke cmake: cmake -G"CodeBlocks - Unix Makefiles" ../

If successful, cmake will generate a CodeBlocks project in the build directory.

Build and Test

Build the project generated by cmake.

Try running the tests and examples. If you intend to run the executables directly from the command line, make sure to change the directory to the same level where the audio_files is (e.g. 1 folder up on XCode builds). Some tests and examples may require audio clips that are found in this folder.

To make sure everything is OK, try running the sin_osc.cpp example. Make sure your system’s default audio device is set up and ready to play audio. The sin_osc.cpp program should play a 5 second 440 Hz sine wave. You might also want to try running the list_devices.cpp example that prints out all detected audio and MIDI devices.


Copyright (c) 2014-2023 Joel de Guzman. All rights reserved. Distributed under the MIT License