Previous Thread
Next Thread
Print Thread
Page 42 of 55 1 2 40 41 42 43 44 54 55
Joined: Nov 2003
Posts: 459
K
Senior Member
Offline
Senior Member
K
Joined: Nov 2003
Posts: 459
One more for today, from Saturn this time:

Conveni, The - Ano Machi wo Dokusen Seyo (1997)(Masterpiece, Access, Human):

http://2sf.hcs64.com/rip/Conveni,%20The%20-%20Ano%20Machi%20wo%20Dokusen%20Seyo%20(1997)(Masterpiece,%20Access,%20Human).zip

This game uses 2.04 version of the driver (the one that's very quiet). Did use the original driver and opted for volume=100 tag. Seems to help, don't hear anything bad with the rip (well, it's still kinda quite, but at least you can listen to it).

//Edit

Crap, noticed one of the tracks did overflow the tone bank.
Proper rerip uploaded, correct BGM07.SSF CRC32: E1BF4CC1

Last edited by Knurek; 01/06/09 08:37 PM. Reason: rerip info
Joined: Mar 2001
Posts: 17,215
Likes: 234
R
Very Senior Member
OP Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,215
Likes: 234
Nifty. Treasure Strike was crappy as advertised, but more rips is more rips. I'll check out Conveni a bit later.

Joined: Nov 2003
Posts: 459
K
Senior Member
Offline
Senior Member
K
Joined: Nov 2003
Posts: 459
Conveni is nice if you like muzak. 's to be expected given that it's a convenience store sim.

Joined: Mar 2001
Posts: 17,215
Likes: 234
R
Very Senior Member
OP Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,215
Likes: 234
Heh. You weren't kidding about Conveni being quiet. Nice songs though. BGM09 sounds like it's threatening to break out into reggae before it just stops.

Joined: Feb 2008
Posts: 107
D
Senior Member
Offline
Senior Member
D
Joined: Feb 2008
Posts: 107
I can't get that damned filter to work.
I've been trying to match the output of kingshriek's script to what (I think) I should be getting and it doesn't correspond.

Given f=1.0 and different q values I end up with cutoff F at 9-15kHz. You'd think with f that high it should easily go up to 22kHz (and above). On the other hand, if I'm reading the figure right, I should expect F as low as 4Hz for f=0.25 and about 50Hz for f=0.5

The Q has range of -3 to 20.25dB:
Q [dB] = 0.75 * (reg_val - 3)
where reg_val is 0 to 31.

Is there a clever way to figure out the filter equation given some points with f and resulting cutoff F known? Assuming Q is neutral, that is 0dB.

Joined: Feb 2008
Posts: 107
D
Senior Member
Offline
Senior Member
D
Joined: Feb 2008
Posts: 107
Q is 0.75 * (reg_val - 4). Or, 0.75 * reg_val - 3. It's quite funny how I used bold on the part I made mistake in, and can't even edit it now smile

Anyway, BIOS uses filtering as well - not to mention envelopes. Shenmue music seems to prefer single values (infinite time between FEG points). The problem is that if I move the cutoff point (for a given filter value) lower it makes Shenmue sound better - but also breaks BIOS sounds. And vice versa. The only immediate difference that I see is that on the most broken sound effects BIOS uses Q (register) value of zero.

I'm beginning to wonder if the filter equation proposed by Corlett is indeed correct - hence the question, how do I come up with something like that given the cutoff vs filter value curve. Q unknown but assumed to be 0dB.

Joined: Sep 2007
Posts: 56
K
Member
Offline
Member
K
Joined: Sep 2007
Posts: 56
Given f (derived from the filter value) and q (given), you need to solve the following equation to get the cutoff frequency:

abs(H(f, q, w)) = -3.0 dB

where H is the filter transfer function and w is the normalized digital frequency (with 1.0 corresponding to the Nyquist frequency of 22050 Hz). In other words, the cutoff frequency will be 22050 * w.

For this particular filter, the transfer function is:

H(f, q, w) = f / (1 - (1 - f + q)*z + q*z*z)

where z is the point on the unit circle in the complex plane at angle -pi*w:

z = exp(-j*pi*w)

Quick python script to do the above:

Code
from cmath import *
from bisect import bisect
import sys

def transfer_function(f, q, w):
	zi = exp(-1.0j*pi*w)
	return f / (1.0 - (1.0 - f + q)*zi + q*zi*zi)

def bisection(func, x0, x1, TOL=1.0e-6):
	while abs(x1 - x0) > 2*TOL:
		x2 = (x0 + x1) / 2.0
		if func(x0) * func(x2) > 0:
			x0 = x2
		else:
			x1 = x2
	return (x0 + x1) / 2.0
	
def calculate_f(filtervalue):
	return ((((filtervalue & 0xFF) | 0x100) << 4) >> ((filtervalue>>8)^0x1F))/8192.0

def lpfcutoff(filtervalue, q):
	f = calculate_f(filtervalue)
	func = lambda w: 20.0*log10(abs(transfer_function(f, q, w))).real + 3.0
	return 22050.0*bisection(func, 0.0, 1.0) 

if __name__ == '__main__':
	argv = sys.argv
	argc = len(argv)
	
	if argc == 1:
		sys.stdout.write('Usage: python %s <filtervalue> [<q>]\n' % argv[0])
		sys.exit(0)
	
	if argv[1][:2].lower() == '0x':
		filtervalue = int(argv[1], 16)
	else:
		filtervalue = int(argv[1])
	
	if argc == 2:
		q = 0.0
	else:
		q = float(sys.argv[2])
	
	sys.stdout.write('%f\n' % lpfcutoff(filtervalue, q))


Joined: Feb 2008
Posts: 107
D
Senior Member
Offline
Senior Member
D
Joined: Feb 2008
Posts: 107
Still, this is just another brute-force method smile
Don't get me wrong, I know that IIR filter design is not exactly elementary school math. I just hoped there would be a way to figure out the whole thing - without having to try out one conversion equation after another...

I've already modified the previous script to generate f to cutoff frequency table, it's way off from that in AICA docs. So it seems that at least we can't use the filter value directly as the f coefficient (I've tried this too by the way).
This script is more accurate because I was to lazy to actualy solve the transfer function, rather I just made the loop do 1000 points and waited for it to dive below -3dB.

That does not address the main issue I have now - is the filter itself correct or not. This is what little I understand:

Basic 1-pole filter:
out = f * in - (1 - f) * prev_out

Basic 1-pole filter with negative feedback:
out = f * in - (1 - f) * prev_out - q * prev_out

In the end q * (prev_out - prev_prev_out) is just a slightly more convoluted way of introducing feedback - or am I wrong? This feedback will cause resonance, though (if I get this right) q in AICA can also have negative values, causing a dip first - very dangerous with f close to 1 as it will tend to amplify and overload.

The problem is I never found anyone doing actual filtering with this kind of feedback - though I've stumbled upon statement that resonance is not really used much except in synthesiers (which AICA is).
I'm going to run more tests on Dreamcast this weekend. Perhaps FEG is much more closely tied to AEG than I initially thought... With my luck it's going to turn out this is not a filter problem at all, but something entierly else - just like it was with the DSP smile

Joined: Feb 2004
Posts: 2,597
Likes: 300
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,597
Likes: 300
/me goes into signal processing lecturer mode:

All IIR filters introduce feedback - after all, that's the way they generate an infinite impulse response (hence the name). The output from an IIR filter is only bounded for a subset of possible inputs - it is possible to give input that will cause an IIR filter to go into self-sustaining oscillations.

That's why FIR filters are much more common in control systems. Unconditional stability is a big plus. FIR filters also have linear phase response. However, the transport delays introduced by an FIR filter can be problematic, too. FIR filters are easy to design, too - just do an inverse Fourier transform of the impulse response to get the frequency response, and vice versa.

Why use an IIR filter? An IIR filter with a given number of taps can be made to have much steeper roll-off than an FIR filter with the same number of taps. An IIR filter can be made to have lower transport delay, which could make or break a controller. Finally, if you really do want to produce oscillations under certain conditions, an FIR filter will never do that for you.

If you want to play with digital filter design a bit, you can download DFDP (an old Fortran program that runs under DOS). The next step up would be to use MATLAB Simulink's linear system analysis features to play around. If you're more serious about learning digital control system theory, the text you can't go past is Katsuhiko Ogata's Discrete-Time Control Systems (2nd Edition).

Joined: Feb 2008
Posts: 107
D
Senior Member
Offline
Senior Member
D
Joined: Feb 2008
Posts: 107
Words "MATLAB" and "Simulink" scare me. See, back at Uni they've managed to convince me that I in fact do not like math. Or know it, for that matter smile

I have just enough knowledge to understand what "zi = exp(-1.0j*pi*w)" does in kingshriek's script and why, or how to build my own function to compute frequency cutoff for a given FIR/IIR filter. But that's it.
There is always a chance I will figure this out, probably by sheer luck trying every possible filter equation I can come up with, but that will take massive amounts of time and work.

I'm hoping someone with more experience in that matter could, with little effort, just pull something nice out of his/her magic hat smile

Page 42 of 55 1 2 40 41 42 43 44 54 55

Moderated by  R. Belmont, Richard Bannister 

Link Copied to Clipboard
Who's Online Now
2 members (Kale, 1 invisible), 233 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,320
Posts121,923
Members5,074
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com