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 > New waveforms...
2006-04-01 13:35
Bamu®
Account closed

Registered: May 2005
Posts: 1332
New waveforms...


Last year I have heard something about 'new' SID waveforms (found by SounDemoN)
So, when we finally can use these waveforms with a standard editor?
Does anybody have an idea?
 
... 25 posts hidden. Click here to view all posts....
 
2006-04-01 21:45
dalezy

Registered: Apr 2002
Posts: 475
what exactly is it? can't tell i hear anything 'new' in either my kondom, pico or his tune from bp (which got mentioned beforehand).
2006-04-02 05:18
Oswald

Registered: Apr 2002
Posts: 5017
AFAIK sid emulators are not yet capable to recreate this effect. IIRC this is about looping the noise waveform, with some trick. Probably you can set the loop start and length aswell in certain limits.
2006-04-02 07:24
Frantic

Registered: Mar 2003
Posts: 1627
When combining the noise waveform with another waveform, i.e. setting waveform $9 or so, it has the result of resetting the internal sid counter that generates the noise waveform. SounDemon noticed this (I think this was stated in the reSID documentation, but I may be wrong, perhaps it just states that this will stop the noise generator, or something like that) and got the idea of resetting the noise waveform periodically to achieve other waveforms. For some frequencies it is enough to reset the counter like three times a frame, so even if it may not become part of the standard sid editor battery, it is not completely unusuable for everything, at least. :) This noise waveform resetting is what you hear in Pico (which to my ears indeed have some weird sounds in them, but only on a real c64 of course).

The process of resetting the internal counter has some analogue components though, because it is not just going to 0 at once or so (don't even think it is "reset" to 0 specifically). Rather, bits drop off during a short time and it seems like SID do not act completely as a digital state machine in this case.
2006-04-02 11:41
Bamu®
Account closed

Registered: May 2005
Posts: 1332
Interesting!
2006-04-02 14:02
Monte Carlos

Registered: Jun 2004
Posts: 351
I remember, that the sid's voice turns off, if you
combine the noise waveform with any other.
Then you can only reset it by setting the test bit of
the particular voice.
What happens if you do this periodically?
I did't got it from the explanation above.
Can you explain it again for stupid guys like me? ;)


Monte
2006-04-02 16:41
Steppe

Registered: Jan 2002
Posts: 1510
Quoting directly from VN #45:

NEW WAVEFORMS
Some people claim that everything imaginable has been done on the C64. This is true to a certain extent. The typical scenario is indeed that you come up with something new just to find out that someone else has done it 10 years ago... But sometimes strange things happen and even lamers like myself stumble on new stuff. This happened when we were working on our 4k intro Pico! for Breakpoint this year. I was coding the music player and tried to create some drum sounds when I accidentally got some harsh, very distorted sounds. The funny thing was that I was using the noise waveform and got something that sounded like a synthesized electric guitar!
This was not supposed to happen... Noise is not supposed to have a pitch... It took me some time to figure out how and why this works.
In this article I will tell you what I found out. The trick requires custom code, and can't be done in existing players and editors. Hence this text is intended mostly to coders, but musicians might find it an interesting read, too.

THE NOISE MECHANISM
In order to understand how the new waveforms are generated we have to examine the internals of the SID chip. As already mentioned, the trick is based on the noise waveform. SID uses a pseudo random mechanism based on a 23 bit shift register to generate the noise waveform. When clocked, the register is shifted to the left and bits 22 and 17 are fed through an exclusive or gate back to the least significant bit. (This was proposed by Marko Makela and Asger Alstrup, and seems to be correct). This results in a new pseudo random value that is used as the output sample of the voice. (Bits 22, 20, 16, 13, 11, 7, 4 and 2 are used as the output bits.) In normal circumstances the register is clocked periodically and the generated sequence of random numbers is perceived as noise. Of course, this is no fun. What we really want is to abuse this mechanism to get some weird side-effects. In our case, we are going to fool it into repeating a short sequence of "random" numbers. This is achieved by resetting the value in the shift register when we want to restart the sequence. In order to do this we need a way to load a certain value to the register. There is no simple way to do this, but it is possible to alter the bits in the shift register either by using the testbit or by using combined waveforms.

COMBINED WAVEFORMS
When other waveforms are selected simultaneously with the noise waveform bits 22, 20, 16, 13, 11, 7, 4 and 2 of the shift register are cleared immediately. Notice that these are the same bits that are used as.w the output bits of the voice.

THE TESTBIT
I found out two interesting things about the testbit.
1) When the testbit is CLEARED the shift register is clocked once.
2) When the testbit is SET bit 20 is inverted and the result is written to bit 1. This happens immediately.
(I can't really prove that bit 1 is updated when the testbit is set, but I will assume this is the case. It is also possible that bit 2 is updated when the test bit is cleared -after- that the shift register is clocked. From a theoretical point of view, it doesn't really matter which one we choose to believe in, since there is no way we can measure the value of bit 1 when the testbit is set.)
If the testbit is set for several seconds the value in the shift register will slowly change and $7ffff8 can eventually be read from it. This is NOT useful for creating new waveforms because the delay before something happens is too long. ..$7ffff8 is indeed the value that was proposed as the initial value of the shift register by Marko Makela and Asger Alstrup and is also used in ReSID. However, it's not really the initial value since the register is clocked once after the testbit is cleared.

My theory is that the real initial value is $7ffffc. It seems as if all bits are set (except for bits 0 and 1 that are cleared) in a certain order with a certain delay. The delay seems to vary, and sometimes the bits are set in a slightly different order. The only explanation for this is that it is some kind of analog magic. I don't have an explanation for why bits 0 and 1 are cleared instead of being set but that might have something to do with that these are the only bits in the register that are written to. (bit 0 when the register is clocked and bit 1 when the testbit is set) I wonder whether there was some purpose behind this weird behaviour.

HOW IT IS DONE
Now we know how the mechanism works and how to abuse it. So how do we actully produce these sounds? A very simple approach is to use a CIA irq to reset the noise mechanism. Experiment with different CIA and noise frequencies and put
something as simple as the code below in your irq routine:

lda #$f1 ; combined waveforms on, testbit clear
ldx #$09 ; testbit set
ldy #$81 ; only noise set, testbit off

sta $d412 ; ($d412=osc3 control register)
stx $d412
sty $d412

With the right frequencies you will get a pitched sound. This was the way I discovered the trick but I'm sure you could use more complicated routines to generate more interesting sounds. Go ahead and impress me!

THE TEST PROGRAM
I wrote a program for testing the mechanisms described here. It can be found on this disk with the filename WAVECOMPOSER. It is rather simple but allows you to experiment with some basic sounds. Keep in mind that the program won't work on the emulator. You can select a CIA frequency (timer lo/timer hi) and program a noise frequency sequence with the frequency table (labeled freq). Use "frq end" and "frq loop" to specify where the table ends and what position it should jump to after reaching the end. You can also specify how many frames each row in the frequency table lasts by using the "len"-table. The wave table (w1/w2/w3) is u
sed to specify what three values are written to $d412.
You can turn off the screen by changing the value in $d011 to $00 to ensure that bad lines won't interfere with the timing. You can also make the timer interrupts stable by setting "synch" to $01 but this seems to have little significance on the sound.
There's also variables for changing adsr and controlling the filter. I added these just to spice up the example sounds a little bit but of course they are really not important for the new waveforms.
Press F1 to read the value of the internal shift register while playing a sound. I recommend that you disable the screen (set $d011 to $00) before using this feature to avoid timing problems caused by bad lines. You can hit RESTORE to view the source code and make your own modifications to the program. You might want to add more than three writes to $d412 for each interrupt for greater control over the value in the shift register. A separate table for the CIA frequency could also be very useful. I wrote the program before discovering the details about the noise mechanism and hence it lacks these features

ABOUT EMULATORS AND DIFFERENT SID REVISIONS
Luckily the trick seems to work in the same way on all revisions of the SID chip. This is natural since it depends only on digital logic. You might argue that combined waveforms are analog in nature, but in our case it seems that the bits affected are always cleared. However, I've been using waveform "$f1" (all waveforms are toggled on) most of the time, so other combined waveforms might result in unpredictable results on some SID chips. The mechanism described here is not emulated correctly on any current emulator, so what you will hear on emulators is just plain noise. This means you could use the trick for emulator detection but I'm not sure what happens if this kind of routine is run on a real c64 without a SID chip.
Well, that's all, see you next time!
SounDemoN/Onslaught/Dekadence
2006-04-02 17:43
Zyron

Registered: Jan 2002
Posts: 2381
Exciting. The SID is magic.
2006-10-27 17:30
Bamu®
Account closed

Registered: May 2005
Posts: 1332
The only emulator that is able to reproduce the "new" waveforms is http://www.btinternet.com/~hoxs64/ (somebody interested?)
2008-02-17 17:33
Oswald

Registered: Apr 2002
Posts: 5017
I've found something interesting while browsing jch tunes randomly:

MUSICIANS/J/JCH/Wizax_demo.sid)

"The first tune to use the "testbit-noise" technique which locks and unlocks the noise in such a way that the noise waveform sounds more metallic. However, I later discovered that this worked differently from C64 to C64. On some C64, I had to lock the waveform with $F0, where other versions required $F8 to achieve the same effect. Composed in JCH player v5."
2008-02-17 21:40
Jammer

Registered: Nov 2002
Posts: 1289
must try it out, definitely :D:D:D do you know that noise in its lower pitches HAS recognisable harmonics? it can be easily heard what note is played :)
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
Advanced
Users Online
wil
Fulgore/Excess
Sentinel/Excess/TREX
Mibri/ATL^MSL^PRX
oziphantom
Holy Moses/Role
Matt
Jammer
Menace/Spaceballs
Guests online: 135
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 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Original Suppliers
1 Black Beard  (9.5)
2 Derbyshire Ram  (9.5)
3 hedning  (9.2)
4 Baracuda  (9.1)
5 Irata  (8.5)

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