As I thought before there is still something to change - the filters need update, too; changing sampling frequency causes filter parameters shift. I have now to find what parameters are to be changed for them to work properly.
The author of SIDCog needed... I still don't understand in details how SID filters should work. And I cannot send him a private message because he has his mailbox full.
Filter still doesn't work as expected; there are some other parameters to change. Still, it is worth to do it, the 64 kHz version sounds better (until the filter is not used)
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.
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 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.
Can you give some titles?
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...
@pik33: Sounds really nice. The only thing I notice is some aliasing in the dawinner.mp3 - am I right
or is it just some artifact in the beginning of this tune?
There are 2 sources of these aliases. (1) 64kHz->44100Hz in the retromachine without any filtering (todo) (2) recording and mp3 compression. These aliases in Da Winner are less hearable directly from the hardware than after recording.
The proper solution is a filter between sidcog output and sound chip on DE2-115. Even simple one will do its job.
I will have a look in the code as well, but just by listening to the recordings it seems like you got most of the changes right.
Here are the dumps so you can make records, then it will be easier for me to hear if anything sounds wrong.
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.
As far as I can tell you have made all the right changes in the 64 kHz version.
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.
So this is a SIDCog optimized for use with my retromachine. The machine's soundchip works @ 44100 Hz, so, to avoid resampling which causes a lot of aliases the sidcog now works @ 44100 Hz. This is only possible with a mul instruction which allowed me to mul the frequency register by 5720 instead of shl-ing it by 12 (=mul 4096) or 13 (8192)
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
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.
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.