Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in 
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?
2006-04-01 14:38
TDJ

Registered: Dec 2001
Posts: 1876
Quote:
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?


Was that exactly a year ago?
2006-04-01 15:38
Motion

Registered: Aug 2002
Posts: 68
You mean, like on the the 1st of April? ;)
2006-04-01 16:10
cadaver

Registered: Feb 2002
Posts: 1143
Was it something related to the noise waveform & SounDemoN's emulator detection? Anyway, if it requires manipulation of SID registers between normal 50Hz music updates, then no, I don't think it will be in standard music editors.

http://www.btinternet.com/~hoxs64/history.txt
2006-04-01 17:29
iopop

Registered: Dec 2001
Posts: 317
I can be completely wrong. But I think this new waveform was used in PICO!.
2006-04-01 18:13
Steppe

Registered: Jan 2002
Posts: 1501
Yes, and one of the tune from My Kondom/HJB also makes use of this. There was kind of an editor to create those sounds and play around with the parameters in Vandalism News #45. On side 1 you'll find a program called WAVE COMPOSER. It's not a music editor though.
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: 4739
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: 1561
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: 295
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: 1501
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: 4739
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: 1141
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 :)
2008-02-17 23:31
Conrad

Registered: Nov 2006
Posts: 774
Jammer: You'll have to find a tracker that supports use of these waveform ranges first ;) GT for example uses $f0-$fe for command execution.
2008-02-17 23:38
Jammer

Registered: Nov 2002
Posts: 1141
conrad try multi-speed x4 and something like this :P

01: 19 00
02: 81 00
03: FF 01

or anything with testbit in the first row - you will be surprised :P

still, i haven't got fully controllable pitch, rather something like thickness/formant ;) thenext thing to discover is that square+gatebit gives slightly different sound (however, it's not dependent on its width) than other waveforms. i've got an impression that it was used in a few games :D
2008-02-18 06:52
Stryyker

Registered: Dec 2001
Posts: 465
A version of Sync allows you to control full 16 bits for frequency when using fixed pitch function of the wavetable. The wavetable sets the high byte and the fne super command sets low byte of the frequency registers.
2008-02-18 23:20
Conrad

Registered: Nov 2006
Posts: 774
jmr: oh aye you are the GT master after all. >:-)
Nice combination of sounds from that example, would be nice to know a bit about other waveforms that use this combination.
2008-02-19 10:02
Jammer

Registered: Nov 2002
Posts: 1141
Quote: jmr: oh aye you are the GT master after all. >:-)
Nice combination of sounds from that example, would be nice to know a bit about other waveforms that use this combination.


well, you might intertwine testbit frame with everything i guess. you will get perfectly gated sound with no modulation side-effect at higher speeds :D
2008-02-19 16:55
Soren

Registered: Dec 2001
Posts: 546
Personally I prefer using the standard waveforms, there are still lots of possibilities with those. And that's GOOOOOOOD!... as I am a sound nerd! :-)

Teasing hint: You will be hearing lots of BullSID from me later on...

:-)

Also, I never needed testbit for what people have been calling "testbit" noise for too long... I call it "all waves combined" - noise or so... even though it doesn't sound very fancy.
2008-02-19 20:10
Oswald

Registered: Apr 2002
Posts: 4739
I have made that post because I'm interested in if jch has already used the same trick as soundemon? Is this a case of reinventing the wheel or not ?
2008-02-19 20:56
Soren

Registered: Dec 2001
Posts: 546
well, afaik it's not quite the same... Soundemon's is like updates lots of times per frame.. like sample playback, as far as I understood it... which clearly gives some different results... dunno if he posts in here, but he should be able to explain it a lot better than me. :)
2008-02-20 11:32
Frantic

Registered: Mar 2003
Posts: 1561
Yes.. SounDemoN gets his freq/note from a timed interrupt resetting the noise waveform periodically. In JCH's case it sounds more like he is (although I haven't verified this) simply restarting the noise waveform on standard player calls, once every frame or so. Gotta try that when I am back home from work today. Perhaps useful for some percussion sounds or so.
2008-02-20 12:58
Jammer

Registered: Nov 2002
Posts: 1141
little test from me

http://asenses.untergrund.net/Jammer/TestBit_4x.sid

1 channel - drums + bass (i also employed testbit in snare)
2 channel - noise with testbit
3 channel - modulations for better impression :P

it is obviously a bit out of tune, but it's really hard to set up nosie properly ;)

unfortunately, it won't sound so pretty on a real machine. i've launched that in hoxs (which reproduces sid in the most proper way) and the effect was rather disappointing :/
2008-02-20 20:13
assiduous
Account closed

Registered: Jun 2007
Posts: 343
just checked TestBitX4 on a real C64 and indeed the noise doesnt sound very good(similar to Hoxs64). locking the testbit in reSID is risky atbest,because the noise emulation is not very well modeled.
2008-02-20 20:28
Jammer

Registered: Nov 2002
Posts: 1141
well, i see that i will have to pester lasse a bit about thinking of hoxs' sid library :P resid disappoints me too often recently :P
2008-02-21 21:22
Analmux
Account closed

Registered: Feb 2008
Posts: 1
Hello, I'm new to this forum. I come from the Atari8bit.

Pokey is the soundchip of A8. It has similar features for special waveforms supported by random shift registers, or 'polycounters'. Pokey has a few polycounters (p.c.s) with different lengths. SID has one 23bit p.c. versus Pokey has 4bit, 5bit, 9bit, 17bit p.c. All have a bitpattern that repeats after a certain time. The n-bit p.c. repeats after 2^n -1 clockcycles.

There's a standard feature to combine two 8bit registers for 16bit frequency control. By this feature some very interesting sounds can be generated. They sound like distortion guitars. It's also possible to control the desired pitch. It relies on the 9bit polycounter, which repeats itself after 511 clockcyles (=4.5 rasterlines).

Contrary to the SID, it's not needed to reset polycounters with a timer-interrupt. Pokey 'resets' itself now and then.


I can imagine that on SID the polycounter reset must be executed often, but when the timing of this interrupt is locked at f.e. once every 8 scanlines, then still a lot of interesting sounds should be possible with this, as on SID you still have the 16bit pitch register to do fine-tuning. At least this is how it works on Pokey, as 9bit polycounter resets after 4.5 scanlines.

So, how often do you need to do this reset procedure on average?

I'd be interested in precise code for doing the new waveforms on C64 (I also have a few of those). I'd like to try on one of my real machines.


I also wonder if it's possible on SID to reset or synchronize the start of a waveform with a certain display- or CPU-event.

How does SID deal with the noisegenerator anyway? Does it take samples using some kind of countdown timer which is configured by the 16bit pitch settings?


I have the experience (at least with Pokey) that it's possible to select a waveform from a continuum of possibilities if you have the correct control for relative timing between the 'sampling frequency' of a SID voice and the 'resetting process'.
2008-02-23 01:26
dalezy

Registered: Apr 2002
Posts: 475
jammer, $19 isn't too new, you should try $59 and $58+$80 in x-speed as well to get some good percussions =)

other than that, did we ever elaborate on the carrier-bug/feature that laxity's jch player came along with? when laxity's player came out i found out the random-letterhitting way that $81 being played at f0 (or fe? should check again) makes up for a good downsampled drumloop-kind of effect in case you have something drum-alike running on channel 1. that one only works in 21.g4 though, i couldn't reproduce it in 21.g5.
i wish i could explain that one, seems like it was really just an unintended bug, and to top it - i didn't even check if it works on a real sid, as i did the testing in vice. =)
2008-02-23 05:40
Jammer

Registered: Nov 2002
Posts: 1141
Quote: jammer, $19 isn't too new, you should try $59 and $58+$80 in x-speed as well to get some good percussions =)

other than that, did we ever elaborate on the carrier-bug/feature that laxity's jch player came along with? when laxity's player came out i found out the random-letterhitting way that $81 being played at f0 (or fe? should check again) makes up for a good downsampled drumloop-kind of effect in case you have something drum-alike running on channel 1. that one only works in 21.g4 though, i couldn't reproduce it in 21.g5.
i wish i could explain that one, seems like it was really just an unintended bug, and to top it - i didn't even check if it works on a real sid, as i did the testing in vice. =)


well, i should check it on a real thing i guess because so far the only difference is audible in $49, the rest with $x9 is always the same :P i will do the test :D i guess without multispeed you won't get reasonable effects in this matter ;)
2008-02-23 10:53
Soren

Registered: Dec 2001
Posts: 546
Damn you guys! I was using that particular bit for something else in my new player/editor, BUT I made an addition so one can use testbit aswell, not that it will ever get as amazing as what Soundemon has done with testbit, but it's the same theory, you just don't have the right wave-cycle based timing when using it in normal sid players, which is also why you can't control it as note-frequency.
So anyways, now I have 4 ways of handling my wave+freq+finetune tables... finetune being calculated ofcourse, so you can do +/- finetuning that works like on synths.
Anyways, must get back to coding... need to be able to compose again soon! :-)

2008-02-23 11:03
Conrad

Registered: Nov 2006
Posts: 774
Jeff: Many months of coding your player will for sure pay off at the end. :)

btw, anyone had a go using:
01: 61 00
02: 51 00
03: FF 01
...at 4x speed with pulse width of $00 or so?

With notes like G-2 and A#3 you can get some freaky electronic sounds, this being in GT of course - haven't tried it on the real thing yet.
2008-02-23 11:06
Soren

Registered: Dec 2001
Posts: 546
Conrad: yep, it has paid off... worked on the player during a bit more than a year and the editor is very close to being done aswell. :-)

and about the wave stuff... it's all a matter of some simple waveshaping.
2008-02-23 14:45
dalezy

Registered: Apr 2002
Posts: 475
conrad, i get about the same sound with any other combination where $51 is involved, been using it quite often lately =)
2015-02-12 05:36
mstram
Account closed

Registered: Dec 2013
Posts: 111
Is this now working in Vice (2.4.x) ?

I'm seeing some tunes with xC1 waveforms, and I was wondering what they were, until I found this thread.

Or maybe Vice / Resid is just ignoring the C1 ?

I'll have to see if the tunes are on any of the "recorded by real SID -> MP3" sites, to compare the sound.
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
Sounx/Xenon
Perff/No Name
Dwangi/Fairlight
Shogoon/Elysium/MSL
Steveboy
Jazzcat/Onslaught
Sentinel/Excess
taper/ΤRIΛD
rexbeng
bugjam
Hammerfist/Desire
Lynx/ΤRIΛD
awsm/MYD
spider-j
dantown
Jammer
Guests online: 101
Top Demos
1 Edge of Disgrace  (9.6)
2 Coma Light 13  (9.6)
3 Bromance  (9.6)
4 Uncensored  (9.6)
5 Memento Mori  (9.5)
6 Comaland 100%  (9.5)
7 Unboxed  (9.5)
8 Lunatico  (9.5)
9 Wonderland XII  (9.5)
10 Christmas Megademo  (9.5)
Top onefile Demos
1 Copper Booze  (9.6)
2 Daah, Those Acid Pil..  (9.5)
3 Dawnfall V1.1  (9.5)
4 Cityscape 2730  (9.5)
5 To Norah  (9.5)
6 Lovecats  (9.5)
7 Kamaji's Boiler Room  (9.5)
8 Elite Code Mechanics  (9.4)
9 Barry Boomer - Trapp..  (9.4)
10 Offering  (9.4)
Top Groups
1 Booze Design  (9.4)
2 Performers  (9.4)
3 Oxyron  (9.3)
4 Fossil  (9.3)
5 Crest  (9.2)
Top Logo Graphicians
1 Sander  (10)
2 Mermaid  (9.5)
3 Pal  (9.4)
4 Shine  (9.2)
5 Jailbird  (9.0)

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