skjelten/emusc

Some observations

Opened this issue · 9 comments

Just wanted to bring more attention to things, but first off. The biggest thing appears to be the samples.

The way the samples are done I think is something interesting in itself. Every sample has tuning data for both the base sample and loop split. This was a big issue during the making of my SoundFont and why I ceased the development entirely.

This here may help you. I fiddled with a Distortion Guitar sample and I had the base sample without the loop set at 18654Hz for note A#3, but correcting the loop to a SCVA recorded sample, the rate for just the loop by itself had to be moved down to 18589Hz.

So converting it back to the rate of the sample back to 32000Hz as determined, the rate of the loop would be 31889Hz for that particular sample. It being 32000Hz and only having the loop starts and ends won't stop the detuning, best example can be heard in At Doom's Gate (d_e1m1.mid) where the guitars sound a bit off.

Other issues besides this? One of them would be the root keys. I'd noticed it more for the drums, as the toms and cymbals would sound too high or low pitched. Later I think it'd be good to add interpolation features for the samples. Right now it seems to just be linear, but sinc interpolation would 100% help it sound as smooth like the module outputs it.

I hope to see more progress and improvement soon! I'm curious to see how you'll tackle the reverb and chorus, but this project is definitely one of the most exciting haha.

Separate tuning for the looped part of a sample? 🤔
I'm struggling to understand why this is necessary. Is it because the loop length is not an integer multiple of the fundamental pitch period?
(This would be more pronounced when the loop length is very short, like 4 or 5 wave cycles.)

Yes, I'm sure that's what they did. Adding tuning to the loops themselves as a move done to ensure there wouldn't be detuning on playback. No modifications would be made to the samples of course, just systematically the loops would be tuned differently apart from the base sample post-loop.

While the SC-55 does have three envelopes, one being pitch, that particular instrument doesn't appear to use the pitch envelope at all:

image

While the SC-55 does have three envelopes, one being pitch, that particular instrument doesn't appear to use the pitch envelope at all:

image

I don't think it's an envelope thing at all. I'm thinking that like the samples have pitch correction values, the loops themselves would also have some of their own to avoid detuning on MIDI playback.

Samples do have a fine pitch correction value, but it applies to the entire sample, not part of it.

image

these are the samples used by distortion guitar and the break point table (break points are the note it switches)

If there isn't any data for pitch correction values on the loop parts, then I don't know what's wrong with it. It can't be the samples themselves because they were decrypted completely raw. I only have theories that the tuning of the loops are systematically fixed by some part of the Control ROM since I ran into plenty of detuning issues when making my SoundFont.

Well that was my next question - couldn't the loop tuning be fixed analytically? I'll put my thoughts in a concrete example, at risk of being completely wrong:

Let's say some sample data contains a note played at 440 hz root frequency, at a 32000 hz sample rate.

  • Each wave period is 72.7272... frames (32000 ÷ 440).
  • A loop point is set covering exactly two wave periods.
  • The ideal size of two wave periods is 145.4545 frames, but the loop length is an integer value, rounded down to 145 frames.
  • This means the loop will be slightly too fast, out of tune (sharp), and the playback rate needs to be slightly adjusted (even though the sample data was perfectly matched to the root note of A440 at 32000 hz).

We need to correct for that, and play the looped portion slower; multiply the playback rate by a factor of 145:145.4545. Or in general form (pseudocode):

float period_size = sample_rate / sample_root_freq; // 32000.0 / 440.0
float loop_count = loop_length / period_size; // 145.0 / 72.7272...
float correction_factor = loop_count / round(loop_count); // 1.99375 / 2.0 = 0.996875

I don't think there is any data surrounding specifically loop portions of the sample playback. There's still several unknown parameters in the control rom, but pitch is easy to find via experimentation and I probably would have come across this if it were there. Check out the spreadsheet with the control rom preset data sometime if you want a more complete understanding of what i'm talking about. There's three tables that generally contribute to how a sample is modified:
The preset parameters, then the break point table, and finally the sample table which mostly contains fine tuning volume pitch and the point at which the sample loops.