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

#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  



Messages In This Thread
How do you calculate BRR sample rates? - by m06 - 04-16-2012, 05:26 AM
RE: How do you calculate BRR sample rates? - by m06 - 04-20-2012, 01:38 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite