Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noise oscillator. #24

Open
magnetophon opened this issue Aug 13, 2020 · 7 comments
Open

Noise oscillator. #24

magnetophon opened this issue Aug 13, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@magnetophon
Copy link
Owner

I replaced the sine oscillator with a sine-noise oscillator.

When index is 0, you hear a sine, just like with all the other oscillators.
When index is between 0 and 0.5, it smoothly morphs into band-pass noise at the freq of the oscillator.
When index is between 0.5 and 1, it crossfades into low-pass noise.

Let me know what you think.

@magnetophon
Copy link
Owner Author

Some observations:

  • I made sure the noise is mono when all L-R-offset parameters are at 0.
  • The band-pass noise has the same center frequency as the osc
  • With index at 0.75, the noise has an uniform spectrum and drops off sharply at the osc freq
  • With a higher index, the cutoff appears to be lower.

This is all the result of some trial and error coding, but I really like it, and it allows for a lot of different noise characters.

@ryukau
Copy link

ryukau commented Aug 14, 2020

I like the sound a lot.

Could you also add Sine-Pulse, which uses same mechanics as Sine-Noise, but with lf_pulsetrain or pulsetrain?

Not sure if it makes much difference, but I think Sine-Velvet with velvet_noise is also worth experimenting.

@magnetophon
Copy link
Owner Author

magnetophon commented Aug 14, 2020

I like the sound a lot.

Cool, thanks!

Could you also add Sine-Pulse, which uses same mechanics as Sine-Noise, but with lf_pulsetrain or pulsetrain?

Not sure how that would work. Did you look at the implementation of sine-noise?
With index between 0 and 0.5 I add more and more ring-modulation:
index==0 gives the sine,
index==0.25 gives sine*(0.5+(noise*0.5))
and index==0.5 gives sine*noise.
Between 0.5 and 1, I cross-fade between sine*noise and just noise.

I can do that with pulsetrain too, but as soon as index is higher than 0 you'll get a bit of 20Khz in the sound, so no smooth transition between sine and pulse.

What are we trying to achieve here, and how should I do it?

Not sure if it makes much difference, but I think Sine-Velvet with velvet_noise is also worth experimenting.

Velvet-noise sounds interesting on it's own.
Maybe I'll experiment with it some more later.

I don't have high hopes for a good sound though:

  • It is made of impulses, so it's always full spectrum
  • This means that if I combine it with the sine in some way, even a little bit will make the sine have bits of full-spectrum.
    I can crossfade, ring-mod or PM to combine it with the sine, but I'm afraid all of those will introduce high frequencies as soon as you increase index higher then 0.
    Any other ideas on how to combine?
  • I could add a filter before combining with the sine, but then most energy will disapear (I think, din't try it yet), because it's made of impulses. You can also hear that most energy is in the high freqs.
  • I don't know how to make it mono:
    As soon as you change the freq L-R-offset, the noise will turn stereo, which is good, but when you then set all L-R-offsets back to 0 the internal oscillators of the left and right noise-source will be out of sync, and will never e in sync again until you restart the synth.
    For that reason sine-noise doesn't have an osc to clock the noise, like lfnoise , but is synced to master instead.

@ryukau
Copy link

ryukau commented Aug 15, 2020

I made proof of concept implementation of Sin-Pulse and Sin-Velvet. I'm not sure if this is usable as is to DigiDrie. I leave the decision to you to include these oscillator or not.

// Sin-Pulse
import("stdfaust.lib");

sinpulse(fund, index) = out with {
  index2freq(i) = ((i - i') * ma.SR) : ba.sAndH(abs(i - i') < 0.5)
    : int : max(20) : min(ma.SR * .5);
  freq = index2freq(fund) / 2;
  i0 = 2 * index : min(1);
  cut = freq, ma.SR / 2 : si.interpolate(i0);
  it = os.pulsetrain(freq, index : max(0.5)) : fi.lowpass(1, cut);
  sn = sin(2 * ma.PI * fund);
  out = sn, it : si.interpolate(i0);
};

freq = hslider("freq", 100, 20, 4000, 1e-5) : si.smoo;
index = hslider("index", 0, 0, 1, 1e-5) : si.smoo;
process = sinpulse(os.lf_saw(freq) * 0.5 + 0.5, index) <: _, _;
// Sin-Velvet
import("stdfaust.lib");

sinvelvet(fund, index) = out with {
  index2freq(i) = ((i - i') * ma.SR) : ba.sAndH(abs(i - i') < 0.5)
    : int : max(20) : min(ma.SR * .5);
  freq = index2freq(fund);
  i0 = 2 * index : min(1);
  i1 = 2 * index - 1 : max(0);
  cut = 20, freq : si.interpolate(i0 * i0), ma.SR / 2 : si.interpolate(i1 * i1);
  out = sin(2 * ma.PI * fund), no.noise
    : si.interpolate(i0), no.velvet_noise(1, freq)
    : si.interpolate(i1)
    : fi.lowpass(1, cut);
};

freq = hslider("freq", 100, 20, 4000, 1e-5) : si.smoo;
index = hslider("index", 0, 0, 1, 1e-5) : si.smoo;
process = sinvelvet(os.lf_saw(freq) * 0.5 + 0.5, index) <: _, _;

For Sin-Velvet, another possibility is to apply almost oscillating band pass at note frequency (output of index2freq), and changes band width of filter with index.

I could add a filter before combining with the sine, but then most energy will disapear (I think, din't try it yet), because it's made of impulses. You can also hear that most energy is in the high freqs.

This is true at least to my ear. When applied filter to velvet nosie, the output becomes almost quiet at lower cutoff frequencies.

I don't know how to make it mono:

This is certainly a problem. If I understand correctly, there's no way to sync velvet noise once it becomes out of sync, unless we can supply seed value. I'm personally OK with stereo desync for noise oscillators, but if you think this is not suitable to DigiDrie, feel free to omit it.

@magnetophon
Copy link
Owner Author

I really like the deterministic output of the synth:
If you send it the same midi, (and you have freefloatosc turned off,) you will get almost exactly the same audio every time.

If you use the sine-noise osc, the audio also depends on how long the synth is running, since the output of no.noise is deterministic, but depends on how long the code is running.

Maybe I should make that optional too: I could make a noise-source that retriggers with every note, and then make a switch to choose between the two noise sources.

What do you think?

I'm personally OK with stereo desync for noise oscillators

As explained above: I don't like that.
When all the L-R-offsets are 0, I would really like the synth to be 100% mono.
Going from mono to stereo (and back) under the control of a knob is an important creative effect,I think.

I looked into the implementation of velvet noise, and we could make it deterministic by clocking it to master.
Maybe I'll try that later.
Feel free to implement it yourself, though!

@ryukau
Copy link

ryukau commented Aug 18, 2020

Maybe I should make that optional too: I could make a noise-source that retriggers with every note, and then > make a switch to choose between the two noise sources.

What do you think?

This is a nice option to have. Also, could Sin-Noise reset option be unified to freefloatosc?

@magnetophon
Copy link
Owner Author

Also, could Sin-Noise reset option be unified to freefloatosc?

I was thinking about that as well.

@ryukau ryukau added the enhancement New feature or request label Jul 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants