All Projects → thi-ng → Synstack

thi-ng / Synstack

Licence: apache-2.0
Modular soft synth & Forth based VM for audio DSL experiments

Programming Languages

c
50402 projects - #5 most used programming language
forth
179 projects

Projects that are alternatives of or similar to Synstack

Q
C++ Library for Audio Digital Signal Processing
Stars: ✭ 481 (+508.86%)
Mutual labels:  audio, dsp, synth
Dx7 Supercollider
My accurate Yamaha DX-7 clone. Programmed in Supercollider.
Stars: ✭ 395 (+400%)
Mutual labels:  audio, dsp, synth
Jssynth
Make music in your browser with this synthesizer and sequencer
Stars: ✭ 25 (-68.35%)
Mutual labels:  audio, synth
Awesome Musicdsp
A curated list of my favourite music DSP and audio programming resources
Stars: ✭ 871 (+1002.53%)
Mutual labels:  audio, dsp
Centsdr
CentSDR: tiny handheld standalone software defined receiver with LCD display.
Stars: ✭ 76 (-3.8%)
Mutual labels:  stm32, dsp
Daw
GridSound (0.33.0) wants to be an open source online digital audio workstation following the new WebAudio API 🎛🎹🎵✨
Stars: ✭ 804 (+917.72%)
Mutual labels:  audio, synth
Foo uie dsp switcher
A dropdown combobox for changing DSP presets quickly. For foobar2000 0.9+
Stars: ✭ 5 (-93.67%)
Mutual labels:  audio, dsp
Ws Ldn 4
Interactive DIY Synth / ARM baremetal workshop (London, 23-24 January 2016)
Stars: ✭ 36 (-54.43%)
Mutual labels:  audio, synth
Vst2
Bindings for vst2 sdk
Stars: ✭ 39 (-50.63%)
Mutual labels:  audio, dsp
Ebur128
Implementation of the EBU R128 loudness standard
Stars: ✭ 43 (-45.57%)
Mutual labels:  audio, dsp
Baseplug
MVC audio plugin framework for rust
Stars: ✭ 44 (-44.3%)
Mutual labels:  audio, dsp
Roc Toolkit
Real-time audio streaming over the network.
Stars: ✭ 673 (+751.9%)
Mutual labels:  audio, dsp
Webaudiofont
Use full GM set of musical instruments to play MIDI and single sounds or effects. Support for reverberation and equaliser. No plugins, no Flash. Pure HTML5 implementation compatible with desktop and mobile browser. See live examples.
Stars: ✭ 600 (+659.49%)
Mutual labels:  audio, synth
Pyo
Python DSP module
Stars: ✭ 904 (+1044.3%)
Mutual labels:  audio, dsp
Hifiberry Os
Linux distribution optimized for audio playback
Stars: ✭ 487 (+516.46%)
Mutual labels:  audio, dsp
Guitard
Node based multi effects audio processor
Stars: ✭ 31 (-60.76%)
Mutual labels:  audio, dsp
Voiceoffaust
Turn your voice into a synthesizer!
Stars: ✭ 55 (-30.38%)
Mutual labels:  dsp, synth
Romplayer
AudioKit Sample Player (ROM Player) - EXS24, Sound Font, Wave Player
Stars: ✭ 445 (+463.29%)
Mutual labels:  audio, synth
Librosa
Python library for audio and music analysis
Stars: ✭ 4,901 (+6103.8%)
Mutual labels:  audio, dsp
Kfr
Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Stars: ✭ 985 (+1146.84%)
Mutual labels:  audio, dsp
  • thi.ng/synstack

Softsynth engine for tiny & not-so-tiny devices...

** Contents :toc_3_gh:

  • [[#thingsynstack][thi.ng/synstack]]
    • [[#overview][Overview]]
      • [[#node-dag-synth-engine][Node DAG synth engine]]
      • [[#forth-like-vm-based-synth][Forth-like VM based synth]]
    • [[#build-instructions][Build instructions]]
    • [[#examples][Examples]]
      • [[#interactive-examples][Interactive examples]]
      • [[#forth-repl][Forth REPL]]
    • [[#contributors][Contributors]]
    • [[#license][License]]

** Overview

[[./assets/thing-synstack.jpg]]

Check out: [[http://soundcloud.com/forthcharlie/sets/stm32f4][Demo set with 40+ tracks on Soundcloud]]!

Full project release forthcoming...

Please visit [[https://hackaday.io/project/9374-stm32f4f7-synstack][project log @ Hackaday]] for interim updates, including a PDF with more project details. Thanks!

This repo currently contains two different experimental & easily extensible implementations of a modular soft synth engine, both written in portable C11 and originally developed for the STM32F4/F7 platform. However, for practical reasons (repo size, easier debugging and dev workflow), both versions currently included here were prepared without STM specifics, have been tested on OSX & Linux and [[#examples][include several examples]]. Demo file size after stripping is between ~22-40KB (for 32bit, bit larger for 64bit).

The sub-directories contain:

*** Node DAG synth engine

  • =src= - an earlier (2nd or 3rd) iteration of the CTSS synth engine, using block based operators & node DAG (directed acyclic graph):
    • 10 oscillators (incl. formant & karplus-strong, polyBlep antialiasing)
    • flexibile LFO setup (global LFO & arbitrary per voice)
    • filters (biquad, IIR LP/HP/BP, formant)
    • ADSR
    • foldback distortion
    • buffer ops (sum, product, product sum)
    • mono / stereo delay lines w/ feedback
    • mono / stereo mixdowns (int16 & float)
  • =examples= - examples for this version of the synth (using Portaudio, see below)

*** Forth-like VM based synth

(not embracing ANS Forth standard here):

  • =src_vm= - actual stack VM, interpreter & compiler w/ basic inlining, REPL, core Forth dictionary & basic synth operators (still need to port more from =src=)
  • =examples_vm= - Forth examples (see below)

** Build instructions

Requirements:

  • [[https://premake.github.io/][Premake5]]
  • [[http://www.gnu.org/software/make/][GNU Make]]
  • GCC / Clang (w/ C11 support)

The library itself has no 3rd party dependencies. Some of the examples however use these additional libraries:

  • [[https://github.com/thi-ng/ct-head][ct-head]] (included as submodule)
  • [[http://portaudio.com][Portaudio]] (on OSX can be installed via =brew=)
  • libncurses (part of OSX & Linux)

#+BEGIN_SRC shell git clone --recursive https://github.com/thi-ng/synstack

cd synstack

premake5 gmake

make -f ctss_old.make config=release_sse

make -f ctss_vm.make config=release_sse #+END_SRC

** Examples *** Interactive examples

Use the above build instructions to build all components & examples. Almost all demos in =examples= implement a simple randomized sequence playback (some with multiple voices) and are using the same interactive controls:

| Key | Description | |-------+--------------------| | =-= | dec delay feedback | | =+= | inc delay feedback | | =[= | pitch -2 semitones | | =]= | pitch +2 semitones | | =;= | pitch -12 | | ' | pitch +12 | | =q= | quit |

The two exceptions are:

  • [[./examples/synth_keys.c][synth_keys]] - play a new note with each keypress (fixed sequence, =q= to quit)
  • [[./examples/synth_render.c][synth_render]] - non-interactive demo, creates /sound.wav file (runtime ~20secs)

#+BEGIN_SRC shell

if you followed above build instructions, the demos can be launched like:

bin/release/synth_spiral #+END_SRC

*** Forth REPL

Use the command below to launch the VM with input file. Also see [[./examples_vm/bass-seq.fs][example source code]]. In this mode the VM goes straight into playback mode and is non-interactive (hit =Return= to quit).

#+BEGIN_SRC shell bin/release/repl examples_vm/bass-seq.fs #+END_SRC

To launch the Forth REPL in interactive mode:

#+BEGIN_SRC shell rlwrap bin/release/repl #+END_SRC

There'll be alot of output initially (inlining statistics by the Forth compiler), but no visible input prompt. Try some of the following (hit return after each line, comment lines are prefixed with '\')...

#+BEGIN_SRC forth \ evaluate expression \ forth uses RPN, the '.' word pops & prints the top stack item \ forth is a hybrid between interpreted & compiled execution 1 2 + . \ 3

\ define new word (here to calculate a * b + c) \ the (...) form is a stack effect comment: \ here it means the word consumes 3 items from the stack \ and after execution a new item (result) is on the stack : madd ( a b c -- x ) -rot * + ; 3 5 10 madd . \ 25

\ the VM differentiates between int & float based math \ float ops are prefixed with 'f' : maddf -rot f* f+ ; 3.f 5.f 10.f maddf .f \ 25.0

\ store values in "variables" (labelled addresses) 23 var> foo ! \ get var value foo @ . \ 23

\ by default the VM includes the dictionary of synth related words \ (defined in /src_vm/synth_dict & various C files in /src_vm) \ for example note names map to their frequency A4 .f \ 440.000000

\ convert frequency to ratio of sample rate A4 hz .f \ 0.062689

\ allocate memory for note/chord lookup table C3 E3 G3 A3 4 dup allot dup var> chord ! swap ds>dict!

\ define word to randomly choose note from chord : rand-chord-note ( -- freq ) 0 4 rand chord @ + @ ;

\ call several times rand-chord-note .f rand-chord-note .f rand-chord-note .f

\ disassemble word see> rand-chord-note \ 0x000004da :0x0301a88a docolon \ 0x000004db :0x00000004 lit 0x00000000 \ 0x000004dd :0x00000004 lit 0x00000004 \ 0x000004df :0x00000081 rand \ 0x000004e0 :0x00000004 lit 0x000004d3 \ 0x000004e2 :0x0000002a @ \ 0x000004e3 :0x0000004b + 0x0000002a (0x0000050e ) \ 0x000004e5 :0x00000002 ret

\ display data stack contents with .s 1 2 3 .s

\ display VM stats .vm

\ display list & addresses of all words currently defined \ also see /src_vm/core_dict.h how some control structures \ are defined in forth itself .words

\ display hexdump of VM memory .mem #+END_SRC

** Contributors

| Name | Role | Website | | [[mailto:[email protected]][Karsten Schmidt]] | initiator & principal developer | [[http://thi.ng][thi.ng]] |

** License

This project is open source and licensed under the [[http://www.apache.org/licenses/LICENSE-2.0][Apache Software License 2.0]].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].