VOGONS


First post, by Ictoagh

User metadata
Rank Newbie
Rank
Newbie

I've been working on rearchetecting the MT-32 Emulator, to see if I can come up with something that will finally rid it of it's (very few, but hard to find) niggling audio problems.

One of the things that always chapped me when reviewing the code was the load procedure for the PCM ROM... Here's a newer, more efficient loading routine. I also simplified the dB --> linear conversion a bit, which yeilds a fairly good result

    while (!feof(fIn)) {

short s;

*(((char*)&s)+1) = fgetc(fIn); *(((char*)&s)+0) = fgetc(fIn);
short e;

// Bits are ordered in the file as follows:
// 15;6;14;13 12;11;10;9 8;5;4;3 2;1;0;x

e = s & 0x8000;
e |= s << 8 & 0x4000;
e |= s >> 1 & 0x3F80;
e |= s << 1 & 0x007E;

// Get a normalized sample value
float ns = float((e) & 0x7fff)/32768.0;

// Convert Log to Linear, Multiply by bit depth
// I believe this is set up to be over a 100 dB
// range
float o = powf(10,5*(ns-1)) * 32767;
s = e&0x8000?-o:o;

m_PCMRom[i] = s;

i++;
}

For the life of me, I cannot figure out why the samples are stored in such a weird bit order (scambled?) Perhaps this has something to do with the address lines in the ROM?

Reply 2 of 2, by Ictoagh

User metadata
Rank Newbie
Rank
Newbie

CC:

Hmm,

I see from the topic you posted dealing with the legal dispute over the ROM data (hopefully, this gets sorted out eventually ...) that you're doing a complete rewrite?

I've been working on a bit of a rewrite as well, on my end, I've got partials mostly emulated (TVF is somewhat working, TVA shouldn't take too much effort), but it's far from optimised, I plan to profile and spot-optimize the code when I've got it working... I'm doing it mainly as a learning excersize and a coding excersize. My main motivation for this is to see how frequencies are being translated down to the partial and wave generator level (tables make it difficult to see what the effects are, and your current incarnation understandably uses lots of tables for efficiency.)

One of the things i have been doing is as I am developing partials, I'm simply playing a scale, instead of translating the MIDI messages, this helps me auditorily debug what is going on, but the drawback is I don't have a direct comparison...

I'm working back from partials to timbres, and eventually channels.. I've also been mulling over the partial assignment issue.

I have noticed that the current version does tend to occasionally drop partials, as well as misapply partials (sometimes a drum sounds like it's being ring modulated with an existing tone, giving strange effects), also, the start-up sequence for firehawk (the *bang* each time a letter goes to it's place in the title), via the panel I see a ton of notes being hit on 2 channels, one of which is an Acoustic Bass drum (iirc), The Acoustic Bass drum sound only rarely gets played.