Noise generator implementation in VICE

You need an actual VIC.

Moderator: Moderators

nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Noise generator implementation in VICE

Post by nippur72 »

@tlr I haven't noticed the effect you describe. Perhaps is it on a low note? On higher tones (e.g. POKE 36877,254) the LFSR wraps around very quickly and you ear always the same repeating pattern.
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: Noise generator implementation in VICE

Post by tlr »

Listen to the snare on DATAPOP here: http://sleepingelephant.com/ipw-web/bul ... php?t=3969
The snare is configured the same throughout the song but sometimes becomes "muffled" for a couple of beats. It's a bit subtle here but it's definately there. I'll see if I can find a better example. The effect seems like a different initialization pattern in the shift reg or perhaps something like the viznut waveforms in a shift register somewhere in the design. It's never been modelled accurately. I'd love to be able to control it.

EDIT: I think it's more apparent here: https://www.commodore.ca/manuals/funet/ ... AR89-1.prg
and also it can be heard in some of the example songs of victracker.
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: Noise generator implementation in VICE

Post by tlr »

It's also discussed in this thread started by rga24: http://sleepingelephant.com/ipw-web/bul ... =11&t=4956
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Noise generator implementation in VICE

Post by nippur72 »

Perhaps there is still something we don't take into account.... uhm..., some kind of effect... but I have no idea what.

I sampled the output of my FPGA and compared to your recording of "datapop". Here is the file if you want to look at the two side by side. You can open it in "Audacity" (free wave editor).

The track on top is FPGA, bottom is real VIC20. I turned off the 1.6 Khz filter for a brighter audio. There is a small offset between the two waveforms (that increases over time) due to the FPGA not being able to replicate VIC20's clock with 1HZ resolution.

The two waveforms match quite closely (if you consider various analog effects), anyway in certain points the noise is definitely different.

I guess there is the viznut effect also on the noise generator, but I have to check it first.
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: Noise generator implementation in VICE

Post by tlr »

There could be some compression artifacts on the noise though. You should probably re-record from the hw in some lossless format just to make sure. That AR89 demo should show the effect more isolated for the noise although I guess datapop produces a more repeatable output.

Maybe rga24 is still around here? Those test programs he mentions would be interesting to try out.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Noise generator implementation in VICE

Post by nippur72 »

I sampled it uncompressed (.WAV). The real VIC20 datapop is from your mp3 ... do you have it uncompressed?

To make a good compare between the two, the lowpass filters should match as closely as possible. I'll try to get a non filtered version from the FPGA (or from the modded VICE), and then choose an appropriate filtering.

We should also prepare some test programs, i.e. running the all the viznut waveforms on all the 4 voices on a small set of tones. BTW, can you sample audio from your VIC20? My TV-set does not have an audio out plug to sample from (I can only sample from FPGA).
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: Noise generator implementation in VICE

Post by tlr »

nippur72 wrote:I sampled it uncompressed (.WAV). The real VIC20 datapop is from your mp3 ... do you have it uncompressed?
A long time ago, but maybe...
nippur72 wrote:We should also prepare some test programs, i.e. running the all the viznut waveforms on all the 4 voices on a small set of tones. BTW, can you sample audio from your VIC20? My TV-set does not have an audio out plug to sample from (I can only sample from FPGA).
There could already be some test programs in the VICE test program repository. I'll have a look.
As for sampling, my vic-20s and other hw setups are unfortunately packed away at the moment. Audio out is available in the video DIN though. Couldn't you get it from there or are you using the RF-modulator?
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Noise generator implementation in VICE

Post by nippur72 »

I use a scart cable, I suppose I can get the audio from the scart itself, I only miss the required cables.

I already have a viznut test program I wrote when I worked on the sound generator for the FPGA, I only need to improve it.
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: Noise generator implementation in VICE

Post by tlr »

nippur72 wrote:I already have a viznut test program I wrote when I worked on the sound generator for the FPGA, I only need to improve it.
Great!

This is what is in the vice repo: https://sourceforge.net/p/vice-emu/code ... ogs/VIC20/
Not much around the audio unfortunately. Please submit any programs you make for future reference.
lance.ewing
Vic 20 Afficionado
Posts: 413
Joined: Sat Nov 10, 2012 3:19 pm
Website: https://sites.google.com/site/mos6561vic/

Re: Noise generator implementation in VICE

Post by lance.ewing »

Do we think that this effect is specific to the noise voice (and therefore an explanation would be within the noise part of the die shot)? Or could it apply to the sound in general (and therefore might be somewhere after the individual voice sections, or if not, then due to something common to all voice sections)?

And do we have some theories about what we'd be looking for on the die shot that might account for the effect?
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: Noise generator implementation in VICE

Post by tlr »

It appears to be specific to the noise generator. I rely a fair amount on that the shift register ring behaviour of the oscillator voices is correct in DATAPOP. It seems to be 100% accurate on hw and in the vice emulation, at least on that level of detail. The noise behaviour seems very different. I would assume that the initial value in the LFSR construct has something to do with it but a normal LFSR should recover unless it's all zeroes. I confess I haven't looked at your analysis of that part in detail although I've followed the thread somewhat.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Noise generator implementation in VICE

Post by nippur72 »

I made a simple test program for all the viznut-pwp waveforms, you can find it here.

I haven't tried on a VIC20 yet, I am curious to know if there is the "viznut" effect also on the noise generator.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Noise generator implementation in VICE

Post by nippur72 »

this is a point in DATAPOP (arount 7 seconds after the start) where the two waveforms are quite different.

Top: FPGA
Bottom: real VIC20
twowav.jpg
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: Noise generator implementation in VICE

Post by tlr »

Interesting differences there but quite hard to analyze as the bursts are so short.
I looked at the vhdl-code you posted in the vice bugtracker. Could it be that the logic of resetting and/or clocking the LFSR and circular shift reg is different than your model in the case of gate off?

From what I could tell the circular shift reg is after the LFSR. If that was to stop on gate off maybe some strange effects could arise, atleast for the start of the sequence. Also the LFSR seems to be '1' filled on gate off. This would mean the noise always starts the exact same sequence assuming it was clocked 16 times with gate off. Is that really so?

BTW: in datapop, the fifo that feeds values into the noise register is at $10c0-$10ff. There you can quicky see the register values used during a particular section. It's a circular buffer with the current offset stored in $bc. At $03a0-$03df the number of 256 cycle intervals to keep that value is stored (the current one is counting down in place).

Typical sequence:

Code: Select all

>C:10c0  80 7e 7e 7e  7e 7e 7e 7e   .~~~~~~~
>C:10c8  7e 7e 7e 7e  7e 7e 7e 7e   ~~~~~~~~
>C:10d0  fd fd 7e 7e  7e 7e 7e 7e   ..~~~~~~
>C:10d8  7e 7e 7e 7e  7e 7e 7e 7e   ~~~~~~~~
>C:10e0  df e7 df e7  df 7e 7e 7e   .....~~~
>C:10e8  7e 7e 7e 7e  7e 7e 7e 7e   ~~~~~~~~
>C:10f0  fd fd 7e 7e  7e 7e 7e 7e   ..~~~~~~
>C:10f8  fd fd 7e 7e  7e 7e 7e 7e   ..~~~~~~

>C:03a0  37 37 37 37  37 37 37 37   77777777
>C:03a8  37 37 37 37  37 37 37 37   77777777
>C:03b0  37 37 37 37  37 37 37 37   77777777
>C:03b8  37 37 37 37  37 37 37 37   77777777
>C:03c0  37 37 37 37  37 37 37 37   77777777
>C:03c8  37 37 37 37  37 37 37 37   77777777
>C:03d0  37 37 37 37  37 37 37 37   77777777
>C:03d8  37 37 37 37  37 37 37 37   77777777
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Noise generator implementation in VICE

Post by nippur72 »

I had no time to check that, but I also suspect it's a matter of what LFSRs do when the gate is off and also a matter of their initial value.

Next time to check is whether the 16-bit LFSR starts over on a fixed seed or keeps continuing when the gate is off.

Regarding DATAPOP, I haven't understood what are those numbers, should I POKE the values from $10c8-$10f8 into 36877 ? (at a fixed interval)
Post Reply