Git Product home page Git Product logo

canvas's Introduction

Screenshot of Canvas

Canvas (working title) is a visual additive synthesizer that is controlled by editing an image. Scribble on the canvas and use a variety of image filters to create new and interesting sounds. Canvas is heavily inspired by MetaSynth and Virtual ANS and aspires to offer an open source, cross-platform addition to the graphical synthesizer space.

Canvas currently uses 239 sine waves spaced at quarter tones, and offers rudimentary drawing features and several image-based audio filters such as reverb, chorus, and tremolo. Stereo is supported by using red and blue for the right and left channels, respectively. The sine waves can be morphed into other waveforms using phase distortion synthesis.

This software is built on PortAudio, libsndfile, SDL2, FFTW, stb, and NanoGUI-SDL.

Installation

For Windows, builds are provided on the Release page.

For Linux and macOS, you must build yourself using instructions below.

On Linux, you must also have the Zenity tool installed and in your PATH. Otherwise the "Browse" buttons will not work:

sudo apt install zenity  # Debian
sudo pacman -S zenity  # Arch

Building

Windows

You will need to install CMake and Visual Studio. The below instructions use VS 2019, but will likely work for older versions with appropriate minor changes. MinGW is not yet supported.

Download and unzip the following and place them somwhere safe:

  • ASIO SDK
  • FFTW3
  • libsndfile
  • Development libraries for SDL2, SDL2_image, and SDL2_ttf

The FFTW3 library needs a little preparation by generating a .lib file:

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
cd <path to FFTW3>
lib.exe /machine:x64 /def:libfftw3f-3.def

To build, run the following:

mkdir build
cd build

# For the -G option, use cmake --help and scroll down to the list of
# Visual Studio versions. Find the string that matches the one you currently
# have installed.
cmake .. -G "Visual Studio 16 2019" -A x64 \
    -DASIOSDK_ROOT_DIR=<path to ASIO SDK> \
    -DSDL2_LIBRARY=<path to SDL2>/lib/x64/SDL2.lib \
    -DSDL2_INCLUDE_DIRS=<path to SDL2>/include/ \
    -DSDL2_IMAGE_PATH=<path to SDL2_image> \
    -DSDL2_TTF_PATH=<path to SDL2_ttf> \
    -DSNDFILE_PATH=<path to libsndfile> \
-DFFTW_ROOT=<path to FFTW> \

cmake --build . --config Release

# NOTE: The following manual copies will be automated in CMake soon
cd Release
cp <path to FFTW3>/libfftw3f-3.dll .
cp <path to SDL2>/lib/x64/SDL2.dll .
cp <path to SDL2_image>/lib/x64/SDL2_image.dll .
cp <path to SDL2_image>/lib/x64/zlib1.dll .
cp <path to SDL2_ttf>/lib/x64/SDL2_ttf.dll .
cp <path to SDL2_ttf>/lib/x64/libfreetype-6.dll .
cp <path to libsndfile>/bin/sndfile.dll .

Then run ./Release/canvas.

Linux

Debian/Ubuntu:

sudo apt install build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev portaudio19-dev libsndfile1-dev libfftw3-dev

Arch:

sudo pacman -S cmake sdl2 sdl2_image sdl2_ttf portaudio libsndfile fftw

Build on Linux:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..

The run ./canvas.

macOS

Install some dependencies:

brew install cmake sdl2 sdl2_image sdl2_ttf portaudio libsndfile

I had trouble with the fftw homebrew package (at least on M1), so here's how to build it yourself:

wget https://www.fftw.org/fftw-3.3.9.tar.gz
tar -xzf fftw-3.3.9.tar.gz
cd fftw-3.3.9
./configure --enable-float
make
sudo make install

To build:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make

Then run ./canvas.

Running tests

git lfs checkout
pytest tests --executable <executable>

canvas's People

Contributors

nhthn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

michal-cab

canvas's Issues

Add controls to reverb filter

As a user, I want to be able to control the decay time, damping, and dry/wet mix of the reverb beyond default settings.

AC:

  • When clicking on the "reverb" filter, a menu should pop out with decay time, damping, and dry/wet sliders.
  • There should be an "Apply" button that actually runs the filter.

Add transport

As a user, I would like to be able to stop and start playback and control speed.

AC:

  • Speed slider
  • Stop and play controls

Crash when running "Render audio" more than once

canvas: malloc.c:2539: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Optimization of Synth

Right now Synth uses a ton of CPU, find ways to vectorize computation.

  • Add Google Bench library
  • Add libsimdpp
  • Vectorize Oscillator

Add delay filter

As a user, I would like to add a delay effect to audio with a pitch shifter built in the feedback loop.

AC:

  • Delay filter with feedback, stereo, cutoff, resonance, shift
  • Feedback does the obvious thing
  • Stereo controls difference in delay line sizes
  • Cutoff is the cutoff of an LPF in the feedback loop
  • Resonance is the resonance of the LPF
  • Shift is the shift in the feedback loop in pixels

Fix double-sized window on macOS HiDPI

A macOS user on a HiDPI screen reported a window twice as large as it should be. Mouse events occur at half the coordinates of the actual mouse position, rendering the app nearly unusable.

Auto-speed setting in both turbo mode and GUI

As a GUI user, I would like audio import to have an "Auto speed" checkbox that results in the Speed slider being automatically set to match the speed of the audio.

As a turbo mode user, I would like the absence of the -s --speed marker to indicate auto speed mode when both importing and exporting audio.

Add preverb filter

As a user, I would like to add a reverse reverb effect to my sound.

AC:

  • Checkbox added to Reverb popup
  • Checkbox reverses computation of filter row-wise

Load audio with FFT

As a user, I would like to load audio spectrogram-style to create a replica of the input sound.

AC:

  • App::loadAudio loads audio using libsndfile
  • Loaded audio is Hann-windowed by as many frames as there are pixels, and run through FFT using FFTW
  • Magnitude spectrogram is converted from linear to log using triangular windows
  • Log magnitude spectrogram is normalized and used as image

Add harmonics filter

As a user, I would like to add harmonics to a signal.

AC:

  • Harmonics filter added to toolbox
  • Four sliders for amplitudes of four harmonics

Non-sine wave tones

via...

  • Phase distortion, multiple algorithms?
  • FM synthesis?
  • Classic analog waveforms?

Currently leaning PD for now.

Add spray brush

AC:

  • Brush places pixels randomly with random alpha
  • Gaussian distribution of X and Y displacement from center
  • Horizontally aligned Draw/Erase/Spray buttons at top (or Draw/Erase, Spray/HLine?)

Add auto-filter

As a user, I would like to apply a filter to audio with choice of LPF, BPF, HPF, and notch filters, with the cutoff modulated by an LFO.

AC:

  • Auto-filter added to list.
  • Mode parameter has selection of LPF, BPF, HPF, notch.
  • Cutoff parameter
  • Resonance parameter
  • LFO rate
  • LFO depth
  • LFO shape

Add tremolo filter

As a user, I would like a filter that adds a spectrally uniform repeating envelope to the sound, with support for multiple envelope shapes and stereo.

AC:

  • Tremolo effect added to filters list, with rate, depth, shape, and stereo controls
  • Rate controls frequency of tremolo
  • Depth controls depth of tremolo
  • Shape controls shape of tremolo
  • Shape options are sine, triangle, saw, ramp, and square
  • Stereo controls phase offset of LFOs between left and right channels

Turbo mode

As a user, I would like a batch mode that lets me import or export sounds and images and apply filters to them.

As a developer, I would like a command-line interface to assist with integration testing.

Acceptance criteria:

  • Refactor to separate App from loading and saving functionality
  • App supports --batch command-line mode
  • Batch mode supports image and sound import/export
  • Batch mode supports filters via --filter argument: --filter subharmonics(0.5,0.3,0.2,0.1,true)
  • Multiple filters supported: --filter reverb(0.5,0.4) --filter scale_filter(C#,harmonic_minor)

Build .dmg files for macOS

  • Buy an Apple developer license
  • Build .dmg file for x86_64 architecture
  • Build .dmg file for arm64 architecture

Add repeat effect

As a user, I would like to apply a repeat effect to audio similar to Ableton Live's Beat Repeat stock plugin (or a cruder version of it).

AC:

  • Repeat effect popup added
  • "Length" parameter controls length of repeat
  • "Count" parameter controls number of counts
  • "Probability" parameter controls probability of repeat

Make window resizable

As a user, I would like to resize the window and have the application behave correctly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.