Skip to content

transcriptaze/snyth

Repository files navigation

snyth

tl;dr: the web app is here and there is a basic user guide here.

Be warned, it's just barely alpha software so expect rough edges and also please see the notes for things like browser compatibility (basically Chrome is ok, mostly) and MIDI files.

For the only mildly curious, there are a couple of basic YouTube demo videos:

snyth is an experimental additive synthesizer that uses the Jacobi ellipse as the generator function. By adjusting the eccentricity, rotation and horizontal shift of an ellipse a single oscillator can morph smoothly and intuitively between sine, square, triangular and sawtooth waveforms.

sine square
triangular sawtooth

The canonical snyth experience:

  1. Power up.
  2. Hit Reset to reset everything to the most basic synthesizer.
  3. Start the Take Five MIDI (3rd slot from the top on the retro cassette tape).
  4. And then just play with the controls to hear it come alive as you add harmonics and distortions.

Please bear in mind that this is still very early stage and experimental. Have fun!

Background

At it's most basic, additive audio synthesis typically starts with four basic functions:

  • sine
  • square
  • triangular
  • sawtooth

which are then summed, filtered, modulated, distorted and otherwise shaped to create the desired ouput sound (e.g. DSP function used by musical distortion plugins [13]). As commonly presented, the square, triangular and sawtooth waveforms are the theoretical result and practical implementation of summing an infinity of sine waves to generate a harmonically rich sound.

Mathematically though, a sine can be seen as a special case of a Jacobi elliptic sn function in the same way that a circle is a special case of an ellipse. From there, it's a small step from using a circle as a generator function for a sine wave to using the Jacobi sn function and corresponding Jacobi ellipse as a harmonically rich generator function for an audio oscillator.

The Wikipedia page on the Jacobi ellipse [1] makes this a bit clearer, although the explanation in Elliptic functions as trigonometry [2] is substantially easier to follow.

Some points of interest:

  • A sine is of course a special case of an ellipse with eccentricity 0.
  • Ellipses with eccentricities approaching -1 and +1 approximate the square and triangular functions (shown above).
  • An ellipse with an eccentricity between 0 and -1 squashes the wave into a shape with round shoulders that is very characteristic of valve distortion.
  • An ellipse with an eccentricity between 0 and 1 squishes the sine into a shape reminiscent of the distortion characteristic of early transistor amplifiers.
  • A sawtooth is an asymmetric waveform which can't be directly approximated using an ellipse that is symmetric about the origin, but shifting the ellipse along the horizontal axis does a reasonable job (although it's not at all clear what the maths is doing - probably just huddled in a corner in horror). Stacking two sn waves and playing carefully with the settings produces a quite credible waveform.
  • The square wave is continuous and continuously differentiable (which a real square wave is not) right up to the limit at which the eccentricity is exactly ±1.

Summary

All of which means that the four separate oscillator functions can be replaced by a single not-very-complicated function that can be smoothly varied across it's range e.g. using a VCA.

Generalising to other shapes

In 2023, there's more to life than ellipses and with the merest smidgeon of hand-waving it's possible to extend the concept to other shapes. Audio-wise, the other shapes are more visually entertaining than acoustically radical but can be useful when creating a curve for use as an LFO. Or of course for creating that idiosyncratic sound that is yours alone.

Polygons

Shapes that identify as convex polygons are relatively straightforward to implement and the web app includes two additional shapes:

  • square
  • cowbell

Concave polygons have some weird edge cases though and need a bit more thought but should hopefully make into a release quite soon.

Getting Started

The web app is the easiest but if you want to run it locally the Releases section has executables for:

  • Linux
  • MacOS
  • Windows

Download the executable for your operating system to the folder of your choice, run it and then open http://localhost:9000 in a web browser.

Building from source

Required tools:

NOTES:

  1. apt install sass on Ubuntu installs ruby-sass which was marked obsolete in 2019. Please follow the installation instructions on the Sass homepage to install the current version._

  2. The make build uses eslint and eslint_config_standard. eslint_config_standard is a dev dependency and should be installed locally in the project:

    • Initial project setup:
git clone --recurse-submodules https://github.com/transcriptaze/snyth.git
cd snyth
  • To build using the included Makefile:
cd snyth-js
make build
cd ../snythd
make build
make debug
  • Without using make:
cd snyth-js
sass --no-source-map sass/themes:html/css
cd ../snythd
go fmt ./...
mkdir -p bin
go build -mod readonly --trimpath -o bin ./...
./bin/snythd --debug --html ../snyth-js/html

Waivers and Demurrers

This seems to be a relatively unexplored approach which is surprising considering the basic simplicity. It's quite possibly just lurking somewhere under a different name, but the only related work I've stumbled across so far is:

Contributing

This is an umbrella repository and all the actual code lives in submodules:

  • snyth-js for the HTML, CSS and Javascript source that go to make up the web app. The actual web-app is a rollup'd version of this repo.
  • snyth-pd is a basic implementation in PureData. At the moment there isn't much beyond a basic working demo.
  • snyth-supercollider is a Supercollider UGen for the basic sn function and a couple of demo scripts.
  • sn-vcv is a set of VCV Rack modules that implement a VCO and LFO for the sn function.

Please see the READMEs for the respective modules for submitting bug reports, issues, feature requests, etc.

MIDI

It would be great to have a selection of really good demo MIDI files but it's probably legally murky unless the arrangements are clearly copyright free. Having said which, if you do have a MIDI file that you would like to share:

  1. Please create a pull request against the MIDI branch of this repository.
  2. The pull request should:
    • Update the MIDI files list with a link to where the MIDI file is hosted
    • Include the MIDI file
    • Include a snyth.json file
  3. After merging the pull request the MIDI files themselves will be stashed somewhere safe (but in good company) until the legal situation is clearer.

Arrangements of classical music are mostly copyright free but be aware that some are copyrighted by the arranger.

Licensing

Everything in this repository and all it's submodules is licensed under GPL-3.0.

References and Related

1. Jacobi_elliptic_functions
2. Elliptic functions as trigonometry
3. Lance Putnam: The Harmonic Pattern Function: A Mathematical Model Integrating Synthesis of Sound and Graphical Patterns
4. Lance Putnam: List of Publications
5. The history of the universe is an elliptic curve
6. The Synthesis of Environmental Sound Textures by Iterated Nonlinear Functions and its Ecological Relevance to Perceptual Modeling
7. Iterated Nonlinear Functions as a Sound Generating
8. SuperCollider:GFIS
9. Mathematicians Complete Quest to Build Spherical Cubes
10. Chaos Theory for Synthesizers
11. Introduction to the Transcendent Waveform Analog Oscillator
12. Spatial Audio, Francis Rumsey
13. DSP function used by musical distortion plugins
13. Poly Rhythms

Attributions

  1. FFT by Project Nayuki.
  2. The Greensleeves Too MIDI is based on Charles Duncan's fingerstyle guitar arrangement.
  3. Loop, settings and info icons by onlinewebfonts.com.
  4. Save icon (https://www.iconarchive.com/show/flatwoken-icons-by-alecive/Apps-File-Save-icon.html)
  5. Sound wave icon (https://clipground.com/images/sound-wave-icon-png.png)

About

Experimental additive synthesiser using Jacobi ellipses as generator functions.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published