| What exactly is 'Gain'... |
|
Forum Index - SMW Hacking - General SMW Hacking Help - Custom Music Help - What exactly is 'Gain'... |
|
Pages: 1  |
|
|
|
| Posted on 2012-03-03 09:13:38 AM |
Link | Quote |
|
|
...and how is it different from ADSR?
|
|
| Posted on 2012-03-03 09:41:18 AM |
Link | Quote |
|
|
It's another type of sound enveloping method, and it has a slightly different set of parameters. This document probably explains it better than I could.
|
|
| Posted on 2012-03-03 10:24:02 AM |
Link | Quote |
|
|
Ohhey I was about to make a thread about this! Thanks, I wanted to experiment with this on my next port.
|
|
| Posted on 2012-03-03 11:18:40 AM |
Link | Quote |
|
|
Can anyone make an example and SPC? I wanna hear it, instead of reading.
|
|
|
|
| Posted on 2012-03-03 06:12:26 PM |
Link | Quote |
|
Any example using slides/changes?
Like:
*setsgain*
c8
*increasesgain*
c8
*increasesgain*
Etc.
|
|
| Posted on 2012-03-05 08:39:03 AM |
Link | Quote |
|
Could someone give me like a graph demonstrating what 'Gain' is?
You know, like the one showing what ADSR is? That's what I'm most curious about.
|
|
| Posted on 2012-03-05 12:22:37 PM |
Link | Quote |
|
So what I found out is this:
To set gain I use this command:
$ED $80 $x5 $00
in the beginning of the channel.
ALWAYS FIRST PUT GAIN ON, THEN DO THE REST!!!
x is your channel number, if I want it for #0 I use 0, #5-5, #7-7, etc.
There are 5 different values for GAIN:
Direct GAIN, this sets the envelope to the given parameter.
Increase GAIN (linear), makes the envelope go up in a straight line.
Increase GAIN (bent line), this makes the envelope go 3/4 up then slow down until at 1.
And 2 decrease values from what I didn't find out how to use them.
So here are the values:
Direct:
$ED $80 $x7 $yy
where x is your channel number and yy is the gain-value UNDER $80
Linear Increase:
$ED $80 $x7 $yy
where x is your channel number and yy is the value from the table+$C0
Bent Increase:
$ED $80 $x7 $yy
where x is your channel number and yy is the value from the table+E0
(yay for shameless copy-pasting!)
GO HERE FOR A TABLE AND FURTHER INFORMATION
Let's use an example:
Code#0 v255 t50 @0
$ED $80 $05 $00
$ED $80 $07 $60
c4
This will play a note with the GAIN value 60 like you'd use $ED $7F $E0.
Another example:
Code#0 v255 t50 @0
$ED $80 $05 $00
$ED $80 $07 $CA
c4
$ED $80 $07 $F0
c4
#1 v255 @1
$ED $80 $15 $00
$ED $80 $17 $F2
f8f8
$ED $80 $17 $D0
f8f8
This will play note c4 linear with the given value and again but then bent.
On channel #1 it'll play note f8 two times in a row bent and then f8 two times in a row linear.
An example with ARAM:
Code$ED $82 $61 $36 $00 $04
$01 $00 $00 $CA $04 ;This will do it linear with the given value $DA $13
#0 $DA $13 c1
Tada!
Well, I'm still trying to find out the other way.
Maybe SMW uses something with GAIN I don't know, like it does with volume.
|
| Last edited on 2012-03-05 06:14:51 PM by Torchkas. |
|
| Posted on 2012-03-05 04:49:50 PM |
Link | Quote |
|
I think I got how to rip Gain from an SPC:
Let's rip one from mm7:

Ga A 0 1 18
- The first digit determines the type of Gain if it's not direct (bits 7,6 and 5). If Gain is direct (like in SMW) it'll show a D.
C ($C0) is Increase Linear
E ($E0) is Increase Bentline
8 ($80) is Decrease Linear
A ($A0) is Decrease Exponental (like in our case)
- I don't know what the second and the third digits are, but I'd assume they are two bits, since they can be either 0 or 1 (cleared or set).
You don't need them anyway [citation needed].
- The last two digit (18 in this case) is the Gain rate (or parameter), and represents bits 0,1,2,3 and 4.
Its value can go from 00 to 1F (5 bits).
-----------------------------------------------------------
So, all we need to do is (you might use an hex calculator, though the operations are pretty easy) get the first digit and multyply it by 10. In our case we'll get A0.
Then we get the last two digits, and add them together to our last result. In our case we'll get 18+A0=B8.
B8 is the value we need to write to the DSP register x7 (x is channel number).
So let's do it:
$ED $80 $x5 $00 ;this clears ADSR, otherwise GAIN will be ignored work
$ED $80 $x7 $B8 ;now we write the value we got, to the DSP register for GAIN
------------------------------------------------
This is what I've just got
EXAMPLE (531 bytes btw)
I mean, I just got bored =P
|
|
| Posted on 2012-03-05 05:19:52 PM |
Link | Quote |
|
Well, according to how it looks to me in SPC700 Player. You aren't fading out the envelope, like you should with GAIN.
This is actually where I'm hanging, the GAIN get's enabled but the EX goes to zero immediately.
EDIT:Apparently it works like this:
D=Direct $Value
A 0 0=Linear Decrease $Value+80
A 0 1=Exponential Decrease $Value+A0
A 1 0=Linear Increase $Value+C0
A 1 1=Bent Line Increase $Value+E0
|
| Last edited on 2012-10-25 05:09:03 PM by Torchkas. |
|
| Posted on 2012-03-05 05:50:47 PM |
Link | Quote |
|
|
Thanks, you're right, now I think I actually got it, except that I don't know how to prevent the EX from going immediately to 00.
|
|
| Posted on 2012-03-05 10:56:29 PM |
Link | Quote |
|
|
From what I've experienced, Gain seems to be displayed on the SPC700 player when the notes go silent for most games. Capcom games are a good example of that. DKC songs display Gain before any channel plays any note. Other games like Jurassic Park though use only Gain for their songs. SNN actually ported that song using ADSR as opposed to Gain and it worked fine. I personally have no real use for Gain though honestly, I don't see how it would benefit me in the least.
|
| Last edited on 2012-03-05 11:00:02 PM by Slash Man. |
|
| Posted on 2012-03-08 05:25:46 PM |
Link | Quote |
|
|
I know you dont know how to use it Torchas, but whats the command for decrease gain?
|
|
| Posted on 2012-03-09 02:08:01 AM |
Link | Quote |
|
Decrease doesn't work properly, it probably has something to do with the way how SMW works with sound. (like crap)
But about the values, I already posted them above.
|
|
| Posted on 2012-03-23 10:25:47 AM |
Link | Quote |
|
|
When I try using GAIN in AMM, it crashes (no Music Plays). Is there a Possibility for AMM?
|
|
| Posted on 2012-03-23 10:43:58 AM |
Link | Quote |
|
Well, aparently a japanese guy with an odd name used gain command in his Plok Beach port, looking at the txt it was enabled with $ED $80 $XX, unfortunately I don't know what's $XX, maybe $YY value of the command for addmusic4? ($ED $80 $X7 $YY).
Also, you need to put the command on a channel, like ADSR.
|
|
| Posted on 2012-03-24 03:56:59 AM |
Link | Quote |
|
thanks, I'll try it ^^
-- EDIT: Works =D
|
| Last edited on 2012-03-24 03:59:54 AM by Darius. |
|
|
Pages: 1  |
|
|
|
|
Forum Index - SMW Hacking - General SMW Hacking Help - Custom Music Help - What exactly is 'Gain'... |