sfizz icon indicating copy to clipboard operation
sfizz copied to clipboard

Effects

Open jpcima opened this issue 4 years ago • 16 comments

Let's fill in some info regarding effects as we figure out the implementation and controls, on wiki as well as here.

  • [x] filter
  • [x] strings
  • [x] eq
  • [ ] phaser
  • [ ] delay
  • [x] lofi
  • [x] gate
  • [x] comp
  • [ ] static
  • [ ] tdfir
  • [x] apan, known in book as autopan
  • [x] fverb
  • [ ] mverb
  • [x] disto
  • [x] limiter

jpcima avatar Feb 21 '20 10:02 jpcima

Add image: Bitred reference vs Oversampling 2x bitred2x

jpcima avatar Feb 21 '20 10:02 jpcima

For the Gibbs type effect on these, and also for LFOs synthesis, I recall something I studied at one point from this article right here. Searching back for it I found a master's thesis which might be more pedagogical in the approach. The required polynomials could possibly be tabulated.

I'll cross-post this in the LFO discussion.

paulfd avatar Feb 26 '20 11:02 paulfd

It seems another instance of the same processes used in music DSP, expressed in different ways. (you know, the usual :grin:) I list you a few refs that are oriented towards this problem. Minimum phase band limited step Polynomial band limited step Band limited ramp

I've also posted a plugin that contain some slightly improved implementations of these effects. (has a basic step function and oversampling) https://gitlab.com/jpcima/bitcrusher

jpcima avatar Feb 26 '20 12:02 jpcima

To elaborate on this matter of bitcrushing/lofi effects:

Anti-aliasing is not critical in these effects, they are a part of the tone. I have it, Cakewalk has it also. The thing is that antialising behavior is not controlled in such a way that both of effects match, you can hear a very evident tone difference between both, despite the waves more or less matching visually on the scope.

For now, the "big boss" of effects is the strings one. It'll be nice if RGC can provide info of what this one really is.

I suspect it to be in fact a convolution with a fixed IR signal. As I tested it on simple signals, the parameter strings_number did not seem to affect anything. The piano paper above links a webpage with a IR file of Steinway piano. http://research.spa.aalto.fi/publications/papers/dafx08-pedal/

(on this topic, there exist also an IR convolver effect in the lot, that accepts a sound file.)

jpcima avatar Feb 26 '20 15:02 jpcima

The strings effect is a sympathetic string resonator.

To make it, one has to instantiate N waveguide string oscillators in parallel. It's physical models which are tuned starting at the note C1 and up from there. There are as many of them as the opcode strings_number indicates, 36 being typical. strings_wet_onccN (0-100) sets the strength of resonance.

The dry signal is fed as excitation signal into the waveguide oscillator bank to make them generate, and then outputs are summed with the dry signal.

The harmonics have a more of less strong damping, so the input must not be applied equally, it must have its gain adapted by harmonic. Secondly, a sound should only strongly resonate with other strings which are harmonically related to its fundamental.

Jaffe 1983 Smith 1993

jpcima avatar Mar 02 '20 12:03 jpcima

I guess this is closed by #84 or do you want to keep it to track additional effects? This string resonator sounds interesting.

The harmonics have a more of less strong damping, so the input must not be applied equally, it must have its gain adapted by harmonic.

If I had to and without checking the state of the art, I would do string resonance by creating a "basis" of resonance for each note in the piano using their reference frequency, interpolate this over frequency, and then use the spectrogram as a impulse to act as a gain on the basis components.

paulfd avatar Mar 08 '20 00:03 paulfd

do you want to keep it to track additional effects?

Yes.

If I had to and without checking the state of the art, I would do string resonance by creating a "basis" of resonance for each note in the piano using their reference frequency, interpolate this over frequency, and then use the spectrogram as a impulse to act as a gain on the basis components.

It sounds an interesting idea. Do you want to extract this information based on existing piano sample sets?

jpcima avatar Mar 08 '20 00:03 jpcima

srings is very much a piano resonance opcode.

It would be exciting to have in future either a custom_mode for strings or a strings_custom opcode, which would allow setting custom tuned frequencies of multiple waveguides. (To allow Sitar etc sort of resonance)

alcomposer avatar Mar 08 '20 07:03 alcomposer

Below are measurements of the disto effect for depth=0 (default) to depth=100. This is an amplitude transfer function. (with X input signal and Y the output)

It can be seen the function is symmetric but it works like a schmitt trigger. When the function goes over ±3/4 amplitude, it switches to the other curve. The steepness of this curve is varied by disto_depth.

Also there's a spiral effect at the start, which may have something to do with filtering part of this effect. (disto_tone 0-100)

dataset.zip

default depth=0 depth=25 depth=50 depth=75 depth=100

jpcima avatar Mar 08 '20 20:03 jpcima

I attach the disto curves, cleaned and both parts separated, to use it for curve fitting. Link of model to use: https://en.wikipedia.org/wiki/Generalised_logistic_function

disto-separated.tar.gz

jpcima avatar Mar 26 '20 14:03 jpcima

An initial curve fit with 3 parameters. Not too bad for a start. curvefit.py.gz curvefit2.py.gz

jpcima avatar Mar 27 '20 17:03 jpcima

Attaching the current experimental fverb fverb5.dsp.gz ~~fverb4.dsp.gz~~ ~~fverb3.dsp.gz~~ ~~fverb2.dsp.gz~~

jpcima avatar Mar 31 '20 08:03 jpcima

We have 4 new entries recently

  • comp
  • gate
  • disto
  • fverb

@paulfd, feel free examining any of these if you want

Regarding fverb, there remains to do:

  • to better adjust the various reverb types and their parameters; notably their respective diffusions, the tail density
  • to consider adding types for Rapture-only reverbs: stereo_large_hall, spring, ambience, stereo_er
  • to add early reflections support. cf. James Moorer http://freeverb3vst.mobile.osdn.jp/doc/aboutThisReverberationBusiness.pdf

jpcima avatar Aug 06 '20 14:08 jpcima

Hi @jpcima @paulfd, could you elaborate on how these effects are to be used in sfizz?

We are building sfizz as a standalone (non-VST etc.) library and would like to use the same set of (piano) samples in two ways: one with reverb with certain parameters and one without (or with different reverb parameters).

From what I saw in #84 these effects seem to be specified in the sfz file. Is there a way to add/alter them programatically as well via the public C/C++ API? If not, are there any examples you could point me to of how to correctly set up the parameters in the sfz file(s)? (The reverb effect in particular would be extremely useful).

ephemer avatar Sep 07 '21 17:09 ephemer

Hi, sorry I missed this comment. There is no way to add effects programmatically for now, although the OSC interface might be extended for this (if you feel like it you may do so !).

In an SFZ file, here is a very minimal example adding the fverb effect on the main bus.

<region>
    sample=*sine

<effect> 
    type=fverb
    reverb_input=100
    reverb_dry=100
    reverb_wet=10 

We could probably have better defaults for the reverb, but these will make it sound :) You can consult sfzformat.com for other effects and their opcodes. Right now there are no effect modulation but these will come.

paulfd avatar Nov 09 '21 14:11 paulfd