It is currently Tue Jan 17, 2017 2:18 pm

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: Wed Dec 28, 2016 12:31 am 
Offline

Joined: Tue Dec 29, 2015 2:42 pm
Posts: 11
Are there freely-usable sound engines for homebrew SNES projects available (something like Echo for Genesis)?


Top
 Profile  
 
PostPosted: Wed Dec 28, 2016 3:09 am 
Offline

Joined: Sun May 11, 2014 8:36 am
Posts: 77
Location: France
I am never tested but there are SnesMod and SnesGss.

I try to finish my audio driver too.


Top
 Profile  
 
PostPosted: Wed Dec 28, 2016 2:21 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 1954
Something that I find a bottleneck is the lack of BRR sample libraries.


Top
 Profile  
 
PostPosted: Wed Dec 28, 2016 5:52 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 17571
Location: NE Indiana, USA (NTSC)
There are tools to convert WAV files to BRR. What WAV sound libraries do developers of low-budget games for other platforms use?


Top
 Profile  
 
PostPosted: Wed Dec 28, 2016 6:38 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 1954
Earlier today I had the idea of a "polygon synthesizer" where the waves could be stored as straight lines of various slopes and legnths, as a way to create custom sounds without having to manipulate long BRR samples in hex. Have either the 65816 or SPC700 convert samples from the "polygon synth" format into BRR samples before a level starts.


Last edited by psycopathicteen on Thu Dec 29, 2016 4:32 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu Dec 29, 2016 4:54 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 6875
Location: Jongny, VD, Switzerland
SNES Game Sound System was released recently for exacly that purpose.

Also I'd always have loved to release mine, but for some reason didn't go through the effort yet.


Top
 Profile  
 
PostPosted: Thu Dec 29, 2016 3:47 pm 
Offline

Joined: Wed Sep 01, 2010 12:17 am
Posts: 7
psycopathicteen wrote:
Something that I find a bottleneck is the lack of BRR sample libraries.

That's one thing I've found annoying, too, even when just doing ROM hacking. And even if you can convert WAV to BRR, that assumes that you both have WAVs that would work (not too big, loopable) and that you have a way to convert them accurately.


Top
 Profile  
 
PostPosted: Thu Dec 29, 2016 4:22 pm 
Offline

Joined: Wed Jul 09, 2008 8:46 pm
Posts: 226
That's why there's always downsampling to deal with that peculiar problem. I use Schism Tracker (for editing and downsampling, particularly since the resulting length has to be divisible by 16) and the SNESMod program so that I can just simply convert them over on the fly (and have working prototypes, since these days I'm getting less and less interested SNESMod, although I still keep it since I know it has at least one critical operation that I use: making the BRR samples... then I can extract them straight out of the .spc file!).


Top
 Profile  
 
PostPosted: Thu Dec 29, 2016 6:22 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 1954
Do any games use an in-cart sound chip?


Top
 Profile  
 
PostPosted: Thu Dec 29, 2016 6:40 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 5173
Location: Seattle
The MSU-1 and the Super Game Boy. You can argue whether those count...


Top
 Profile  
 
PostPosted: Thu Dec 29, 2016 9:48 pm 
Offline
User avatar

Joined: Sun May 27, 2012 8:43 pm
Posts: 1105
A neat tool would be a FamiTracker export converter, that spits out working SPC700 code. The simple 2A03 waveforms as BRR samples wouldn't be too complicated, and some expansion audio wouldn't even be too difficult to throw in. MMC5 would basically be free, and it would not be a far cry to get VRC6 in there.


Top
 Profile  
 
PostPosted: Sat Dec 31, 2016 3:38 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 1954
I would like to see someone making a WAV to BRR code using either the 65816 or SPC700, including filter and range selecting, so it can synthesize it's own samples, and then fill up the sound RAM with everything. The problem is it would take several seconds if you're going to fill up 64kB of RAM.


Top
 Profile  
 
PostPosted: Mon Jan 02, 2017 3:28 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 1954
Here is some spc700 code I've been working on that could generate BRR samples for simple wave shapes stored as line segment data. It computes an 8-bit PCM wave, and then truncates it to 4-bit BRR. Line segments are allowed to wrap when passing 255 or 0.

Quote:
generate_brr_sample_library:
ldx #$00
-;
ldy #$00
lda ({source}),y
beq +
phx
jsr polygon_synth
plx
lda {brr_buffer}
sta {directory},x
sta {directory}+2,x
lda {brr_buffer}+1
sta {directory}+1,x
sta {directory}+3,x
inx
inx
inx
inx
tya
ldy #$00
adw {brr_buffer}
stw {brr_buffer}
bra -
+;
rts

polygon_synth:
ldx #$00
ldy #$00
str {temp}=#$00
lda ({source}),y
sta {countdown}
iny
lda ({source}),y
sta {header_byte}

-;
iny
lda ({source}),y
sta {temp2}
lda {temp}
iny
-;
clc
adc ({source}),y
sta {wave_buffer},x
inx
dec {temp2}
bne -
sta {temp}
dec {countdown}
bne --
txa
xcn
and #$0f
sta {#_of_blocks}

iny

tya
ldy #$00
adw {source}
stw {source}

jsr convert_wav_to_brr
rts


convert_wav_to_brr:
ldx #$00
ldy #$00
-;
lda {header_byte}
cmp {#_of_blocks}=#$01
bne +
inc
+;
sta ({brr_buffer}),y
str {temp2}=#$08
-;
lda {wave_buffer},x
and #$f0
sta {temp}
inx
lda {wave_buffer},x
and #$f0
xcn
ora {temp}
inx
iny
sta ({brr_buffer}),y
dec {temp2}
bne -
iny
dec {#_of_blocks}
bne --

rts


...and for the format:

Code:
byte 0: number of line segments in wave shape (0 means no more BRR samples)
byte 1: BRR header byte

repeats for "byte 0" amount of times
byte 2n+2: length in samples of line segment
byte 2n+3: 8-bit slope

Then it repeats for the next BRR sample until "byte 0" is 0.

Waves that are not divisible by 16, get clipped to the nearest multiple of 16.


Some examples:

Code:
square_wave:
db $04,$92                             //4 line segments, with BRR header of $92
db $01,$7f                              //first line, 1 sample long, with slope of 127
db $1f,$00                              //second line, 31 samples long, with no slope
db $01,$01                             //third line, 1 sample long, slope is 1 but wraps around to -128
db $1f,$00                              //forth line, 31 samples long, with no slope

saw_wave:
db $01,$92                             //only 1 line segment needed, with BRR header of $92
db $40,$04                             //64 samples long with a slope of 4, wraps around


Top
 Profile  
 
PostPosted: Thu Jan 05, 2017 9:49 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 6875
Location: Jongny, VD, Switzerland
psycopathicteen wrote:
Something that I find a bottleneck is the lack of BRR sample libraries.

Such a library could be rather easy to make by taking a General MIDI sample set and turning all of them into BRR... although the quality to use is always a space/quality tradeoff we cannot take in advance without knowing the application.

Quote:
that assumes that you both have WAVs that would work (not too big, loopable)

You're supposed to record them from your syntesizer. All WAVs are loopable, whether the loop actually sounds good however is a different debate.

You can also synthesise simple wavform in BRR directly, such as square vave, saw wave, etc...

Quote:
I would like to see someone making a WAV to BRR code using either the 65816 or SPC700

And what'd be the point exactly ?! It'd be the same trouble to find WAV files, *and* it would take more memory. The only point I see is that the 65C816 (or the SPC700) could automatically adjust the sample's quality depending on the song which is playing, so that it uses memory most efficiently at all times. Yet such a system would still be incredibly complex for small benefits (i.e. better sound quality for music pieces using few different samples), it sounds better to do this work manually on a case-by-case basis.

Quote:
Earlier today I had the idea of a "polygon synthesizer" where the waves could be stored as straight lines of various slopes and legnths, as a way to create custom sounds without having to manipulate long BRR samples in hex

Very interesting idea ! Especially if you can move the "polygon" during playback to create effects. Chrono Trigger does something like that but it just changes a pulse wave's duty cycle permanently.


Top
 Profile  
 
PostPosted: Thu Jan 05, 2017 3:18 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 1954
Bregalad wrote:
Quote:
I would like to see someone making a WAV to BRR code using either the 65816 or SPC700

And what'd be the point exactly ?! It'd be the same trouble to find WAV files, *and* it would take more memory. The only point I see is that the 65C816 (or the SPC700) could automatically adjust the sample's quality depending on the song which is playing, so that it uses memory most efficiently at all times. Yet such a system would still be incredibly complex for small benefits (i.e. better sound quality for music pieces using few different samples), it sounds better to do this work manually on a case-by-case basis.


If you're doing polygon synth, you can doing the easy way and just generate 4-bit PCM samples (BRR filter is always 0), or do it the more CPU intensive way of figuring out which filter/range settting is best for which BRR block.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 11 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