Patched SIDCog - MUL used, 64 kHz sampling, 12 dB/oct filter
pik33
Posts: 2,366
In the post #7 I uploaded a version of it which seems to be good enough. It still needs tuning
Comments
I had modified the SIDCog sample rate a while ago. I believe you also need to modify ENV_CAL_FACTOR accordingly.
I just looked at my modified code from back then and I found I had reduced C64_CLOCK_FREQ from 985248.0 to 705600.0 and had also changed ENV_CAL_FACTOR by the inverse ratio (ie. I increased it by the ratio 986248/705600). I recall it sounded okay to my ears at the time but that was a year or more ago now. See if that helps you.
Roger.
It still need a tuning - I have too low knowledge about real SID.
The real SID had 12 dB/oct filters, where sidcog filters was 6 dB/oct. Now there was place for 12 db/oct, which I did by simply adding the second filter block.
So there it is sidcog for p1v retromachine, with 64 kHz sample rate and 12 dB/oct filters.
I removed all these yesterday's trials.
I wish the Prop1 would have had a multiplication instruction from the start, then we could have done this a long time ago.
Can you record some tunes with heavy filter usage, so I can have listen?! I don't have my DE2-115 available ATM.
/Johannes
And.. look at this code - I left one bandpass stage - there is 6 dB/oct bandpass in the sid documentation
And these constans... I don't fully understand them. Then there is a noise generator - maybe it needs changes too...
Here are recordings made with SIDcog 1.2 (32 kHz) from a couple of years ago as a reference!
[video]
[video]
[video]
[video]
/Johannes
So there are some files I have ready now: Zelda and Da Winner. A short fragments, about 1 minute, mp3
or is it just some artifact in the beginning of this tune?
collection2.zip
The proper solution is a filter between sidcog output and sound chip on DE2-115. Even simple one will do its job.
Here are the dumps so you can make records, then it will be easier for me to hear if anything sounds wrong.
HeavyFilterSidDumps.zip
/Johannes
And now I need to add antialias filter between a sidcog and a soundchip to get rid of these aliases.
So instead
I can use
and
Now the sidcog works in exact synchronicity with the sound chip (all clocks are synchronous in my retromachine); no resampling needed. There is also no need to run it at higher sample rate because the sound chip works @ 44100
There is now A LOT OF time in the Sidcog main loop. SampleRate is 2592, where it now consumes less than 1500 clocks. We can think about more complex filters, antialias output filter (aliasing which emerges when the harmonics meets the sample rate - the signal should be always high pass filtered) and more SID channels in one cog.
Edit: and with simple antialias
While this effort is great, it just isn't the same thing as having a real Propeller. I can not use it any project of mine. Ooooh how a wish the real P1 had a MUL instruction.
IMHO.... I rather have some aliasing in the audio than a LP filter at 11025 Hz... oooooh the horror of muffled sound... don't even get me started about the "default" audio filter used by almost all Propeller Platforms...The perceived audio quality is WAAAY better without that filter. There are a lot of different ways to handle aliasing, but this approach DEFINITELY is not the right way. I hate aliasing with a passion, but muffled sound makes me want to throw away my 1800 dollar computer sound system...
A brick wall filter at 22050 sadly isn't feasible on the Propeller though. Oversampling with a simpler filter is another approach, but signal processing isn't part of the strengths of the Propeller.
We have a MUL. I used a quick and simple 11025 antialias, but we can use a more advanced filter using some MUL instructions; now there is a place for it. 16 kHz, 4th order filter will not muffle the sound. Maybe, for some very young people who can hear up to 20 kHz it will.
Now the filter characteristics are different than in original sidcog. To change this I have to rewrite some filter code using another bunch of mul instructions, but what this version outputs now is not that bad.
I added the antialias filter which now has ~16 kHz frequency, so it doesn't make the sound dull. This is simple 6 dB/oct filter; I have now some coefficient to make a 4th order Chebyshev filter @ 18 kHz - maybe later.
The problem with further developing the sidcog now is not the time - I have ~1000 cycles left now. There is problem with the place - it ends @ $1E7 So, now the code should be optimized for size, and not for speed which is not critical in this environment - 88200 Hz is not possible in any way.
To make the retromachine easier using of sidcog without switching off one of 4 synth channel, I added a new register for it. So I have now a SID chip on board
Attached the modified sidcog and its output.