Giter Site home page Giter Site logo

luomor-ai / signalflow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ideoforms/signalflow

0.0 1.0 0.0 3.9 MB

An audio synthesis framework for Python and C++, designed for clear and concise expression of complex musical ideas

License: MIT License

C++ 93.23% C 0.10% Python 4.94% Objective-C++ 0.29% Shell 0.26% Objective-C 0.01% CMake 1.18%

signalflow's Introduction

SignalFlow

ci

SignalFlow is an audio synthesis framework designed for clear and concise expression of complex musical ideas. Its core is written in C++, with a complete Python interface, and so can be used for audio experimentation in iPython/Jupyter or embedded into cross-platform applications.

SignalFlow is in alpha status. All interfaces may be subject to change.

Example

from signalflow import *

#--------------------------------------------------------------------------------
# An AudioGraph is made up of a network of interconnected Nodes, which generate
# and process audio. 
#--------------------------------------------------------------------------------
graph = AudioGraph(start=True)

#--------------------------------------------------------------------------------
# Passing an array of frequencies creates a stereo output.
#--------------------------------------------------------------------------------
sine = SineOscillator([440, 880])

#--------------------------------------------------------------------------------
# Simple attack/sustain/release envelope with linear curves.
#--------------------------------------------------------------------------------
env = EnvelopeASR(0.01, 0.1, 0.5)

#--------------------------------------------------------------------------------
# Use standard arithmetic operations to combine signals. When a multi-channel 
# signal is multiplied by a mono signal, the mono signal is auto-upmixed.
#--------------------------------------------------------------------------------
output = sine * env

#--------------------------------------------------------------------------------
# Connect the output to the graph, and begin playback.
#--------------------------------------------------------------------------------
graph.play(output)
graph.wait()

To do the same in C++:

#include <signalflow/signalflow.h>
using namespace signalflow;

/*------------------------------------------------------------------------
 * Classes ending in *Ref are subclasses of std::shared_ptr which
 * automatically handle memory management.
 *-----------------------------------------------------------------------*/
AudioGraphRef graph = new AudioGraph();

NodeRef sine = new SineOscillator({ 440, 880 });
NodeRef env = new EnvelopeASR(0.01, 0.1, 0.5);
NodeRef ping = sine * env;

graph->play(ping);
graph->start();
graph->wait();

Installation

Dependencies

macOS

brew install python libsndfile libsoundio

Linux, Raspberry Pi

apt-get install git cmake g++ python3-pip libasound2-dev libsndfile1-dev libsoundio-dev fftw3-dev

If you experience an error on Raspberry Pi libf77blas.so.3: cannot open shared object file:

sudo apt-get install libatlas-base-dev

Windows

This is work in progress.

Currently, dependencies need to be downloaded and built by hand. These can be placed anywhere.

Build (Python)

python3 setup.py build
python3 setup.py test
python3 setup.py install

Build (C++)

mkdir build
cd build
cmake ..
make -j8

Build (Windows)

Use CMake GUI to build signalflow. Press configure and you will see three empty fields to fill in with the path to the two build folders and the FFTW binaries folder (see above). Set these parameters then press Configure, then Generate then Open. Then build in Visual Studio 2019.

As of 2021-03-03, only the signalflow project has been ported to build correctly on Windows. Only tested in x64 and for Debug builds. Tested using Visual Studio 2019.

Examples

See examples for a number of example programs.

To run an example:

cd build
./hello-world

Documentation

Documentation is in the works.

Node classes

The following Node classes are currently available:

Abs
Add
AllpassDelay
AmplitudeToDecibels
AudioIn
AudioOut_Abstract
    AudioOut
    AudioOut_Dummy
BiquadFilter
BufferPlayer
BufferRecorder
ChannelArray
ChannelMixer
ChannelSelect
Clip
ClockDivider
CombDelay
Compressor
Constant
Counter
CrossCorrelate
DecibelsToAmplitude
Divide
EQ
Envelope
EnvelopeADSR
EnvelopeASR
Equal
Euclidean
FFT
FFTContinuousPhaseVocoder
FFTConvolve
FFTFindPeaks
FFTLPF
FFTPhaseVocoder
FFTTonality
FlipFlop
Fold
Gate
Granulator
GreaterThan
GreaterThanOrEqual
IFFT
If
Impulse
ImpulseSequence
Index
LFO
Latch
LessThan
LessThanOrEqual
Line
LinearPanner
Logistic
Maximiser
MidiNoteToFrequency
Modulo
MoogVCF
MouseDown
MouseX
MouseY
Multiply
NotEqual
OneTapDelay
OnsetDetector
Pow
RMS
Resample
RoundToScale
SVFFilter
SampleAndHold
Saw
SawLFO
ScaleLinExp
ScaleLinLin
Sine
SineLFO
Smooth
Square
SquareLFO
Squiz
StereoBalance
StereoWidth
StochasticNode
    PinkNoise
    RandomBrownian
    RandomCoin
    RandomExponential
    RandomExponentialDist
    RandomGaussian
    RandomImpulse
    RandomImpulseSequence
    RandomUniform
    WhiteNoise
Stutter
Subtract
Sum
Tanh
Triangle
TriangleLFO
WaveShaper
Wavetable
Wavetable2D
WetDry
Wrap

signalflow's People

Contributors

ideoforms avatar

Watchers

James Cloos avatar

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.