It is currently Tue Oct 16, 2018 10:16 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: New VRC7 patch set
PostPosted: Wed Aug 01, 2012 12:43 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6876
Location: Canada
Edit: this patch set and test has been updated, see the post below.


I've spent some time over the last several days going over the VRC7 patch set with the CopyNES VRC7 tuner. This is about as close as I can get; some patches appear to be exact, but many have very minute differences which I could not reconcile. Also, there are many factors which make an exact match very hard; vibrato/tremolo don't synch with the note, so patches which use them are a bit variable, and there are some other random factors which seem to affect the onset of the note that I don't understand, but again they make some patches sound slightly different each time (just in the onset of the tone though).

This is an incremental improvement on the patch set quietust posted a few years ago. This would have taken a lot more time if it weren't for the prior work of kevtris and quietust, especially on the VRC7 tuner tool.

Code:
rainwarrior's VRC7 patches:

00 00 00 00 00 00 00 00
03 21 05 06 B8 82 42 27
13 41 13 0D D8 D6 23 12
31 11 08 08 FA 9A 22 02
31 61 18 07 78 64 30 27
22 21 1E 06 F0 76 08 28
02 01 06 00 F0 F2 03 F5
21 61 1D 07 82 81 16 07
23 21 1A 17 CF 72 25 17
15 11 25 00 4F 71 00 11
85 01 12 0F 99 A2 40 02
07 C1 69 07 F3 F5 A7 12
71 23 0D 06 66 75 23 16
01 02 D3 05 A3 92 F7 52
61 63 0C 00 94 AF 34 06
21 62 0D 00 B1 A0 54 17


The USB CopyNES host I used is available here:
https://github.com/bbbradsmith/usbcopynesblue

There are some minor source code changes to the VRC7 tuner tool; the modulator volume range is fixed (only went to 32 instead of 64), and saving files is fixed, as well as adding keyboard shortcuts Q/W/E to play the tones. I haven't uploaded a build with the fixed tool, but the source code fixes are in at that repository.


Edit: attached source code an NES/NSF for the test. (Edit: I have since made a better test, however.)


Attachments:
File comment: ca65 source code, NES ROM and NSF of VRC7 path test.
vrc7_patch_test.zip [5.94 KiB]
Downloaded 192 times


Last edited by rainwarrior on Sun Sep 02, 2018 11:48 am, edited 6 times in total.
Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 01, 2012 2:34 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6876
Location: Canada
For anyone who is curious what the differences are, here's the changes in my new set, vs quietust's old one:

quietust.vrc7 > rainwarrior.vrc7:

patch 1:
Modulator output: 4 > 5
Modulator attack: 8 > 11
Modulator decay: 13 > 8
Carrier attack: 15 > 8
Carrier sustain: 1 > 2

patch 2:
Modulator output: 5 > 19
Feedback: 6 > 5
Modulator attack: 9 > 13
Modulator decay: 9 > 8
Carrier attack: 9 > 13
Modulator sustain: 6 > 2

patch 3:
Modulator output: 16 > 8
Feedback: 2 > 0
Modulator decay: 0 > 10
Carrier decay: 12 > 10
Modulator sustain: 3 > 2

patch 4:
Modulator rate scaling: 0 > 1
Modulator output: 29 > 24
Modulator attack: 9 > 7
Modulator decay: 15 > 8
Modulator sustain: 2 > 3

patch 6:
Carrier sustain: 9 > 15

patch 7:
Modulator output: 28 > 29

patch 8:
Modulator attack: 14 > 12
Carrier attack: 8 > 7
Carrier release: 5 > 7

patch 9:
Modulator sustain: 1 > 0
Modulator rate scaling: 0 > 1
Modulator output: 31 > 37
Modulator attack: 8 > 4
Modulator decay: 6 > 15
Carrier attack: 4 > 7
Modulator sustain: 2 > 0

patch 10:
Modulator output: 31 > 18
Modulator attack: 14 > 9
Modulator decay: 4 > 9
Modulator sustain: 1 > 4
Modulator release: 1 > 0
Carrier sustain: 1 > 0

patch 11:
Modulator level scale: 0 > 1
Modulator output: 43 > 41
Carrier level scale: 1 > 0
Feedback: 5 > 7
Modulator attack: 11 > 15
Modulator decay: 4 > 3
Carrier decay: 1 > 5
Modulator sustain: 2 > 10
Modulator release: 4 > 7
Carrier sustain: 15 > 1
Carrier release: 4 > 2

patch 12:
Modulator rate scaling: 0 > 1
Modulator output: 17 > 13
Modulator attack: 9 > 6
Carrier attack: 9 > 7
Carrier decay: 6 > 5
Modulator sustain: 1 > 2

patch 13:
Modulator attack: 8 > 10
Modulator decay: 2 > 3
Carrier attack: 10 > 9
Modulator sustain: 3 > 15
Modulator release: 1 > 7
Carrier release: 1 > 2

patch 14:
Carrier vibrato: 0 > 1
Carrier multiplier: 2 > 3
Modulator output: 13 > 12
Feedback: 2 > 0
Modulator attack: 12 > 9
Modulator decay: 3 > 4
Carrier attack: 7 > 10
Modulator sustain: 2 > 3
Carrier release: 5 > 6

patch 15:
Modulator output: 14 > 13
Modulator attack: 10 > 11
Modulator sustain: 4 > 5


Last edited by rainwarrior on Sun Sep 02, 2018 11:47 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 01, 2012 8:45 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1849
I haven't compared side-by-side with actual recordings yet... but it sounds great to me at first listen!

Nice work. :)


Top
 Profile  
 
 Post subject: Re: New VRC7 patch set
PostPosted: Sun Nov 13, 2016 10:29 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6876
Location: Canada
Just realized I never published the ROM/NSF of the test, or its source code. Added to OP.


Top
 Profile  
 
 Post subject: Re: New VRC7 patch set
PostPosted: Wed Oct 18, 2017 12:29 am 
Offline

Joined: Sat Jun 01, 2013 11:55 am
Posts: 30
Location: Maine, U.S.A.
I found a few sustain, decay and release values are slightly off according to the waveforms in the patch test recording (internal patch first, approximated second). The set is very close, of course— I found only three instances one point off.

It was in the process of updating my emulator that I made the following adjustments to achieve close results to the h/w recording:

Patch #1:
Carrier decay 2 > 1
Carrier sustain 2 > 3
$"03 21 05 06 B8 81 42 37"

Patch #14:
Carrier release 6 > 7
$"61 63 0C 00 94 AF 34 07"

Patch #15:
Carrier release 7 > 8
$"21 62 0D 00 B1 A0 54 18"

(Also: thanks for your work, rainwarrior.)


Top
 Profile  
 
 Post subject: Re: New VRC7 patch set
PostPosted: Sat Sep 01, 2018 4:35 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6876
Location: Canada
Sorry it took me a year to find the time to review this.

On patch 1 and 15 I think both of these are closer to the original. (I suspect we could even bump up that patch 15 release one more notch, will check soon.)

Patch 14 looks like a regression to me. The release is now too short. You should check too, yourself, but take a look at the image below, showing my patch #14 at the top right, yours at the bottom, built-in on left.

This is from a recording of the patch_vrc7 test from: https://github.com/bbbradsmith/nes-audio-tests

(This is a slight improvement over my old patch set test, as the timing is now cycle-counted rather than polling the PPU, so different recordings can still be very precisely synchronized now.)


Attachments:
patch14_envelope_rainwarrior_vs_ap9.png
patch14_envelope_rainwarrior_vs_ap9.png [ 9.02 KiB | Viewed 1338 times ]


Last edited by rainwarrior on Sun Sep 02, 2018 12:24 pm, edited 1 time in total.
Top
 Profile  
 
 Post subject: Re: New VRC7 patch set
PostPosted: Sat Sep 01, 2018 6:53 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6876
Location: Canada
Did some more investigation in the VRC7 tuner. I forgot how much of a pain the LFO is, since it's free-run and not synched with anything you have to test the sounds over and over.

Looking more closely at ap9's changes:
  • Patch 1 carrier decay: Yes, this is a good change.
  • Patch 1 carrier sustain: No, keep at 2. 3 goes too quiet. This instrument has a long decay so it takes several seconds to hit sustain, but once it does it's clearly 2 and not 3.
  • Patch 14 carrier release: No, keep at 6. 7 is too fast.
  • Patch 15 carrier release: Revised. This was a step in the right direction, some of the releases were too long, but looking at it again I think the missing ingredient was carrier key rate scaling. With KRS and carrier release of 6, I think the release is now correct.

I also adjusted the modulator decay of patch 12 (should be slightly faster), and modulator attack of patch 15 (also slightly faster).

Having the opportunity to go over these again but with a lot less difference between the current state and the goal was a big help here. Those LFO instruments were wearing me out when I worked on this 6 years ago, and I think I was able to approach them a lot more carefully with this more refined problem to deal with. Ap9's adjustment to patch 15 really helped me see what was missing there, could never get the opening of the attack right across all octaves before, but with KRS it seems to match very well now. (I actually don't really have any glaring problems in this set after going over it... it feels extremely close now in a way that it didn't last time.)

Here's my new changes vs my previous set above and ap9's:

Patch 1
Carrier decay: 2 > 1 (agree with ap9)
Carrier sustain: 2 (stays)
03 21 05 06 B8 81 42 27

Patch 12
Modulator decay: 6 > 7
71 23 0D 06 67 75 23 16

Patch 14
Carrier release: 6 (stays, 7 is too fast)
61 63 0C 00 94 AF 34 06

Patch 15
Carrier KRS: off > on
Modulator attack: B > C
Carrier release: 7 > 6
21 72 0D 00 C1 A0 54 16


As always, would love any verification I could get on this, but I do know how few people have the necessary tools to really go into it (it even took me a year to get around to this one). The hotswap test I linked in my last post is a useful survey of the set, but it only does 3 octaves, with release on 1 them (just as a test of release). To really verify you need to use something like the CopyNES VRC7 tuner and try out lots of octaves, etc. Like the Patch 1 sustain wasn't something that that test could catch because the notes aren't long enough for that decay length. Well, maybe someday someone will finish staining that decap and we can know for sure. :S

Edit: I downloaded the demo of plgDavid's program, which actually has a set of VRC7 patches of its own stored in some text files. Surprisingly there's a lot of differences from all the patch sets I have archived from over the years. I guess this is a completely independent reverse engineering. Despite there being a lot of bits that are different, these patches also sound pretty close. (Though there's probably a lot of stuff that don't make a difference to the sound...)


Top
 Profile  
 
 Post subject: Re: New VRC7 patch set
PostPosted: Sun Sep 02, 2018 5:00 am 
Offline

Joined: Tue Aug 07, 2012 11:01 am
Posts: 16
rainwarrior wrote:
Edit: I downloaded the demo of plgDavid's program, which actually has a set of VRC7 patches of its own stored in some text files. Surprisingly there's a lot of differences from all the patch sets I have archived from over the years. I guess this is a completely independent reverse engineering. Despite there being a lot of bits that are different, these patches also sound pretty close. (Though there's probably a lot of stuff that don't make a difference to the sound...)


I suspect we will never get them 100% short of a more aggressive pass on the chip die (doable but very tricky apparently to delayer the protected section)
Especially exact EG settings of the modulator, which is the trickiest to fix imho (the exact EG settings of the carrier can be found really just with counting samples)
Yes our set was gathered from scratch using waveform comparison, spectrum comparison and rapid toggling between instrument 0 and x (listening for glitches or anything not smooth)

Here it is the block of code from our app (was also published in my video), and yes they are also in separate preset xml files in the synth:

// May 15th 2015 Hubert Lamontagne & David Viens
const uint8_t ROM_VRC7[OPLL_INST_MAX][OPLL_INST_SIZE]={
OPLL_USER_INIT_PATCH,
{0x03, 0x21, 0x05, 0x06, 0xC8, 0x81, 0x42, 0x27}, // Buzzy Bell
{0x13, 0x41, 0x14, 0x0D, 0xF8, 0xF7, 0x23, 0x12}, // Guitar
{0x31, 0x11, 0x08, 0x08, 0xFA, 0xC2, 0x28, 0x22}, // Wurly
{0x31, 0x61, 0x0C, 0x07, 0xF8, 0x64, 0x60, 0x27}, // Flute
{0x22, 0x21, 0x1E, 0x06, 0xFF, 0x76, 0x00, 0x28}, // Clarinet
{0x02, 0x01, 0x05, 0x00, 0xAC, 0xF2, 0x03, 0x02}, // Synth
{0x21, 0x61, 0x1D, 0x07, 0x82, 0x8F, 0x10, 0x07}, // Trumpet
{0x23, 0x21, 0x22, 0x17, 0xFF, 0x73, 0x00, 0x17}, // Organ
{0x15, 0x11, 0x25, 0x00, 0x41, 0x71, 0x00, 0xF1}, // Bells
{0x95, 0x01, 0x10, 0x0F, 0xB8, 0xAA, 0x50, 0x02}, // Vibes
{0x17, 0xC1, 0x5E, 0x07, 0xFA, 0xF8, 0x22, 0x12}, // Vibraphone
{0x71, 0x23, 0x11, 0x06, 0x65, 0x74, 0x10, 0x16}, // Tutti
{0x01, 0x02, 0xD3, 0x05, 0xF3, 0x92, 0x83, 0xF2}, // Fretless
{0x61, 0x63, 0x0C, 0x00, 0xA4, 0xFF, 0x30, 0x06}, // Synth Bass
{0x21, 0x62, 0x0D, 0x00, 0xA1, 0xFF, 0x50, 0x08} // Sweep
};


Top
 Profile  
 
 Post subject: Re: New VRC7 patch set
PostPosted: Sun Sep 02, 2018 11:51 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6876
Location: Canada
Ah, thanks for posting that set here. I wasn't sure whether it was OK to share that. Here's the differences between your set (left) and the one I posted yesterday (right):

Code:
Patch 1
12 11 M attack

Patch 2
20 19 M output
15 13 M attack
15 13 C attack
 7  6 C decay

Patch 3
12  9 C attack
 2 10 C decay
 8  2 M release
 2  0 C sustain

Patch 4
12 24 M output
15  7 M attack
 6  3 M sustain

Patch 5
15  0 M decay
 0  8 M release

Patch 6
 5  6 M output
10 15 M attack
12  0 M decay
 0 15 C sustain
 2  5 C release

Patch 7
15  1 C decay
 0  6 M release

Patch 8
34 26 M output
15 12 M attack
 3  2 C decay
 0  2 M sustain
 0  5 M release

Patch 9
 1 15 M decay
15  1 C sustain

Patch 10
 1  0 M key rate scale
16 18 M output
11  9 M attack
 8  9 M decay
10  2 C decay
 5  4 M sustain

Patch 11
 1  0 M key rate scale
30 41 M output
10  3 M decay
 8  5 C decay
 2 10 M sustain
 2  7 M release

Patch 12
17 13 M output
 5  7 M decay
 4  5 C decay
 1  2 M sustain
 0  3 M release

Patch 13
15 10 M attack
 8 15 M sustain
 3  7 M release
15  5 C sustain

Patch 14
10  9 M attack
15 10 C attack
 0  4 M release

Patch 15
 0  1 C key rate scale
10 12 M attack
15 10 C attack
15  0 C decay
 0  4 M release
 0  1 C sustain
 8  6 C release


I'll take a closer look at how these differ later.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group