I never made it. It never got farther than a quick experiment playing around in a tracker, unlike my cover of SMB2 underground. This is actually from a tracker, and the pitches aren't exact, though the waveforms are.rainwarrior wrote:Also, Tepples, I'd be interested in hearing that GB Wish cover, if you have a link.

## DPCM playback rate does really correlate with note freqs

**Moderator:** Moderators

- rainwarrior
**Posts:**8001**Joined:**Sun Jan 22, 2012 12:03 pm**Location:**Canada-
**Contact:**

I was building a table of the PAL frequencies for the wiki DMC page and I noticed this also fits the same pattern of picking the same set of notes and their closest match to A440, with two glaring exceptions. (The following table lists potential closest matches to A440 among available pitches.)

Did they really get it wrong like this when building the 2A07, or is the information on the wiki incorrect? If I had a PAL NES to test I'd verify it myself, but as I can't, can anyone else verify it for me?

Code: Select all

```
DMC Octave Note Cents
-----------------------------------
0x032 12 C -12.2401718 ******
0x034 11 B +19.8595941
0x038 11 A# -8.43865057
0x03C 11 A -27.8814588
0x03E 11 G# +15.3516834
0x042 11 G +7.11431267 ******
0x046 11 F# +5.24763556
0x04A 11 F +9.04321714
0x04E 11 E +17.9045932 ******
0x054 11 D# -10.3936514
0x058 11 D +9.06931353
0x05E 11 C# -5.11936612
0x062 11 C +22.7354429 <- ???
0x064 11 C -12.2401718 <- Why not this?
0x06A 10 B -13.1172895
0x070 10 A# -8.43865057
0x076 10 A +1.21559666 ******
0x07E 10 G# -12.3486523
0x084 10 G +7.11431267 ******
0x08C 10 F# +5.24763556
0x094 10 F +9.04321714 ******
0x09E 10 E -4.14964192
0x0A6 10 D# +10.3399382
0x0B0 10 D +9.06931353 ******
0x0BC 10 C# -5.11936612
0x0C6 10 C +5.15931180 ******
0x0D2 9 B +3.29263470 ******
0x0DE 9 A# +7.08821628
0x0EC 9 A +1.21559666 ******
0x0FA 9 G# +1.44611430
0x10A 9 G -5.95166671 <- Why not this?
0x114 9 F# +30.1579077 <- ???
0x118 9 F# +5.24763556
0x12A 9 F -2.61496866 ******
0x13C 9 E -4.14964192 ******
0x14E 9 D# -0.05789507
0x162 9 D -0.73940420 ******
0x176 9 C# +4.11390403
0x18E 9 C -3.56228876 ******
```

- rainwarrior
**Posts:**8001**Joined:**Sun Jan 22, 2012 12:03 pm**Location:**Canada-
**Contact:**

Made this quickly in FamiTracker:

dpcm_pitch_test.nsf (dropbox link removed, file lost)

It's just a 17-byte looped triangleish bass. An audio recording of this from a PAL NES should be enough to measure the wavelength to determine the correct values.

dpcm_pitch_test.nsf (dropbox link removed, file lost)

It's just a 17-byte looped triangleish bass. An audio recording of this from a PAL NES should be enough to measure the wavelength to determine the correct values.

Last edited by rainwarrior on Tue Oct 06, 2020 5:53 pm, edited 2 times in total.

*x*in a finite field. Probably the most accessible description of how multiplication works in a finite field, the one I read when first trying to understand how Reed-Solomon error correction works, is "Finite field arithmetic" on Wikipedia. It's not graduate math, but it might be undergraduate math. And if you do anything with RS codes, you'll have to wrap your head around it sooner rather than later.

An 8-bit LFSR operates in the finite field GF(256). (Here, I use "integer" for an ordinary whole number and "bit pattern" for an element of a finite field.) What you're looking for is the number that when multiplied by 00000010

*n*times results in 00000001, so because 00000010 to the 255th power is 00000001, you'll want to take 00000010 to the power of (255 -

*n*).

Please let me know which sentence in this post was the first sentence that you failed to understand.

There are ways of calculating the powers of 00000010. One is to build a lookup table from integers

*n*to bit patterns 00000010^

*n*. Building this table requires O(n) multiplications, but the resulting "log table" can be reused at O(1) each for multiple entries, such as the 32 entries in the length counter LUT or the 16 entries in the noise or DMC period LUT. The RS module in a typical QR barcode library generally uses this method for GF(256). The other, which is faster but may be hard to understand for people who don't know finite fields well, is exponentiation by squaring. This requires only O(log n) multiplications per table entry that's actually used.

Under what conditions is (00000010 ≅ x)²⁵⁵ ≡ 1 mod 256? 256 isn't prime, and I don't see a reducing polynomial mentioned. If we need to find such a polynomial, how do we find both the reducing polynomial and the seed at the same time? If we don't, what's going on?tepples wrote:What you're looking for is the number that when multiplied by 00000010ntimes results in 00000001, so because 00000010 to the 255th power is 00000001, you'll want to take 00000010 to the power of (255 -n).

Am I mistaken in thinking that there is only one set of taps (the reducing polynomial) and the LFSR just loaded in a seed and then was clocked N times?There are ways of calculating the powers of 00000010. One is to build a lookup table from integersnto bit patterns 00000010^n. Building this table requires O(n) multiplications, but the resulting "log table" can be reused at O(1) each for multiple entries, such as the 32 entries in the length counter LUT or the 16 entries in the noise or DMC period LUT.

Under any reducing polynomial with x^8 as the highest order term.lidnariq wrote:Under what conditions is (00000010 ≅ x)²⁵⁵ ≡ 1 mod 256?

The taps determine the reducing polynomial.If we need to find such a polynomial

There exist more than one primitive reducing polynomial for each field size, and some field sizes need more than two taps. That is, there exist more than one valid set of taps for each LFSR length. One can find tables of such polynomials for each order. But even though (say) QR and DataMatrix use different polynomials, people speak of "the" GF(256), or "the" finite field with 256 elements, because there's an isomorphism between any two fields of the same order with different polynomials.Am I mistaken in thinking that there is only one set of taps (the reducing polynomial) and the LFSR just loaded in a seed and then was clocked N times?

Sorry, what I meant was, "In the silicon, is each LUT one specific seed and one specific set of taps and entry N is contents of the LFSR when clocked N times?" You explained how to find the seed given the taps; is there an method for finding the taps?tepples wrote:There exist more than one primitive reducing polynomial for each field size, and some field sizes need more than two taps. That is, there exist more than one valid set of taps for each LFSR length. One can find tables of such polynomials for each order. But even though (say) QR and DataMatrix use different polynomials, people speak of "the" GF(256), or "the" finite field with 256 elements, because there's an isomorphism between any two fields of the same order with different polynomials.Am I mistaken in thinking that there is only one set of taps (the reducing polynomial) and the LFSR just loaded in a seed and then was clocked N times?

In the silicon, there is only one set of taps, used for all LUT entries. Each entry is 00000010^(INT_MAX - n).lidnariq wrote:In the silicon, is each LUT one specific seed and one specific set of taps and entry N is contents of the LFSR when clocked N times?

The taps depend on the length of the LFSR. A table of taps for each length can be found in any book on finite field theory, and there are online tools to find them. For most lengths, two or four taps are used. For example, the polynomial x^8 + x^4 + x^3 + x^2 + 1 is primitive, and it leads to an 8-bit 4-tap LFSR. That polynomial corresponds to the entry 1 0 0 0 1 1 1 0 1 when you tell the tool to generate "Primitive polynomials over GF(2), n = 8".You explained how to find the seed given the taps; is there an method for finding the taps?

- Jarhmander
- Formerly ~J-@D!~
**Posts:**521**Joined:**Sun Mar 12, 2006 12:36 am**Location:**Rive nord de Montréal

Sorry for the bump. Got back to a question from bucky o'hare.

Well, why did they choose these notes? Well, C-D-E-F-G-A-B-C (speed 0-8) is the major C scale, and C-E-G-C is a major C chord (speed 12-15), but what about C-D-F-G-A-C (speed 8-12) ?

First thing to note is that it's a kind of a scale, the

More interesting aspect however, is that C-D-F-G-A-C is actually the Slendro scale used in some oriental music (indonesian gamelan music). That might be why these notes were used.

EDIT: removed a non-intentional smiley.

Well, why did they choose these notes? Well, C-D-E-F-G-A-B-C (speed 0-8) is the major C scale, and C-E-G-C is a major C chord (speed 12-15), but what about C-D-F-G-A-C (speed 8-12) ?

First thing to note is that it's a kind of a scale, the

**pentatonic**scale (F pentatonic scale to be more precise). The special thing about it is that it doesn't have any semitones or tritones, so it always sounds good. I noticed that the church's bells are C-D-F-G-A-C at the one near my girlfriend's parents, and it's never dissonant.More interesting aspect however, is that C-D-F-G-A-C is actually the Slendro scale used in some oriental music (indonesian gamelan music). That might be why these notes were used.

EDIT: removed a non-intentional smiley.

- rainwarrior
**Posts:**8001**Joined:**Sun Jan 22, 2012 12:03 pm**Location:**Canada-
**Contact:**

Yeah, they could have been going for a pentatonic scale, maybe, though I don't know why they'd pick that particular version of it.

I don't think Slendro is a reasonable candidate, though. Its tuning is very different from 12-TET, and we've already determined that the DPCM frequencies are all tuned to A-440 12-TET. It only looks like the pentatonic scale when you approximate it in 12-TET.

I don't think Slendro is a reasonable candidate, though. Its tuning is very different from 12-TET, and we've already determined that the DPCM frequencies are all tuned to A-440 12-TET. It only looks like the pentatonic scale when you approximate it in 12-TET.

- rainwarrior
**Posts:**8001**Joined:**Sun Jan 22, 2012 12:03 pm**Location:**Canada-
**Contact:**

I was finally able to verify the PAL DPCM frequencies from a recording jrlepage made for me with this PAL NES. The table on the wiki is correct, which means those two frequencies which don't match the tuning scheme are actually that way in the hardware. So, I guess they made a mistake when building the 2A07, which is quite interesting.