How do you calculate BRR sample rates? - Printable Version +- FF6 Hacking (https://www.ff6hacking.com/forums) +-- Forum: Hacks, Resources and Tutorials (https://www.ff6hacking.com/forums/forum-1.html) +--- Forum: Opera House Rehearsal Room (https://www.ff6hacking.com/forums/forum-71.html) +--- Thread: How do you calculate BRR sample rates? (/thread-1590.html) |
How do you calculate BRR sample rates? - m06 - 04-16-2012 Does anyone know how you calculate the sample rate for BRR instruments? RE: How do you calculate BRR sample rates? - madsiur - 04-17-2012 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 RE: How do you calculate BRR sample rates? - m06 - 04-18-2012 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/Bank%20C5%20disassembly.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 RE: How do you calculate BRR sample rates? - SSJ Rick - 04-18-2012 and Mathias is back lolz RE: How do you calculate BRR sample rates? - m06 - 04-18-2012 (04-18-2012, 03:32 PM)Poco Loco Wrote: and Mathias is back lolz (Hell yeah! And Setzer has the coolest hair!) RE: How do you calculate BRR sample rates? - madsiur - 04-18-2012 (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... 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 RE: How do you calculate BRR sample rates? - SSJ Rick - 04-18-2012 well its really not anything on the inside he just kinda disappeared 4 a while thats all lolz RE: How do you calculate BRR sample rates? - m06 - 04-20-2012 (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: 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 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) 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. 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 |