Pulsaw dc offset (version 0.9.166)
-
- KVRian
- 563 posts since 23 Nov, 2010
Are you sure? It looks OK here.soapform wrote:just a small bug report, the pulse waveform should probably be centered, but it's not.
thanks
It will show DC offset in the frequency analysis because true PWM waveforms do have pulsewidth dependent DC offset. As the pulsewidth gets away from 50% the waveforms DC offset changes. At either extreme the DC will be larger than the fundamental frequency but, the peak to peak will still be -1 .. +1. It's just a quirk of PWM.
There's a lot of soft synths that do PWM by subtracting 2 out of phase sawtooths, and while that method has no DC offset it doesnt keep it's peak to peak fixed. When the pulsewidth is say 5%, you will have a peak to peak of something like -0.1 .. +1.9 for example.
I chose the former method as I think it sounds better and is more useful.
Thanks,
Chris Jones
www.sonigen.com
www.sonigen.com
-
- KVRist
- Topic Starter
- 44 posts since 23 Feb, 2009
Hm, I don't see why a synth should produce an audio DC when it doesn't have to. I *might* see a point in it if it was to be used for modulation.sonigen wrote:
Are you sure? It looks OK here.
It will show DC offset in the frequency analysis because true PWM waveforms do have pulsewidth dependent DC offset. As the pulsewidth gets away from 50% the waveforms DC offset changes. At either extreme the DC will be larger than the fundamental frequency but, the peak to peak will still be -1 .. +1. It's just a quirk of PWM.
There's a lot of soft synths that do PWM by subtracting 2 out of phase sawtooths, and while that method has no DC offset it doesnt keep it's peak to peak fixed. When the pulsewidth is say 5%, you will have a peak to peak of something like -0.1 .. +1.9 for example.
I chose the former method as I think it sounds better and is more useful.
Thanks,
Just imagine a negative pulsewave added to, say, 2 other similar pulsewaves with different pitches and see that now the sound is always negative, except when all the 3 positive peaks match with each other. Or, add some feedback effect (delay, reverb) after the pulse, and watch your sound stray into the negative.
Besides, why would it sound any different, or better, other than making a *click* in the start or the end of the sound (indicative of DC) when using short attack or release times?
As far as I'm aware, even in analog synths the VCOs produce pulsewaves that go closer to 0 in one end as the pulsewidth is changed, for example:
http://www.youtube.com/watch?v=ybUggNytxyA
LFOs can then produce negative or positive or whatever type of wave. But that's a bad design for an audio VCO.
Shouldn't the amount of DC needed to counter it be easily calculated for your oscillator, without needing to change it to the 2 out-of-phase saw oscillator thingy?
-
- KVRian
- 563 posts since 23 Nov, 2010
In this instance it's extra work to remove it, so there needs to be a good case for doing so.soapform wrote: Hm, I don't see why a synth should produce an audio DC when it doesn't have to. I *might* see a point in it if it was to be used for modulation.
You will get more extreme levels without the DC offset. With the DC the waveform is fixed to the range -1 .. +1, without the DC the output can be anywhere from -2 .. +2.Just imagine a negative pulsewave added to, say, 2 other similar pulsewaves with different pitches and see that now the sound is always negative, except when all the 3 positive peaks match with each other. Or, add some feedback effect (delay, reverb) after the pulse, and watch your sound stray into the negative.
You'll get the same clicks either way. TBH i dont know why it sounds different, it may be nothing to do with the DC but rather that the two methods of generating a PWM sound different. It's such a long time since i worked on the Pulsaw code I dont really remember. But it wasnt an arbitrary choice.Besides, why would it sound any different, or better, other than making a *click* in the start or the end of the sound (indicative of DC) when using short attack or release times?
That's because analog synths are generally AC coupled so the DC is removed at points along the circuit. The actual oscillator has the DC even though it may have been removed by the time it gets to the output.As far as I'm aware, even in analog synths the VCOs produce pulsewaves that go closer to 0 in one end as the pulsewidth is changed, for example:
It's my understanding that this was done to prevent DC levels overloading circuit elements along the path. But this isnt really a problem with floating point DSP code, at least not at these kinds of levels.
I actually have it in my notes somewhere, but to be honest I'm not convinced there's any need to do it.Shouldn't the amount of DC needed to counter it be easily calculated for your oscillator, without needing to change it to the 2 out-of-phase saw oscillator thingy?
Regards,
Chris Jones
www.sonigen.com
www.sonigen.com
-
- KVRist
- Topic Starter
- 44 posts since 23 Feb, 2009
I've just been playing with the pulsaw, I'm kind of growing to like the *clickety click* of the pulse oscillator.
Anyways, I guess I can live with the oscillator being this way, just have to remember to high pass the Sonigen output so it won't start to build up down the line.
That is correct for one note sounds. But usually music is made of more than one pulse wave, and you start to get more extreme peak levels as you start adding the DCs to any signal at all.You will get more extreme levels without the DC offset. With the DC the waveform is fixed to the range -1 .. +1, without the DC the output can be anywhere from -2 .. +2.
The DC click is actually different from the click of a single impulse of a pulse wave, it's really a bit like a short one-cycle kick sound. Probably caused by the AC coupling of my DAC, or the amplifier.You'll get the same clicks either way. TBH i dont know why it sounds different, it may be nothing to do with the DC but rather that the two methods of generating a PWM sound different. It's such a long time since i worked on the Pulsaw code I dont really remember. But it wasnt an arbitrary choice.
Anyways, I guess I can live with the oscillator being this way, just have to remember to high pass the Sonigen output so it won't start to build up down the line.
-
- KVRian
- 563 posts since 23 Nov, 2010
FWIW i will be adding an EQ and some some simple 1 & 2 pole filter types at some point. So either of those would handle DC blocking. In fact I could probably add it as an option on the Output module. I'll add that to the ideas list.
Thanks,
Thanks,
Chris Jones
www.sonigen.com
www.sonigen.com
-
- KVRist
- Topic Starter
- 44 posts since 23 Feb, 2009
Would probably be better to add an option to the oscillator to choose between +1..-1 and dc-less. That way there wouldn't be a filter affecting other stuff. Unless, are there other modules producing DC, or are you planning of adding a sampler or stuff like that?sonigen wrote:FWIW i will be adding an EQ and some some simple 1 & 2 pole filter types at some point. So either of those would handle DC blocking. In fact I could probably add it as an option on the Output module. I'll add that to the ideas list.
Thanks,
-
- KVRian
- 563 posts since 23 Nov, 2010
To be honest I don't think it is a problem. And I think taking the DC component out **in this specific case** will actually make matters worse. It's why I mentioned that with the DC the peak to peak stays fixed in the range -1..+1, take it out and it can be anywhere from -2..+2. When you add a whole load of PWM waves together the DC version will still have a lower peak to peak, since the component waves do so themselves. It's just a statistical fact.
For example...
That is 5 detuned PWM waves, its the same source in both case, only the right hand one has a DC blocking filter applied.
As you can see the peak to peak levels are more extreme with the DC removed than they are with it left in.
Thanks,
For example...
That is 5 detuned PWM waves, its the same source in both case, only the right hand one has a DC blocking filter applied.
As you can see the peak to peak levels are more extreme with the DC removed than they are with it left in.
Thanks,
Chris Jones
www.sonigen.com
www.sonigen.com
-
- KVRian
- 563 posts since 23 Nov, 2010
Well in the process of investigating something else I found a situation where the DC can become an issue, specifically when you have narrow pulse and a lowpass with very low cutoff. So it's not as clear cut as I originally thought. So I might still add it as an option at some point. But its low priority ATM.
Thanks,
Chris
Thanks,
Chris
Chris Jones
www.sonigen.com
www.sonigen.com
- KVRAF
- 2488 posts since 2 Dec, 2004 from Sydney, Australia
Asymetrical generated waveforms are quite common. But IMO they steal unnessasary headspace (especially if you aim for loudness) and give dynamic processors like compressors a hard time. Unless there is an audible sonic quality to it I try to stay away from it. Just my 2C.
Cowbells!
-
- KVRist
- Topic Starter
- 44 posts since 23 Feb, 2009
This is my first time posting images, so I'm not sure if it will work, but...
In hopes to make it one-higher-than-low-priority, a couple pictures:
6-note chord PW at 0.98, first 100 ms:
You can see that it only crosses zero once, that can't be good, right?
Same, chord, I hit reverb on at 4 seconds:
Same chord, dc-removal highpass on, reverb on at 4 seconds:
In hopes to make it one-higher-than-low-priority, a couple pictures:
6-note chord PW at 0.98, first 100 ms:
You can see that it only crosses zero once, that can't be good, right?
Same, chord, I hit reverb on at 4 seconds:
Same chord, dc-removal highpass on, reverb on at 4 seconds: