It is currently Tue Nov 20, 2018 10:39 pm

 All times are UTC - 7 hours

### Forum rules

• For making cartridges of your Super NES games, see Reproduction.

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
Author Message
 Posted: Sat Jun 30, 2018 11:31 am

Joined: Wed May 19, 2010 6:12 pm
Posts: 2774
Either for hand-coded BRR samples, or doing some sort of software wave generating, is there a mathematically simplified way of doing this? Take for instance a square wave, if I made the wave like this {7,3,4,4,4,4,3,7,-7,-3,-4,-4,-4,-4,-3,-7} would that be close enough?

Top

 Posted: Sat Jun 30, 2018 11:58 am

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20791
Location: NE Indiana, USA (NTSC)
That's the general idea of how to preemphasize a sample. To see whether you over- or underemphasized, you can render an SPC file to wave in an accurate SPC player and compare the output in the time domain with a ModPlug Tracker export of square wave samples with the same length and cubic resampling.

Why cubic? It has the same support width as Gaussian resampling: four sample periods. But unlike Gaussian resampling, cubic resampling uses negative weights for two of the samples, which allows it to preserve more of the high frequencies without having to bake pre-emphasis into every encoded wave.

In my tests, the square wave I've been using is this:
Code:
.byte \$B0,\$9B,\$BB,\$BB,\$BB,\$BB,\$BB,\$BB,\$B9
.byte \$B3,\$75,\$55,\$55,\$55,\$55,\$55,\$55,\$57

That corresponds to these sample values:
Code:
[
-7, -5, -5, -5, -5, -5, -5, -5,
-5, -5, -5, -5, -5, -5, -5, -7,
7, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 7
]

I haven't had a chance to do rigorous tests on this to see whether I over- or under-preemphasized though.

The ideal preemphasis to compensate for Gaussian resampling is deconvolution with the Gaussian kernel. If you're building your own BRR encoder, try approximating it by convolving the sample with [-1, 6, -1]/4 or [-1, 10, -1]/8. The first of these means you take the current sample times -1, the previous sample times 6, and the sample before that times -1, add them, and divide the sum by 4.

Top

 Posted: Sat Jun 30, 2018 2:14 pm

Joined: Wed May 19, 2010 6:12 pm
Posts: 2774
I looked at the actual spc700 gaussian table and it looks like it is roughly a (.18, .64, .18) convolution. Convoluting it with a (-.5, 2, -.5) would make it (-.09, .04, 1.1, .04, -.09) convolution, which I think is close enough for it.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 3 posts ]

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: 93143, Google Adsense [Bot], Oziphantom and 5 guests

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

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki