Nuked-SC55 icon indicating copy to clipboard operation
Nuked-SC55 copied to clipboard

Cracked sound generated when modulation enabled at high frequency

Open mckuhei opened this issue 1 year ago • 9 comments

https://github.com/user-attachments/assets/9b397b33-b5a7-4327-8e7e-dd3660340584

Test midi: Crackedsound.zip

mckuhei avatar Oct 20 '24 00:10 mckuhei

Possibly caused by out of range values in pcm multi, but not sure what the fix would be. https://github.com/nukeykt/Nuked-SC55/blob/205ff94eca4ae1f7f7e16de882dc72a251f71c98/src/pcm.cpp#L288-L301

EDIT: Can someone test this midi on real hardware and report what happens?

jcmoyer avatar Oct 20 '24 17:10 jcmoyer

Gui got more development?

PurpBatBoi avatar Oct 23 '24 04:10 PurpBatBoi

No, this is my own branch.

mckuhei avatar Oct 23 '24 05:10 mckuhei

Possibly caused by out of range values in pcm multi, but not sure what the fix would be.

https://github.com/nukeykt/Nuked-SC55/blob/205ff94eca4ae1f7f7e16de882dc72a251f71c98/src/pcm.cpp#L288-L301

EDIT: Can someone test this midi on real hardware and report what happens?

I tested this out on my SC-88Pro and SC-55mkII, both do not produce this cracked sound. Tested it on the Nuked SC-55 running SC-55mkII roms, produces this cracked sound So it seems this is a Nuked SC-55 issue.

linoshkmalayil avatar Oct 23 '24 07:10 linoshkmalayil

Seems to fix the problem for mk2:

diff --git a/src/pcm.cpp b/src/pcm.cpp
index 0cd1c29..b048fb0 100644
--- a/src/pcm.cpp
+++ b/src/pcm.cpp
@@ -1410,7 +1410,9 @@ void PCM_Update(uint64_t cycles)
                 int v1 = v2 + (mult2 >> 13) + ((mult2 >> 12) & 1); // 10
                 int subvar = v1 + (mult3 >> 6) + ((mult3 >> 5) & 1); // 11

-                ram1[3] = v1;
+#define Clamp(v, x0, x1) (v < x0 ? x0 : v > x1 ? x1 : v)
+
+                ram1[3] = Clamp(v1, -0x80000, 0x7ffff);

                 int tests = test;
                 tests <<= 12;
@@ -1423,7 +1425,7 @@ void PCM_Update(uint64_t cycles)
                 int v4 = reg1 + (mult4 >> 6) + ((mult4 >> 5) & 1); // 14
                 int v5 = v4 + (mult5 >> 13) + ((mult5 >> 12) & 1); // 15

-                ram1[1] = v5;
+                ram1[1] = Clamp(v5, -0x80000, 0x7ffff);
             }

Here's an audio comparison before/after: CrackleFixRenders.zip

The crackling version seems to have a lot more noise overall but I think it's just reverb from the crackling. If you invert one of the tracks and play them simultaneously the only thing left is the crackling.

jcmoyer avatar Oct 23 '24 22:10 jcmoyer

Kind of offtopic question: where did you get the version with GUI?

Grieferus avatar Oct 25 '24 18:10 Grieferus

He said it was his own branch.

MusicallyInspired avatar Oct 25 '24 19:10 MusicallyInspired

Gui is in my fork and can be downloaded here: https://github.com/mckuhei/Nuked-SC55/releases/tag/gui-v1.0

mckuhei avatar Oct 26 '24 11:10 mckuhei

Seems to fix the problem for mk2:

diff --git a/src/pcm.cpp b/src/pcm.cpp
index 0cd1c29..b048fb0 100644
--- a/src/pcm.cpp
+++ b/src/pcm.cpp
@@ -1410,7 +1410,9 @@ void PCM_Update(uint64_t cycles)
                 int v1 = v2 + (mult2 >> 13) + ((mult2 >> 12) & 1); // 10
                 int subvar = v1 + (mult3 >> 6) + ((mult3 >> 5) & 1); // 11

-                ram1[3] = v1;
+#define Clamp(v, x0, x1) (v < x0 ? x0 : v > x1 ? x1 : v)
+
+                ram1[3] = Clamp(v1, -0x80000, 0x7ffff);

                 int tests = test;
                 tests <<= 12;
@@ -1423,7 +1425,7 @@ void PCM_Update(uint64_t cycles)
                 int v4 = reg1 + (mult4 >> 6) + ((mult4 >> 5) & 1); // 14
                 int v5 = v4 + (mult5 >> 13) + ((mult5 >> 12) & 1); // 15

-                ram1[1] = v5;
+                ram1[1] = Clamp(v5, -0x80000, 0x7ffff);
             }

Here's an audio comparison before/after: CrackleFixRenders.zip

The crackling version seems to have a lot more noise overall but I think it's just reverb from the crackling. If you invert one of the tracks and play them simultaneously the only thing left is the crackling.

I'd propose merging this with master branch, no matter how specific this bug might be.

Grieferus avatar Nov 13 '24 15:11 Grieferus