|
Joined: Dec 2022
Posts: 12
Member
|
OP
Member
Joined: Dec 2022
Posts: 12 |
I'm looking into the es550x_device::generate_pcm function in the es5506.cpp file, and i'm unsure if there's a tiny bug or it is just me not understanding what happens.
// fetch two samples
s32 val1 = (s16)read_sample(voice, get_integer_addr(accum));
s32 val2 = (s16)read_sample(voice, get_integer_addr(accum, 1));
// interpolate
val1 = interpolate(val1, val2, accum);
accum = (accum + freqcount) & m_address_acc_mask;
// apply filters
apply_filters(voice, val1);
// update filters/volumes
if (voice->ecount != 0)
update_envelopes(voice);
// apply volumes and add
dest[0] += get_sample(val1, voice->lvol);
dest[1] += get_sample(val1, voice->rvol);
// check for loop end
check_for_end_forward(voice, accum);
The function gets two samples of the current ROM wave to interpolates them, and then (after filters and volume) outputs the result. What i'm asking is if, in the case of a ROM wave with an odd samples count, when val1 is the last sample, val2 will get a value which is not part of the ROM wave, 'cause accum update and check_for_end_forward happens only at the end, instead of between the two read_sample calls. Or am i missing how get_integer_addr(accum, 1)) works, and this is fine as it is?
Last edited by Parduz; 05/14/23 08:30 AM.
|
|
|
|
Joined: May 2009
Posts: 2,120 Likes: 152
Very Senior Member
|
Very Senior Member
Joined: May 2009
Posts: 2,120 Likes: 152 |
It does look like it may end up grabbing one sample past the end of the current sample, so you may have hit on a bug here. That said, this sounds like the XY problem. What is the issue in particular that you're trying to solve?
|
|
|
|
Joined: May 2009
Posts: 2,120 Likes: 152
Very Senior Member
|
Very Senior Member
Joined: May 2009
Posts: 2,120 Likes: 152 |
Follow-up: There are 3 places in the ES5506 device where it looks like, as you suggest, it can end up trying to interpolate against one sample past the end of the specific voice. I have a potential fix, but I'm uncomfortable with the fix. In all likelihood, Ensoniq wouldn't have bothered taking up the silicon to have limit checks to compare against the end of a particular voice when interpolating its samples. I suspect that what looks like a bug to both you and me is probably actual hardware behavior. Developers would have been aware of this behavior and most likely would have padded the voice ROMs by one additional sample per voice in order to account for it. It's a really good catch - thanks for that, I liked having something to dig into on a lazy Sunday afternoon  - but I think you don't need to worry about it.
|
|
|
|
Joined: Dec 2022
Posts: 12
Member
|
OP
Member
Joined: Dec 2022
Posts: 12 |
What is the issue in particular that you're trying to solve? Nothing  TL:DR: i'm reverse-engineering how the ROM sounds are stored and played. Long read: I'm trying to get a decent set of samples to convert in wavetables and to be used in modern VTSs to "emulate" (and reproduce) the sounds of my loved SQ1. So i'm just messing with the code saving already interpolated wavs and looking at how the "transwaves" works by printing out the "accum" address to see what part of the sound ROM is being played. So i noticed that sometime the address goes over the voice->end, and started to look at it. I suspect that what looks like a bug to both you and me is probably actual hardware behavior. Developers would have been aware of this behavior and most likely would have padded the voice ROMs by one additional sample per voice in order to account for it. I'm not so sure; this image shows the waveform (directly from ROM data): ![[Linked Image from i.imgur.com]](https://i.imgur.com/9707Rh7.png) that "spike" is between two different "waves", and it is present between almost all of them. I think that it is not planned to be read and played. I have a potential fix, but I'm uncomfortable with the fix. In all likelihood, Ensoniq wouldn't have bothered taking up the silicon to have limit checks to compare against the end of a particular voice when interpolating its samples. I would like to see it, if you're willing to share it. I'll try it in the intimacy of my PC along with all the mess (pun unintended  ) i'm doing to get my print and samples 
|
|
|
|
Joined: Mar 2002
Posts: 1,336 Likes: 89
Very Senior Member
|
Very Senior Member
Joined: Mar 2002
Posts: 1,336 Likes: 89 |
The technical manual has this to say about it when the accumulator address equals loop end: "If this occurs, on the next sample OTTO will fetch the data at locations Loop End and Loop End +1. This possibility requires that the Loop End +1 data be set equal to the Loop Start data."
|
1 member likes this:
Parduz |
|
|
|
Joined: Dec 2022
Posts: 12
Member
|
OP
Member
Joined: Dec 2022
Posts: 12 |
The technical manual has this to say about it when the accumulator address equals loop end: "If this occurs, on the next sample OTTO will fetch the data at locations Loop End and Loop End +1. This possibility requires that the Loop End +1 data be set equal to the Loop Start data." Ohh, this is interesting. DO i break some rule if i ask where could i read that manual? Thanks, i'll do it ASAP... but i want to look closer to what hap has posted.
Last edited by Parduz; 05/14/23 02:39 PM.
|
|
|
|
Joined: Mar 2002
Posts: 1,336 Likes: 89
Very Senior Member
|
Very Senior Member
Joined: Mar 2002
Posts: 1,336 Likes: 89 |
Ok, google for "es5506.pdf", it's the first link.
|
|
|
|
Joined: Mar 2001
Posts: 17,008 Likes: 94
Very Senior Member
|
Very Senior Member
Joined: Mar 2001
Posts: 17,008 Likes: 94 |
Yeah, so the emulation is correct then, as JD thought.
|
|
|
|
Joined: Dec 2022
Posts: 12
Member
|
OP
Member
Joined: Dec 2022
Posts: 12 |
Yeah, so the emulation is correct then, as JD thought. EDIT Ok, all loopable samples have an additional "plausible" sample (not equal, but near) after the end, so it is true (or can be considered true) also for the es5505. Thank you. Could it be true only for the es5506?
From the SQ1 (es5505) it does not seems true:
![[Linked Image from i.imgur.com]](https://i.imgur.com/SFAIwpp.png) The picture shows the end of a sample with odd sample lenght and the beginning of the next one. The first value after is not equal.
Last edited by Parduz; 05/14/23 04:43 PM.
|
|
|
3 members (Golden Child, MrBogi, 1 invisible),
41
guests, and
1
robot. |
Key:
Admin,
Global Mod,
Mod
|
|
Forums9
Topics9,189
Posts120,338
Members5,044
|
Most Online1,283 Dec 21st, 2022
|
|
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!
|
|
|
|