Audio: new dsp_coef.bin with windowed sinc filter coefficients

This commit is contained in:
Shane Nelson 2015-06-27 17:45:31 -04:00
parent a71e81a143
commit 388ab13db1
4 changed files with 43 additions and 2 deletions

Binary file not shown.

View File

@ -42,7 +42,10 @@ static bool VerifyRoms()
// delroth's improvement on LM1234 replacement ROM (Zelda and AX only, // delroth's improvement on LM1234 replacement ROM (Zelda and AX only,
// IPL/Card/GBA still broken) // IPL/Card/GBA still broken)
{ 0xd9907f71, 0xb019c2fb } { 0xd9907f71, 0xb019c2fb },
// above with improved resampling coefficients
{ 0xd9907f71, 0xdb6880c1 }
}; };
u32 hash_irom = HashAdler32((u8*)g_dsp.irom, DSP_IROM_BYTE_SIZE); u32 hash_irom = HashAdler32((u8*)g_dsp.irom, DSP_IROM_BYTE_SIZE);
@ -69,7 +72,7 @@ static bool VerifyRoms()
DSPHost::OSD_AddMessage("You are using an old free DSP ROM made by the Dolphin Team.", 6000); DSPHost::OSD_AddMessage("You are using an old free DSP ROM made by the Dolphin Team.", 6000);
DSPHost::OSD_AddMessage("Only games using the Zelda UCode will work correctly.", 6000); DSPHost::OSD_AddMessage("Only games using the Zelda UCode will work correctly.", 6000);
} }
else if (rom_idx == 2) else if (rom_idx == 2 || rom_idx == 3)
{ {
DSPHost::OSD_AddMessage("You are using a free DSP ROM made by the Dolphin Team.", 8000); DSPHost::OSD_AddMessage("You are using a free DSP ROM made by the Dolphin Team.", 8000);
DSPHost::OSD_AddMessage("All Wii games will work correctly, and most GC games should ", 8000); DSPHost::OSD_AddMessage("All Wii games will work correctly, and most GC games should ", 8000);

View File

@ -1,3 +1,16 @@
Legal GC/WII DSP IROM replacement (v0.2.1)
-------------------------------------------------------
- coef: 4-tap polyphase FIR filters
- irom: unchanged
Coefficients are roughly equivalent to those in the official DROM.
Improves resampling quality greatly over linear interpolation.
See generate_coefs.py for details.
stgn
29/june/2015
Legal GC/WII DSP IROM replacement (v0.2) Legal GC/WII DSP IROM replacement (v0.2)
------------------------------------------------------- -------------------------------------------------------

View File

@ -0,0 +1,25 @@
from numpy import *
from struct import pack
def pack_coefs(c):
cw = list(zip(c[ :128][::-1],
c[128:256][::-1],
c[256:384][::-1],
c[384: ][::-1]))
m = max(sum(x) for x in cw)
return b''.join(pack('>4h', *(int(round(n / m * 32767)) for n in x)) for x in cw)
x = linspace(-2, 2, 512, endpoint=False)
w1 = hamming(512)
w2 = kaiser(512, pi * 9/4)
coef_1 = [sinc(n * 0.5) for n in x] * w1
coef_2 = [sinc(n * 0.75) for n in x] * w2
coef_3 = [sinc(n) for n in x] * w1
with open('dsp_coef.bin', 'wb') as f:
f.write(pack_coefs(coef_1))
f.write(pack_coefs(coef_2))
f.write(pack_coefs(coef_3))
f.write(b'\0' * 1024)