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


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

Registered: Apr 2004
Posts: 34
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)?
 
... 8 posts hidden. Click here to view all posts....
 
2020-12-24 23:01
Jammer

Registered: Nov 2002
Posts: 1059
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: 58
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: 71
mixer does it again :mindblown_gif:
2020-12-26 11:12
Laurent

Registered: Apr 2004
Posts: 34
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: 352
@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: 71
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: 34
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: 71
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: 34
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: 34
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)
Previous - 1 | 2 - Next
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
DonChaos
eryngi
Compyx/Focus
Frostbyte/ALD/Siesta
E$G/-/OKUTO FORCE
theK/ATL
Guests online: 138
Top Demos
1 Edge of Disgrace  (9.6)
2 Coma Light 13  (9.6)
3 Uncensored  (9.6)
4 Unboxed  (9.6)
5 Comaland 100%  (9.6)
6 Lunatico  (9.6)
7 Memento Mori  (9.6)
8 Christmas Megademo  (9.5)
9 We Love to Party  (9.5)
10 The Shores of Reflec..  (9.5)
Top onefile Demos
1 Copper Booze  (9.8)
2 To Norah  (9.7)
3 Lovecats  (9.6)
4 Square Booze  (9.5)
5 Daah, Those Acid Pil..  (9.5)
6 Elite Code Mechanics  (9.5)
7 Dawnfall V1.1  (9.5)
8 No Mercy for the Tro..  (9.4)
9 Quadrants  (9.4)
10 Babbo Maiale  (9.4)
Top Groups
1 Booze Design  (9.4)
2 Fossil  (9.4)
3 Censor Design  (9.3)
4 Oxyron  (9.3)
5 PriorArt  (9.3)
Top Diskmag Editors
1 Jazzcat  (9.5)
2 Newscopy  (9.4)
3 Remix  (9.2)
4 A Life in Hell  (9.2)
5 Elwix  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2021
Page generated in: 0.046 sec.