Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums

Forums > C64 Composing > Sid ADSR problem / hardrestart
2006-07-18 21:32
Account closed

Registered: Jul 2006
Posts: 48
Sid ADSR problem / hardrestart

Hey guys,

I more or less understand the hardrestart thing,
but can anyone explain to me what the exact problem
with the ADSR is? So explain what the effect is when i dont
use hard restart.

Lots of thx.

The audioarts sidproject (hardware and software pimping of c64)s:

... 24 posts hidden. Click here to view all posts....
2006-07-20 09:56
Account closed

Registered: May 2005
Posts: 1332
Hmm, I can't hear any audible difference.
2006-07-20 10:27
Account closed

Registered: Jul 2006
Posts: 48
Quote: Ah, the whole time I thought these questions were in preparation to create the most amazing music for Battlestar Galactica :)

Anyway, my input would be to go for maximum configurability. For hardrestart, give options to write any ADSR value and perform gateon/gateoff some time before the note. The more accuracy you can get to the timing (more than standard 20ms PAL frame?), the better.

An example:
60 ms before: ADSR 0000 and gateoff
20 ms before: ADSR to instrument values and gateon with no waveform
0 ms: start the note

Note that because you need to know there's a note coming so that you can do gateoff/HR before it, this introduces a latency to live-playing. But if you can stomach it, with this kind of long HR, particularly if the timing stays accurate, there are like no instrument ADSR values to avoid.

Ok. Cadaver, i sent you a p.m.
hope you noticed. i'll also
respond to your helpful suggestion here:

Why 60 and 20 ms?

is that random?
why not 40 and 20?

you say "0 ms: start the note". what do you mean by that? to select the waveform? (b/c gate on (whcih is my definition of starting a note, is already on by that time).

So for those who didn't figure yet...i'm trying to get a hold of how to create the best music routine for live(!) jamming and knobfiddling with c64. (so not a tracker, not a sequencer, not a player). But all info on how trackers and players are done is very interesting to me if it can inspire me for my thing.
2006-07-20 12:52

Registered: Feb 2002
Posts: 1143
It's not really random, it seems at least 40ms (two 50Hz frames) of gateoff time is needed to know the next note triggers nicely, and even more without hardrestart.

To start the note = to select the waveform + gateon, initial frequency and initial pulsewidth if needed
2006-07-20 14:50
Account closed

Registered: Jul 2006
Posts: 48
Quote: It's not really random, it seems at least 40ms (two 50Hz frames) of gateoff time is needed to know the next note triggers nicely, and even more without hardrestart.

To start the note = to select the waveform + gateon, initial frequency and initial pulsewidth if needed

@ cadaver: hmm ok. Do you mean that ADSR reset has to be at least 2 frames before start of note OR do you mean that ADSR has to two frames before you init adsr with new note values?

I mean what about this , would this work?:

40ms (2frames) before - ADSR reset
0ms - put note values to adsr and wave and directly after that set gate to 'on'.

@ cadaver: i appreciate it a lot that you guys are helping a novice coder like me to find out the hardrestart stuff. I almost understand how it works now. Still 1 question: what exactly is part of the hardrestart , does HR just mean to reset the ADSR before notes, or is the way in which you trigger the notes also part of it? in other words: does it matter wether you firstly put gate on and then select waveform to trigger the note, or can you also first select waveform and then toggle the note on by putting gate to 'on' ?

Because in my application, all parameters are constantly set to the right instrument setting (pw, adsr, waveform, ringmod etc) except for pitch and gate on/off. when i play a note on my keyboard it just sets the right pitch and puts the gate to on. in the future with my wersi board and the midi, there will be sent a 'gate off' signal when keypress is released.

OFcourse for the ADSRbug i now understand to also reset adsr 2 frames before the note will play (i'll create a 2 frame-latency-live-mode that will enable tones with the problematic adsr values).

But why set the other values again each note? like waveform etc? Isn't it more cpu-efficient to change waveform etc with a command that stands loose from each individual note that is played?


2006-07-20 15:06

Registered: Feb 2002
Posts: 1143
IMO hardrestart does not involve the new note trigger itself, it's just getting the SID to a stabile enough state before the note.

Actually to answer all your questions accurately would require writing testcode, and your code would be different anyway. There comes a point when just trying out stuff is 10x more helpful than asking about it :)

You can freely select waveform at whatever point you want, only the gatebit matters for the envelope generator. However many musicroutines prefer absolute silence (just gatebit, or testbit+gatebit so that the oscillator gets reset) for the first gated on frame.

It's also possible that depending on which kind of attack you are pleased with, you can squeeze the latency time to one frame. This, for instance, is completely different from the hardrestart that was discussed above:

20ms before: gate off, ADSR to 0000 or 000F
0 ms: gate on + waveform (write those first!), ADSR to instrument values, frequency, pulsewidth etc.

It possibly bugs on full sustain.

But to answer about CPU efficiency, we usually don't care about such small things in musicroutines, but rather avoid the real costly operations like multiplication, or reading & interpreting many bytes of the musicdata at once.
2006-07-20 23:01
Account closed

Registered: Jul 2006
Posts: 48
@ cadaver:

ok thx , that was helpful.
2006-07-22 11:44
Account closed

Registered: May 2005
Posts: 1332
*by the way*

Are there any HR/ADSR values that can prevent ADSR-Bugs? It seems that 0F00 (GT, Jch..) is the best, but what is with other values?
Ok, F800 is quite a good mix (IMHO F000 would sounds too hard), but the A/S value seems to have no audible function.

Ok, here some sceners that use different HR values:

0F00 : - (standard value of some editors)

FF00 : Jeff
0FF0 : Randall/Jammer
0F20 : GRG

FFF0 : maybe a mix of all is the best? :)
2006-07-22 14:28
Account closed

Registered: Jul 2006
Posts: 48
I think nata's question is interesting.
I notice that you guys seem to mock him sometimes,
(just new to this forum makes me wonder how he
did deverse that position:P), but i can relate to
nata's question very much.

Also i'd really like to see a table of different ADSR settings that bug/dont bug under different circumstances.
I hear peeps saying that it's different for each player/tracker, but as far as i know understand there's a
limited amount of adsrbug approaches, so why not create a table, that describes symptoms of adsrbug under all of them.
To me the different HRcircumstances are (please extend this list if it's not complete yet):

-no HR
-20 ms HR
-40 ms HR
-60 ms HR

Or correct me if i'm (once a gain) summarizing stuff in a way that's too simple :P


STunt - coder with a typically non-coder mindset
2006-07-22 17:34

Registered: Feb 2002
Posts: 1143
@Nata: I would say that 0000, the hardest one, is theoretically best, as the internal counters are left counting the smallest possible cycle. Still there can be some bugs depending how the timing between playroutine's successive frames changes. Something worth trying is to always write last frame's buffered SID values at the beginning of the next frame.

@Stuntgitarist: there are as many timing possibilities as there are CPU cycles between the end of the last note and the beginning of the new :) Only you can tell how ADSRbugs will behave for you, when you test your own routine.

(something very educational would be to modify reSID to display its envelope generator value & internal counter value on each CPU cycle, then you see how even swapping some instructions around may have a different effect)
2006-07-22 18:23

Registered: Aug 2005
Posts: 456
"And we're back in the loop again".. Yihaa! ;)
Previous - 1 | 2 | 3 | 4 - 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
Users Online
Raffox/Hokuto Force
Guests online: 59
Top Demos
1 E2IRA  (9.7)
2 Edge of Disgrace  (9.6)
3 Comaland 100%  (9.6)
4 Coma Light 13  (9.6)
5 Uncensored  (9.6)
6 Bromance  (9.6)
7 Lunatico  (9.5)
8 Memento Mori  (9.5)
9 Wonderland XII  (9.5)
10 Median  (9.5)
Top onefile Demos
1 Copper Booze  (9.5)
2 Daah, Those Acid Pil..  (9.5)
3 Dawnfall V1.1  (9.5)
4 Cityscape 2730  (9.5)
5 Barry Boomer - Trapp..  (9.5)
6 Lovecats  (9.5)
7 Elite Code Mechanics  (9.5)
8 Square Booze  (9.5)
9 To Norah  (9.4)
10 Plasma Ninja  (9.4)
Top Groups
1 Booze Design  (9.4)
2 Oxyron  (9.3)
3 Crest  (9.3)
4 Censor Design  (9.2)
5 1001 Crew  (9.2)
Top Webmasters
1 Slaygon  (9.6)
2 Perff  (9.6)
3 Morpheus  (9.6)
4 Sabbi  (9.4)
5 CreaMD  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2022
Page generated in: 0.168 sec.