Coder Social home page Coder Social logo

Generator wavetables about sfizz HOT 3 CLOSED

sfztools avatar sfztools commented on May 22, 2024
Generator wavetables

from sfizz.

Comments (3)

jpcima avatar jpcima commented on May 22, 2024

EDIT changed size*2+1, a benign mistake I copied everywhere, to size/2+1
also made the triangle wave start upwards instead of downwards

About this I don't know, didn't check against real oscillator, but I remember the LFO triangle was starting going up.

EDIT checked against ARIA, all waves starting upwards, fixed the square also

from sfizz.

jpcima avatar jpcima commented on May 22, 2024

It's implemented in the PR #61
For a short summary of how this thing works:

  • there exists a class HarmonicProfile which is a spectrum generator for any kind of periodic wave.
    You invoke this with successive indices (DFT bin), this returns the amplitude and phase as complex number. It starts at index 1 for fundamental f0, then 2*f0, 3*f0, up to any size.
    The spectrums of conventional waves extend to infinity, that we are able to truncate at whichever point we want.

  • it can generate into an array of any size, by filling a spectrum of the matching size and doing IFFT.
    When parameter cutoff is set at 0.5, the whole harmonic range is generated up to Nyquist, or <0.5 to cut it sooner.

  • there exist multisamples, which wrap this to generate sets of wavetables for different frequency ranges (currently 1 per octave). For each table, this adjusts cutoff such that, when the table is repitched to the range's highest frequency, the scaled harmonics do not exceed Nyquist frequency.

  • one can plot a multisamples with sfizz_test_wavetables and option -m. Pictured below.
    When all is well, the final range of 10-20kHz reduces the signal to a single sine wave.
    plot

  • the demo program permits to listen to an oscillator generated in realtime with a frequency sweep.
    When frequency modulation causes a jump from a wavetable to another, this creates a discontinuity, but I don't find it very perceptible.
    A thing of note: in Cakewalk's oscillators, there exists a quality setting called Dual-High, which permits to interpolate from 2 adjacent wavetables of a multisample, and avoids discontinuity created by such jumps.

  • regarding custom oscillators from sound files, it's not too hard to modify the system to add it.

Example: sample=period.wav oscillator=on

The process is like this:
- receive a sound file as a float span, compute its FFT
(this FFT will likely needs scaling ; divide by the signal size)
- create an instance of a subclass of HarmonicProfile, that will return each component for indices in bounds of the FFT array just computed, otherwise 0
- invoke the method createForHarmonicProfile, like for any other profile of the predefined waves

from sfizz.

paulfd avatar paulfd commented on May 22, 2024

Merged in #61

from sfizz.

Related Issues (20)

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.