How do you compute the echo delay from the value written to EDL ?
According to Anomie's doccument, there is EDL<<9 stero samples (assuming EDL nonzero), so the lenght should be :
t = 512 * EDL / 32000
This makes delays possible from 16 ms to 240 ms.
However, there is conflicting info about it. It says somewhere that the echo buffer can be up to 0.9 second long, and I was sure seeing it somewhere else the max length was 0.5 seconds. So I am totally confused.
PS : By the way, I guess a EDL = 0 transform the echo buffer in a IIR digital filter. Could this be used in a fun/meaningful way ?
What you have is correct, delay can be from 0 to 240 msec. I can imagine what the other erroneous ones were calculated from. The 0.9 sec could have been incorrectly looking at the byte length of the echo buffer, 2048*EDL = 30720 bytes, and taking that to mean the length in stereo samples. The 0.5 could have been interpreting the same as a stereo sample count.
And yeah, EDL=0 makes the echo length one stereo sample, so that what it wrote the previous sample is what it reads the next. This is what I used in that near-CD-quality demo a while back. If you turn echo write off, it just reads this stereo sample each time and plays it (if you have the FIR loaded), so you can stream sound through it.
Thanks for that precision.
The use of EDL = 0 with echo write disabled an additional "direct" channel is a clever idea (I don't know if it was designed to be used like this).
However there is two other things that comes to mind :
1) With EDL = 0 and echo write *enabled*, the output will be something like this : OUTPUT = OUT(n) + OUT(n-1) * ECHO_FEEDBACK + OUT(n-2) * ECHO_FEEDBACK ^2 + ....
I guess this is what is called a IIR filter, and could be used to filter the whole output (instead of just filter the echo, at the price of having no echo).
2) With EDL > 0 and echo write *disabled*, it should be possible to write a software mixer in SPC700 assembly (with again the price of having no echo), and simulate more channels. However I suspect that the low memory, and the limited CPU speed will make this quickly problematic.
This could be a way to simulate PSG channels on the SNES without having to deal with the gaussian interpolation which "muffles" the sound.
EDIT : after further investigation, each sample would need in average (significantly) less than 32 clock cycles for a software mixer to be possible. So something evolved (like resampling, etc...) is definitely not possible, but something simple like simulating PSG should be very possible with a few optimizations and unrolled loops.
Ahhh, clever! Yeah, you could set the MVOLs to 0, so that you don't hear it directly, but still have it write to echo, and have the EVOLs non-zero, so you hear echo output. Then it constantly feeds back on itself in a FIR-IIR combination (remember, the FIR has its own 8-sample history buffer, independent of the echo buffer, so you still get the FIR). That would definitely allow some interesting effects. I suppose you wouldn't need to set the MVOLs to zero, since setting them to non-zero would just add an initial coefficient. This way, you could disable echo for some channels so that they sound normal.
Quote:
[writing your own samples] could be a way to simulate PSG channels on the SNES without having to deal with the gaussian interpolation which "muffles" the sound.
Yeah, I wanted to try this sometime. I think I already figured out a way to get PSG channels without the muffling, while still using the normal voices: have a bunch of square waves with varying widths, then choose the best one and adjust the pitch slightly away from 1.0. This way you don't get all the rounding at the edges. I think I tried this once and it worked well; clean pulse waves.
Okay after some quick hacking some SPC song. I hope Alpha-II based SPC players are accurate - I'd have to test it on my SNES when I get time to do it. It seems a negative feedback makes a high-pass filter, and a positive feedback makes a low pass-filter.
Having the main enabled as well change things a little - it makes a high-boost filter and low-boost filter respectively, and allow channel to play normally as well.
In the extreme case if the feedback is -1 (0x80), a particular frequency arround 1050 Hz seems extremely amplificated.
I tried this with a "identify" FIR filter (0x7f, 0x00....), I didn't try other type of FIR because I don't know much how this works.
EDIT : I now understand why so many SPCs use a values values like $20, $40 or $80 for their counters. A value of $80 correspond to the period of an echo portion (where the total echo period is EDL echo portions).
Interesting, that is about what you'd expect (high-pass and low-pass). These filters would just combine, since it's an LTI system. Multiply the frequency response of this filtering you achieved with that of the FIR coefficients to get the combined response. Put another way, take your signal and filter it through this, then the FIR, and you have the final signal. The order doesn't matter.
Bregalad wrote:
Okay after some quick hacking some SPC song. I hope Alpha-II based SPC players are accurate - I'd have to test it on my SNES when I get time to do it. It seems a negative feedback makes a high-pass filter, and a positive feedback makes a low pass-filter.
Having the main enabled as well change things a little - it makes a high-boost filter and low-boost filter respectively, and allow channel to play normally as well.
In the extreme case if the feedback is -1 (0x80), a particular frequency arround 1050 Hz seems extremely amplificated.
I tried this with a "identify" FIR filter (0x7f, 0x00....), I didn't try other type of FIR because I don't know much how this works.
EDIT : I now understand why so many SPCs use a values values like $20, $40 or $80 for their counters. A value of $80 correspond to the period of an echo portion (where the total echo period is EDL echo portions).
You mean like SNESAmp? It has very good compatiblity, but it has failed to play some SPC files from a few games, and these work on other SPC players. They are ClayFighter 2, Mickey's Playtown Adventure, and We're Back! A Dinosaur's story. I do SPC sets for SNESMusic.org (though I use a Mac, not Windows, so these were confirmed by someone else), hence the reason why I know this.