Banner
Views: 290,961,869
Time: 2014-04-24 10:17:03 AM
17 users online: Aeon, o Binrazan, Daniel 115, o dax, DPhoenix29, o Everest, Face, GreenHammerBro, Infrared, Kipernal, Lui37, MercuryPenny, o PatPatPat, Rykon-V73, Sokobansolver, tcdw, vividMario52 - Guests: 35 - Bots: 74Users: 24,814 (1,113 active)
Latest: Kamia Elpida
Tip: Verify your ROM is unedited by using ROMclean.
SPC engine rewrite...what do we want?
Forum Index - SMW Hacking - General SMW Hacking Help - Custom Music Help - SPC engine rewrite...what do we want?
Pages: « 1 2 »
So far this topic has been brought up a couple times. Since addmusic405 and addmusicM each have their own little problems, ADSR, echo limitations, size restrictions.

p4plus2 and smkdan want to know what specific features we would want for this. This will more or less be an "addon/fix" as opposed to something completely different. They want to make sure that all old songs in the music section would be compatible with this new engine.

So far our ideas are...
- Keep the main porting style
- $E5/$F3 support
- ADSR on sfx channels fix
- brr/bnk support
- Echo buffer placements
- Custom SFX support
- $E5 on OW
- Vibrato fix
- $ED $81 + Pitchbends (Carol's)
- Glissando command
- Loops in loops
- Single byte FIR command
- Noise command
- Pitch Modulation command
- Surround sound a la DKC2
- $ED $81 $XX fix so it doesn't detune samples
- Key signature command
- Looping function fix in Sample Tool
- Transpose down per channel basis
- Slur command
- Conditional looping

...If you have any ideas that would benefit everyone who ports music, jot them down below. If you want to help code this engine, contact p4plus2 with the details.

Things p4 said he might not know...
Note length commands:
$02- 64th note triplets 96
$03- 64th note 64
$04- 32nd note triplets 48
$06- 32nd note 32
$09- 16th note triplets 24
$0C- 16th note 16
$10- 8th note triplets 12
$18- 8th note 8
$20- Quarter Note triplets 6
$30- Quarter Note 6
$40- Half Note triplets 3
$60- Half Note 2
$80- Whole Note triplets (60 length note + 20 length tie) 2^3
$C0- Whole Note (60 length note + 60 length tie) 1

Hex commands:
- DA- Instrument
DA XX
Valid values: 00-12

-DB- Pan
DB XX
Speaker balance of a channel; Valid values: 01(rightmost)-13(leftmost); 0A is centered)

- DC- Pan Sweep
DC XX YY Gradually shifts speaker balance of a channel
$XX = duration, $YY = pan value

- DD- Pitch Bend
DD XX YY ZZ
XX = Delay, YY = Duration, ZZ = Note

- DE- Vibrato
DE XX YY ZZ Wavers pitch of notes on a channel
XX = Delay, YY = Wavelength, ZZ = Amplitude

- DF- Vibrato Off
DF

- E0- Global Volume
E0 XX Sets volume for entire song

- E1- Global Volume Ramp
E1 XX YY Gradually changes volume of entire song
$XX = Duration $YY = Volume

- E2- Tempo
E2 XX Valid values: 00-FE

- E3- Tempo Ramp
E3 XX YY Gradually changes speed of entire song
$XX = Duration $YY = tempo

- E4- Global Transpose
E4 XX Instantly changes key of the entire song
Signed value (i.e. FF=down 1 semitone)

- E5- Carol's sample calling
E5 XX YY
$XX = sample number + $80, $YY = tuning

(high bit is used for the sample calling)

- E7- Channel Volume
E7 XX Sets volume for one channel

- E8- Channel Volume Ramp
E8 XX XX Gradually changes volume of a channel
$XX = duration $YY = volume

- ED- ADSR command
ED WX YZ
WX = Decay/Attack YZ = Sustain(10)+Release

(High bit is used for misc. commands)

- EE- Fine Tune
EE XX
$FF = 1 semitone

- EF- Echo
EF XX YY ZZ
YY=Echo strength, left speaker; ZZ=Echo strength, right speaker

- F0- Echo Off
F0

- F1- Echo 2
F1 XX YY ZZ
$XX = echo Delay $YY = Feedback $ZZ = FIR on/off

- F2- Echo slide
F2 XX YY ZZ
$XX = Duration, $YY = volume left, $ZZ = volume right

- ED 81 tune by semitone (AM4)
ED 81 XX
XX = tuning value, $00-$7F positive $80-$FF negative

- ED 81 0F-7F FIR Filter command (AM4)
ED 81 0F XX
...
ED 81 7F XX
XX = FIR filter values

Note hex values:
$80 (C-1) - $C5 (A-6)

Other commands:
. = half the previous note value (2^4^8 = 2..)
* = Call previous loop without labelling
q = Staccato q01 q7f
h = Tune by halfstep (AMM)
y = panning 00 = right, 10 = center, 20 = right
t = tempo in dec
w = global volume in dec
= = direct dec note value (whole note = $C0 = 192)
p = vibrato (p###,### wavelength,aplitude)

We know some commands are missing so please list them below if you can.

AddmusicM-specific commands:

- $E6 - "Super loop" (compatible with [])
$E6 $XX
If XX is 00, then this declares the start of the loop. If XX != 00, then it indicates how many times to repeat the music back to the last $E6 $00. (good for looping in loops, I guess)

- $F3 - Sample load
$F3 $XX $YY
XX = 20 + the number of the sample specified in the instrument load line.
e.g.: _12_24_FF
- to load sample 12 -> $F3 $21
- to load sample 24 -> $F3 $22
YY = tuning

- $F4 - Yoshi drums / Portamento / Channel echo / Square Wave ($FA)
$F4 $00
This will cause channel #5 to be silent unless the player is riding Yoshi.

$F4 $01 -> "heavy portamento" (no break between notes)
$F4 $02 -> "light portamento" (only half the normal break between notes, affects only one channel)

$F4 $03 - turns channel echo on/off

$F4 $04 - Square wave, make ratio of peak to trough 1:1
$FA $XX - set oscillation frequency (0 by default)

- $F5 $XX $XX $XX $XX $XX $XX $XX $XX - FIR Filter
Each successive $XX is the FIR filter for a particular channel.

- $F6 $XX $YY - DSP write
Send the value $YY to DSP register $XX.

- $F7 $XX $YY $YY - ARAM write
Send the value $XX to ARAM $YYYY (big-endian).

- $F8 $XX - Noise
$XX = pitch of noise (00-1F); using the @ command or another $F8 $XX will turn it off
Last edited on 2011-09-03 02:32:56 AM by Slash Man.
Well, for one thing, they should definitely take advantage of the TCALL and PCALL commands and not put any samples or echo in $FFxx...but that's not really a feature. Some features that I'd like include:

- A single-byte FIR command ($F5?)
- A single-byte noise command ($F8?)
- A single-byte pitch modulation command ($F9?)
- An N-SPC command for GAIN
- Storing a new value to $1DFB automatically uploads the new music and samples
- Dynamic placement for music, samples, echo, and custom sound effect space depending on how much one wants to use for each (you might have already essentially listed this, but I just want to make sure)
- Fix for echo delay values above $05
- Ability to use noise, pitch modulation, and the like on SFX channels
- Single-byte DSP and ARAM writes might be useful, too (AddmusicM uses $F6 and $F7), but are not mandatory.
- How about a command for simply incrementing the sample number by 1, leaving all other settings the same? (The obvious use of this would be to save bytes when using pitch enveloping samples. Again, this could be useful, but it isn't absolutely necessary.)

Kipernal also mentioned a command to send the current song position to the DSP. I'm not sure how that would work, but I'm picturing something like Music Madness in DKCR, where you could make sprites move or activate based on the beat of the music.

Also, for a tool that used this engine, it would be nice to be able to specify all the arguments in one string and not require pressing Enter after completion. (Addmusic 4.05 is already like this; AddmusicM isn't.)

Finally...you said "$E5 on OW", but does that include "$F3 on OW", too?

Edit: Oh, I almost forgot. If a tool is made, will there be a way to tell how much ARAM space a particular music track and its samples require so that you know how much you have left for echo and the like? I'd appreciate that. Such a tool should also support unheadered ROMs.
Last edited on 2011-08-23 09:38:09 AM by imamelia.
Whoa, all of these are nice sounding (no pun intended) ideas, I wonder how many of it will actually come to an existence (the more the better, of course). While I can't really add any ideas right now (Atma and imamelia listed pretty much everything I'd know), I really support this project and I'm up to testing when we're in that state.

Originally posted by imamelia
Finally...you said "$E5 on OW", but does that include "$F3 on OW", too?


$F3 was already possible on OW in M, so why wouldn't it? It almost feels like merging the two tools and adding some more features.
Shouldn't that "ADSR on SFX channels fix" be generalized to "N-SPC commands on SFX channels"? Also, I would consider the echo delay fix and GAIN command important enough to list.

Also, according to Kipernal, SMW's original engine is
Originally posted by Kipernal
awful. Very unorganized, seems to take up loads more space than is necessary, and in general is rather inflexible.
Assuming that the new engine would be mostly based off the old one and not made from scratch, will it be more optimized (*cough*TCALL*cough*) and organized?
Originally posted by imamelia
Also, according to Kipernal, SMW's original engine is
Originally posted by Kipernal
awful. Very unorganized, seems to take up loads more space than is necessary, and in general is rather inflexible.
Assuming that the new engine would be mostly based off the old one and not made from scratch, will it be more optimized (*cough*TCALL*cough*) and organized?


Sounds like everything you code. *runs*

on a serious note: please only suggest ideas that are widely useful, and not extremely niche.
Last edited on 2011-08-24 12:41:35 AM by 4803.
Originally posted by Atma
on a serious note: please only suggest ideas that are widely useful, and not extremely niche.


Maybe I'm missing something, but what was on imamelia's list that couldn't be useful?
Huh? You can use like all sample slots there is from 00 to FF, assuming there's enough free space (1 bank). AddmusicM does not care for space, since it inserts the samples in .brr format directly.

Either way, I'd love a transpose command on a per channel basis.

E.g. Use $f4 $f8 to turn on the command and use $f4 $f8 again to turn it off. $f8 is the transpose in this case, which could be any number from $00 to $ff. ;)
Hrm, that would be an interesting concept, a Key signature command and a transpose command (if that's what Ice Man meant).

Example:

$FF $00 = C Major/a minor
$FF $01 = G Major/e minor
$FF $02 = D Major/b minor
$FF $03 = A Major/f# minor
etc...

is what I had in mind for a key sig.
Like it can eliminate +/- symbols in the txt file depending on which key you pick.
It would be more convenient to have an h/$ED $81 command that didn't screw up SFX.
Originally posted by Ice Man
Either way, I'd love a transpose command on a per channel basis.

I had originally planned that, but I think it took up too much space so I had to leave it out.
This has been mentioned on the IRC many times before, but for the sake of 'archiving':

Reduce sample sizes by removing unnecessary (trailing) silences. This way we can probably save up a couple more bytes.

e: then again I think there's a .bnk out there with original SMW samples reduced in size. When rewriting the engine you can use that instead of the original samples.
Last edited on 2011-08-26 05:18:30 PM by Ersanio.
Oh, here's something I can't believe nobody (including me) has mentioned yet: custom samples in sound effects.

Also, how about a real tremolo command? Wasn't $E5 supposed to be used for that (if the first byte after is is less than $80)?
Last edited on 2011-08-27 11:52:31 PM by imamelia.
Tremolo already exists, at least in Addmusic by Carol and AddmusicM. Should work in Addmusic by HFD as well, but don't know about that.

$e5 $xx $yy $zz is used for tremolo, it doesn't matter if $xx is below or above $80.

$e5 $xx $yy is the sample call command for those Addmusic versions where $xx has to be $80 and higher.
Oh? I thought I tried that and didn't get it to work.

Okay, how about an option to change which channel each of the three groups of sound effects use (so you could, for example, move the $1DFA sound effects to channel #6, or make SFX play on channels 5, 6, and 7 instead of 4, 6, and 7)?

Also (another thing I can't believe I didn't remember sooner), having the ability to use any N-SPC command in custom sound effects would be very useful.
Last edited on 2011-08-29 07:35:23 PM by imamelia.
Originally posted by imamelia
Okay, how about an option to change which channel each of the three groups of sound effects use (so you could, for example, move the $1DFA sound effects to channel #6, or make SFX play on channels 5, 6, and 7 instead of 4, 6, and 7)?

Actually, after a brief discussion with p4plus2, I'd like to modify that a bit: If there is a channel that is not in use when a sound effect plays (even if it isn't normally a SFX channel), then the sound effect will play on that channel. If all of them are in use, then the sound effect will play on its default channel. I still think the defaults should be user-defined, though, to the point that you could even put the $1DFA SFX on channel #0 or something if you wanted to.
Some random comments before I head out..

-still interested in contributing but I don't know when I can start
-I thought about both methods (load all commands vs. load commands as-needed) and the latter sounds like it's worthwhile. Most of the simpler commands can be loaded permanently since the original sound effects need them and pretty much every music track will need them anyway. All the new commands can be loaded as-needed and none of the original SFX will depend on them obviously.
-getting SFX and music to have minimal separation in code would be a plus. I know SMW has a ton of music/SFX specific code despite having similar formats for both and attempting to use specific music commands in SFX causes various problems.
-we should change the uploader on both SNES/SPC ends. Not just to make everything faster (since we're moving much more data now), but the SPC is deciding where the data is going and the old routines don't support that. Getting a newer/faster one is better than just hacking up the old/slow one by far.
-I've been commented an existing disassembly of the engine that I should upload sometime soon. Every detail of how the game calculates pitches and all of that needs to be taken into account, plus the existing issues have to be documented so we know where/how in the code they happen.
-can a music guy post all the vibrato related problems in detail with examples? I don't feel like digging all that up myself.
-what's the first major milestone we should aim for? Only looking for input from p4 or other coders who volunteered for this. Does something like getting the original piano tune working with a new engine sound fine? Forget sound effects or any of that for now. We just need some initial goal that we should work towards since we're starting from scratch here.
You're probably taking this into account already but: a function that zeroes out the echo buffer to be called on song change/whenever else you need it. Pretty sure that's the source of the "static pop" everyone hears when they try and use echo with the old engine.
Also, something should be done with @18, @19, and @20. @18 is the same as @1, and @19 and @20 are invalid, but I presume that they all still have data in a table that corresponds to them...don't they? One of those instruments should call sample 13, since it's the only one that doesn't have an instrument value associated with it. I don't know what the other two would do, though...maybe call two existing instruments with different ADSR? It could save space.

By the way, I figured out that if you did decide to put all the samples used by SFX at the end of ARAM, they would take up 1C71 bytes, going from $E28F-$FEFF. (That's samples 00, 01, 02, 03, 04, 06, 08, 0B, 0E, 12, and 13, and it assumes that the optimized samples are being used.)
Last edited on 2011-09-08 12:46:07 AM by imamelia.
Well I am getting to the point where I am ready to start actual work on this, so please considering trying to get the rest of any suggestions in ASAP. It is easier to plan for things now rather than later ;).
Originally posted by imamelia
custom samples in sound effects.

^^^^^ THIS SO MUCH ^^^^^

I can't think of a hugely useful idea other than that, but maybe flags to allow changing of volume/pan in channels manually, or even changing around $1DFA to allow new SFX or something so it doesn't crash above a value of #$04?
Pages: « 1 2 »
Forum Index - SMW Hacking - General SMW Hacking Help - Custom Music Help - SPC engine rewrite...what do we want?

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2014 - SMW Central
Legal Information - Link To Us


Total queries: 27

Menu

Affiliates

  • Talkhaus
  • SMBX Community