Users browsing this thread: 1 Guest(s)
How do you calculate BRR sample rates?

#1
Posts: 127
Threads: 8
Thanks Received: 21
Thanks Given: 12
Joined: Jan 2012
Reputation: 13
Status
None
Does anyone know how you calculate the sample rate for BRR instruments? Huh

  Find
Quote  

#2
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
I asked myself the same question a while back but I haven't found anything about that. I'm guessing most samples from SNES games must be between 8000Hz and 16000Hz but maybe sometimes up to 32000Hz. I'm setting my WAV samples at 16000Hz when I convert them to BRR.

Maybe SPC tools could give you that answer if you ripp samples from SNES games: http://snesmusic.org/files/readme.html
  Find
Quote  

#3
Posts: 127
Threads: 8
Thanks Received: 21
Thanks Given: 12
Joined: Jan 2012
Reputation: 13
Status
None
Thanks for the link, interesting tool.

16000hz is good for a lot of instruments.

Currently I have the formula: 74.437869822 * wave_rate (first byte) = sample_rate (hz)

The first byte of each 2 bytes in the "Wave Rate Multiplying Data for Samples" holds the sample rate/wave rate information for each instrument.

The formula is slightly off though, so it would be best to figure out where the routine for this byte is located.

The "wave rate" data is loaded to the SPC through $2142 at C5/049F -- http://slickproductions.org/docs/FF6/Ban...sembly.txt

Now the "wave rate" should be loaded to the SPC with "MOV A,$F6". I can find 2 instances of that command. But I need to take a better look at the routines they pertain to. -- http://novaliaspirit.99k.org/ff6/file/ff6_spc.txt

  Find
Quote  

#4
Posts: 2,769
Threads: 88
Thanks Received: 24
Thanks Given: 87
Joined: Jun 2009
Reputation: 25
Status
None
and Mathias is back lolz


"Sometimes ninjas do wrong to each other, and in dat way the force of tha earf' comes around da moon - and at that presence, da dirt, it overshadows the grass, so you're like, I can't cut dis grass, there's no sun comin' through. So in order to enable each other the two fruits have to look each other in da eye and understand we can only be right, as da ripe is wrong, you know what I mean?"

-HNIC
Quote  

#5
Posts: 127
Threads: 8
Thanks Received: 21
Thanks Given: 12
Joined: Jan 2012
Reputation: 13
Status
None
(04-18-2012, 03:32 PM)Poco Loco Wrote: and Mathias is back lolz

Objection! (Hell yeah! And Setzer has the coolest hair!)
  Find
Quote  

#6
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(04-18-2012, 03:32 PM)Poco Loco Wrote: and Mathias is back lolz

Why does everyone have inside jokes that I don't understand...Sad

On a more serious note, is there a way to trace the SPC-700 engine ? I don't know any debugger or tracer for the SPC-700. What I was trying to figure out is how sound samples are processed, either by the game and/or the SPC-700 to be able to replace, tweak or modify the 255 existing sound effects. They are not made from BRR samples that you can replace like the instruments I believe and some of the following data is not that well documented either, so all this is pretty much a mess in my head:

Code:
0520C7    0520C8    DATA    No    Length of Sound Effect Sample Data    8/26/2002
0520C9    052215    DATA    No    Sound Effect Sample Data (Copied to SPC locations $4800-$494C)    8/26/2002
052216    052217    DATA    No    Length of Pointer Table to Sound Effect Sample Data    8/26/2002
052218    052237    DATA    No    Pointer Table to Sound Effect Sample Data (Copied to SPC locations $1B00-$1B1F)    8/26/2002
052238    052239    DATA    No    Length of ADSR Data for Sound Effect Samples    8/26/2002
05223A    052249    DATA    No    ADSR Data for Sound Effect Samples (Copied to SPC locations $1A80-$1A8F)    8/26/2002
05224A    05224B    DATA    No    Length of Wave Rate Multiplying Values for Sound Effect Samples    8/26/2002
05224C    05225B    DATA    No    Wave Rate Multiplying Values for Sound Effect Samples (Copied to SPC locations $1A00-$1A0F)    8/26/2002
05225C    05225D    DATA    No    Length of Type 1 Sound Effect Instruction Pointers and Instructions    8/26/2002
05225E    053E5D    DATA    No    Type 1 Sound Effect Instruction Pointers and Instructions    8/26/2002
  Find
Quote  

#7
Posts: 2,769
Threads: 88
Thanks Received: 24
Thanks Given: 87
Joined: Jun 2009
Reputation: 25
Status
None
well its really not anything on the inside he just kinda disappeared 4 a while thats all lolz


"Sometimes ninjas do wrong to each other, and in dat way the force of tha earf' comes around da moon - and at that presence, da dirt, it overshadows the grass, so you're like, I can't cut dis grass, there's no sun comin' through. So in order to enable each other the two fruits have to look each other in da eye and understand we can only be right, as da ripe is wrong, you know what I mean?"

-HNIC
Quote  

#8
Posts: 127
Threads: 8
Thanks Received: 21
Thanks Given: 12
Joined: Jan 2012
Reputation: 13
Status
None
(04-18-2012, 07:02 PM)Madsiur Wrote: On a more serious note, is there a way to trace the SPC-700 engine ? I don't know any debugger or tracer for the SPC-700. What I was trying to figure out is how sound samples are processed, either by the game and/or the SPC-700 to be able to replace, tweak or modify the 255 existing sound effects. They are not made from BRR samples that you can replace like the instruments I believe and some of the following data is not that well documented either, so all this is pretty much a mess in my head:

Code:
0520C7    0520C8    DATA    No    Length of Sound Effect Sample Data    8/26/2002
0520C9    052215    DATA    No    Sound Effect Sample Data (Copied to SPC locations $4800-$494C)    8/26/2002
052216    052217    DATA    No    Length of Pointer Table to Sound Effect Sample Data    8/26/2002
052218    052237    DATA    No    Pointer Table to Sound Effect Sample Data (Copied to SPC locations $1B00-$1B1F)    8/26/2002
052238    052239    DATA    No    Length of ADSR Data for Sound Effect Samples    8/26/2002
05223A    052249    DATA    No    ADSR Data for Sound Effect Samples (Copied to SPC locations $1A80-$1A8F)    8/26/2002
05224A    05224B    DATA    No    Length of Wave Rate Multiplying Values for Sound Effect Samples    8/26/2002
05224C    05225B    DATA    No    Wave Rate Multiplying Values for Sound Effect Samples (Copied to SPC locations $1A00-$1A0F)    8/26/2002
05225C    05225D    DATA    No    Length of Type 1 Sound Effect Instruction Pointers and Instructions    8/26/2002
05225E    053E5D    DATA    No    Type 1 Sound Effect Instruction Pointers and Instructions    8/26/2002

The sound effects of FF6 are interesting but I don't know a lot about this.

I doubt there is a tracer or debugger for the SPC. At least none that I know of.

I believe I read somewhere that the SPC's sound generation has to be BRR or an internal oscillator within the SPC core. I doubt sound effects are generated with oscillators, but it could be a mix of the SPC core with samples.

The "Sound Effect Sample Data" chunk is 333 bytes and the "Length of Sound Effect Sample Data" has a value of 0x14D = 333 (decimal). 333/9 = 37 with no remainder so this could be 37 BRR chunks. If so then the "Sound Effect Sample Data" is 592 samples (37 * 16 samples). But that's not very many samples.

The "Pointer Table to Sound Effect Sample Data" has 2 byte pointers that seem to be in stereo pairs. I'm assuming this as we have 2 byte pointer duplicates side by side.

Code:
Left    Right
00 48   00 48    Pointer 1
24 48   24 48    Pointer 2
48 48   48 48    Pointer 3
6C 48   87 48    Pointer 4
AB 48   C6 48    Pointer 5
D8 48   D8 48    Pointer 6
EA 48   EA 48    Pointer 7
FC 48   17 49    Pointer 8

So according to this the 255 sound effects are generated from 8 sound effect samples.

Well the "ADSR Data" should be 2 bytes each (look up VxADSR in this doc: http://nocash.emubase.de/fullsnes.txt) and the chunk is 16 bytes so that makes 8 ADSR values, matching the 8 sound effect samples. (same goes for "Wave Rate Multiplying Values", but I have no idea how these are used).

Lastly the "Type 1 Sound Effect Instruction Pointers and Instructions" seems to be a huge chunk. So I'm guessing this will be where the 255 effects are mapped down to 8 samples with different processing instructions. I have no clue what this data is however.

If we start by excluding the pointers from the instructions:

Code:
05225E    05265D    DATA    No    Type 1 Sound Effect Instruction Pointers (2 bytes each, 512 pointers or 2 * 2 bytes each, 256 two channel pointers)
05265E    053E5D    SPC     No    Type 1 Sound Effect Instructions (edit: SPC data)

The pointers are 2 bytes each. They come in an incremental list as most pointers and do not have any duplicates. The only exception to incrementing and being unique is the $0000 pointer. I'd guess $0000 pointer values either play a mono sound based on the previous instruction or mute either the left or right channel. Perhaps we could play around with the pointers to figure this out.

Another note on the pointers is that most likely there are 253 sound effects not 255, could this be true? (edit: The pointers are most likely 256 but the last three are $0000 so unused)

The instructions themselves range from 2 bytes to a lot of bytes. Understanding them properly would require understanding the SPC core better but you could try to identify some of the sound effects instruction chunk and try to mess with it's values.

I hope I gave you some ideas, let me know if I'm wrong or you have something to add. Confused

Update:

The "Type 1 Sound Effect Instructions" are SPC data. The pointers point to two SPC channels, these will be two mono channels and stereo is made with panning within each of the channels. The two channels are made for layering sounds.

The two channels will also sometimes share data, if the first pointer does not have an end byte, it will traverse through the bytes of the second pointer until it meets the end byte.

The "DC xx" command will refer to the sound effect samples not the instrument samples.

Pointers to $0000 will be skipped in the processing. Duplicating pointers to both channels will double their velocity (volume).

FF3Info has a fair list of SPC commands: http://www.rpglegion.com/ff6/hack/ff3info.txt

Hope to hear some new cool SFX Smile
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite