Giter Club home page Giter Club logo

squinewave's Introduction

Squinewave

Author: rasmus

A sine-square-saw-pulse morphing oscillator with hardsync.
Implemented for CSound, SuperCollider, Voltage Modular.

Each implementation is basically the same, but in slightly different environments.

Squinewave algorithm

Just cosine sweeps and flat parts.
The waveform is shaped by 2 params: clip and skew:

  • Clip "squareness" of waveform shape. Range: 0.0 - 1.0.
    • Clip 0 is sinewave (or saw), clip 1 is squarewave (or pulse).
  • Skew symmetry of waveform shape. Range: -1 to +1.
    • Skew = 0 is symmetric like sine or square. Skew +1 or -1 is right/left-facing saw or pulse.

Hardsync

When a trigger is received, frequency is raised very quickly until next cycle.
This creates a short sine pulse (0-20 samples), depending on current waveform phase.

Optionally emit a hardsync trigger each cycle.
(Tip: Chain sync output to next Squinewave, for hardsync bursts, since sync output is emitted after its own sync sweep).

Bandlimited - not by filtering

This is ensured by init config parameter MinSweep, a minimal sample count of rise/fall shapes.
Recommended range 5-15 samps (randomized per unit). Legal range 4 - 100.

Eg, a squarewave or the front of a saw starts with a very short cosine sweep, 5-10 samples.

  • On higher frequency the MinSweep is held, so all waveforms "degrade" to sinewave.
    Hence no aliasing on higher freq square or pulse waveform.

The cost of generating a sample is 1 cos() call and some if-then switching.
But generally you can skip one low-pass filter in your synth patch, since reducing clip dampens the spectrum.

Guarantee

If frequency, clip and skew are generated by smooth signals like sinewave or Squinewave, the output is bandlimited in almost all configurations, including high index FM with hardsync.

Notes

Unlike BLEP techniques this has no ripples. The waveform is clean and stable, works both as LFO and as carrier/modulator in FM setups. The waveform shaping extends the palette of standard FM nicely.

In all modesty this could replace most sine and square oscillators in every softsynth ever.

There is no license in this repo.

squinewave's People

Contributors

rasmus-e avatar required-field avatar

Watchers

 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.