Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) You are not logged in - nap
CSDb User Forums


Forums > C64 Composing > ADSR vs Volume
2020-12-24 14:26
Laurent

Registered: Apr 2004
Posts: 40
ADSR vs Volume

SID doesn't have a "voice volume" register, but it has the sustain level of its ADSR envelope.
However it's not like we can freely adjust it since it's part of the complex (and buggy) ADSR state machine.
Decreasing sustain level (at the decay rate) works well, but to increase we have to start attacking again, always shooting to max volume and then decaying to desired sustain level.
If one want to make a quiet instrument (with low sustain value), it will pop at each new note due to attack-decay cycles, unless we always stay in sustain phase and don't really make use of the envelope.

Has it ever been a limitation to you that voice level control is not freely controllable ?

Another volume question, can you hear a difference between max sustain level $F (0db) and $E (-0.59db) or even with $D (-1.24dB) and maybe even $C (-1.93dB)?
2020-12-24 14:32
chatGPZ

Registered: Dec 2001
Posts: 11100
can't you abort the attack early so it never reaches max. volume?
2020-12-24 14:39
Laurent

Registered: Apr 2004
Posts: 40
sure you can, by going to release phase, so you will tend to 0 unless maybe you use the slowest release rate to attempt holding.
Then that "sustain" level depends very much on the timing, I don't know how easy it is to control
2020-12-24 14:44
chatGPZ

Registered: Dec 2001
Posts: 11100
will surely need some precise timing :)
2020-12-24 15:16
Conrad

Registered: Nov 2006
Posts: 833
What Groepaz said. You'll have to set bit gate off at the right cycle.

This is from the AAY64 / Dreams documents on SID ADSR, showing the milliseconds for when the voice "volume" goes from 0 to $f via the attack method:
 SID-ADR-Table:

     VALUE    ATTACK    DECAY/RELEASE
   +-------+----------+---------------+
   |   0   |    2 ms  |      6 ms     |
   |   1   |    8 ms  |     24 ms     |
   |   2   |   16 ms  |     48 ms     |
   |   3   |   24 ms  |     72 ms     |
   |   4   |   38 ms  |    114 ms     |
   |   5   |   56 ms  |    168 ms     |
   |   6   |   68 ms  |    204 ms     |
   |   7   |   80 ms  |    240 ms     |
   |   8   |  100 ms  |    300 ms     |
   |   9   |  240 ms  |    720 ms     |
   |   10  |  500 ms  |    1.5 s      |
   |   11  |  800 ms  |    2.4 s      |
   |   12  |    1 s   |      3 s      |
   |   13  |    3 s   |      9 s      |
   |   14  |    5 s   |     15 s      |
   |   15  |    8 s   |     24 s      |
   +-------+----------+---------------+

 This chart represents the 16 rates for ATTACK, DECAY and RELEASE.
2020-12-24 15:36
Jammer

Registered: Nov 2002
Posts: 1289
I cannot stress enough how badly picked these values actually were :(
2020-12-24 15:52
chatGPZ

Registered: Dec 2001
Posts: 11100
I doubt they were "picked" at all... They came up with the logic and the value happend =P
2020-12-24 15:56
Laurent

Registered: Apr 2004
Posts: 40
Quote: I cannot stress enough how badly picked these values actually were :(

And what about the level of a voice ? did you ever have any trouble in changing/set the over level the way you wanted ? Did you have to compromise ?

It's more a qualitative question than technical, I am well aware of the inner working of the SID chip, but I have never composed a tune ;)
2020-12-24 21:59
Mixer

Registered: Apr 2008
Posts: 421
ADSR Example

Above is a small demonstration of how to control voice ADSR just by switching between A and R (gate on/off and suitable values). The voice volume follows a sine curve.

Basically one can use voice 3 adsr read back register to "generate" the sequence of gate on/off and then apply the sequence on other channels.
2020-12-24 23:01
Jammer

Registered: Nov 2002
Posts: 1289
Quoting Laurent
And what about the level of a voice ? did you ever have any trouble in changing/set the over level the way you wanted ? Did you have to compromise ?)

Of course I had to compromise many times ;) Biggest problem is that many ADR values are wasted for quite similar short periods, whereas longer ones are few to pick from. But it can be tamed after all ;)
2020-12-25 14:14
4mat

Registered: May 2010
Posts: 63
In this fUJi I had to emulate the AY chip's rapid volume changes.

Basically it keeps the gate on at all times except when the new volume is lower than the existing one. At that point it briefly switches the gate off and resets the AD value. The only downside is you get some clicks with the lower sustain values, but I saw that as a trade-off for rock solid volume changes.

The source code for that bit is in the docs, it was mostly trial and error getting it working so there's probably bits that aren't needed to get the same effect.
2020-12-25 22:27
mankeli

Registered: Oct 2010
Posts: 110
mixer does it again :mindblown_gif:
2020-12-26 11:12
Laurent

Registered: Apr 2004
Posts: 40
Nice one Mixer ! so that's like a control loop on voice 3 current level right ? either you gate ON if it's under the target volume or gate OFF if above ? looks like it can work very well with reasonnably slow attack/release but could meet issues with faster ones unless you increase the control loop frequency ?
I was more thinking about rapid volume changes like 4mat did with his AY chip emulation, or with the MOD "C" effect, but I guess it's a non-issue when you guys compose a tune.

I'm raising this question because I saw a youtube video with the inSIDious plug-in, it has a volume knob for each voice, alongside the ADSR controls.
That is not "SID compliant" and could produce sounds and dynamics that the SID can't do.
2020-12-26 11:56
Mixer

Registered: Apr 2008
Posts: 421
@Laurent, yes, exactly like that. One could interleave the adsr update into a player routine and use the 2ms Attack and 6ms release to manipulate the voice volume to any level during a single player call/frame by manipulating the delay between gate on-off, or off-on. I am pretty sure that any volume interval can be done with max 6ms delay.

Another example of this is in Vicious Sid II. The Aldous Huxley speech is just ADSR manipulation, coded by Mankeli.

Insidious is not Sid compliant indeed, but perhaps SID can become insidious compliant.
2020-12-26 14:11
mankeli

Registered: Oct 2010
Posts: 110
Well this is rapidly advancing field of science of course :-D

But I suppose the whole adsr could be replaced with software-based replacement, if an efficient way to simulate SID adsr counters on cpu side exists.

Some random thoughts:

Rate 0 period is 9 iirc, so that would allow to "sync" simulated counters with the hardware ones with few cycles of variance. For sustaining a volume, one should of course use longest periods to avoid high frequency noise.

I think it might be possible to track the counters and volume value even if the simulation is not completely in sync, because basically you just need to move up and down. Just need to avoid the overflow (adsr bug). Dunno how easy that is actually, but I have this tingling sensation that the variance could be tracked in such a way that it's possible to avoid changes when the bug is likely to happen.

The volume value also saturates on min and max.
2020-12-27 12:15
Laurent

Registered: Apr 2004
Posts: 40
I understand with voice #3 a lot of things are possible because you know the current envelope level, but on other voices you are "blind" and need to precisely keep track of the cycles elapsed.
I don't know how easy that is ? with a timer that fires once after X cycles one could abort an attack at a specific 8 bits level ? and timing accuracy will be more critical at faster rates, like you said at attack rate 0 it takes 9 cycles per envelope step, and the timer should not fire on a badline hopefully !

Also, increasing a rate will likely trigger the delay-bug, like setting release to F to sustain a note and then back to 0 when it's time to quickly release, might take up to 33ms for that release to happen :-/
2020-12-28 21:21
mankeli

Registered: Oct 2010
Posts: 110
i guess playroutine call frequency limits what times can be used for volume transitions. Because you always need to switch values so that adsr-bug is avoided, it's not super obvious what the limitations are.

My guess is that the more faster transitions would cause more popping because they would almost always overshoot (with 1x player), but it gets better when the transition time becomes longer.

Calling the player with stable raster (and cycle counting the routine itself) it might be possible to always work within the original 9 cycle variance.
2020-12-29 13:14
Laurent

Registered: Apr 2004
Posts: 40
Quoting mankeli
My guess is that the more faster transitions would cause more popping because they would almost always overshoot (with 1x player)

Yes 20ms is too coarse, and the faster volume changes are what mostly interest me here.

To illustrate, I uploaded a small video:
FT2 volume change
(it's 4mat's Kaneel.xm)

The sample is a looping low-res sine-wave. our SID triangle should be a decent replacement.


The 16 notes looping sequence from FT2:


The sine FT2 instrument has a volume of $22 (command 000)
So we could replace 000 with C22 to expose the volume change for each note:


and corresponding captured waveforms:


note that max volume is about 0.30 on my capture. The exact value is not relevant (FT2 also has an overall master volume and amplification factor).
But the point is, it is not max volume compared to other voices.
The sine sample itself is about 0.4 of full level, and C22 is about half full volume, so our final volume is about 0.2. That would correspond to 8bits level 0.2*255 = 51 ($33) ...
So it's not like we can look at this and say "let's have a sustain level of $F and achieve the same".
The highest sustain level is low (~3) and we would strongly pop each note if we go to full attack and use the decay phase.

Also, the volume transition is not instantaneous:


There is a volume ramp option in FT2 to avoid abrupt changes that would produce terrible clicks.
(it's not really a volume ramp but a crossfading, but whatever...)

The volume transition takes a fixed ~4ms


Maybe this could be a fun challenge to accurately reproduce that sequence without ever being in decay phase and at low sustains, but not using voice #3 !
2020-12-30 10:58
Laurent

Registered: Apr 2004
Posts: 40
On top of the overshooting Attack-Decay phases, there is the problem of DC offset modulation by the envelope, it emphasizes the "pops", or one could say it creates the pops.
I'm saying "problem" but it's definitely not always a negative feature. It can make notes more punchy on the 6581 and in some cases this is welcome I suppose.
However with sequences of quickly triggered notes, the constant pop-pop-pop-pop-pop-pop can be annoying
The 6581 has a higher DC offset than the 8580.

Here is a video showing 6 mocked-up examples with an emulator for 6581/8580/FAKE_NO_DC.
Influence of modulated DC offset



The 16 notes sequence is reproduced by only triggering the attack when volume must increase, otherwise sustain level is lowered which doesn't produce the A-D overshoot.
This is what 4mat did with his AY emulator and probably like what musicians would do if they wanted to lower a sustained note volume softly.
There is no ADSR delay bug issue here since Attack,Decay and Release rate all have the same value (0).
The waves are recorded at the output of each voice, so the external DC-blocker is not applied, however it would not get rid of the pops.

* The top 3 channels use low sustains 4-2-1 for the 3 volumes C22-C10-C0A, for 6581, 8580 then a fake "no-dc" chip.
* The bottom 3 channels use high sustains 15-8-5. Then, the envelope level is >>2 to match envelope level of the first 3.

Obviously that extra volume knob doesn't exist, which was the initial point of this thread. But it is to get an idea on how it would sound without the A-D overshooting.
(there is still a single overshoot for the note C0A->C10)
2021-10-04 12:05
acrouzet

Registered: May 2020
Posts: 80
The envelope can be a limitation, but more importantly, it definitely gives the SID its own characteristic sound. Without those attack/decay pops and delayed envelope changes (which allow for stuff like hard restart), the SID wouldn't have as much charm in my opinion.

Also, since someone mentioned how bad the choices for envelope rates were, according to an interview with Bob Yannes, they were chosen "by setting up typical patches on a Sequential Circuits Pro-1 and measuring the envelope times by ear".
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Guests online: 65
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.9)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top NTSC-Fixers
1 Pudwerx  (10)
2 Booze  (9.7)
3 Stormbringer  (9.7)
4 Fungus  (9.6)
5 Grim Reaper  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.055 sec.