Language…
16 users online:  Alex, DanMario24YT, Dennsen86, derv82, Domokun007, drkrdnk, eltiolavara9, Fozymandias, GRIMMKIN, Maw, Nayfal, prisvag, Red2010, Silver_Revolver, steelsburg, yno14jax - Guests: 289 - Bots: 324
Users: 64,795 (2,374 active)
Latest user: mathew

Wakana's Music Porting Tutorial - From the Basics to the Advanced

Custom MusicPortingSamples

It is the slash command, the "/" (without quotes). Be sure that the loop timing is identical in all channels, else your song desyncs after the second loop.
Originally posted by MarioFanGamer
It is the slash command, the "/" (without quotes). Be sure that the loop timing is identical in all channels, else your song desyncs after the second loop.


Thanks, I'll try it!
TAke a look, y'all: IMG_4346.jpeg
Glad to see this finally come! We've been waiting for this. However there are some notes on echoing I'd like to make. After all it's something I written a topic about (which you linked) #fim{XD}


Echo Buffer
Originally posted by Wakana
- From $80 to $FF you have surround volume

$FF to $80 is not necessarily surround sound. What it does is invert the waveform. If EVOL L= -n R= -n then it will sound identical to MVOL L= +n R= +n, granted no feedback. Because it's not the same phase (180o phase shift) you MAY get surround/panning effects but you also risk having destructive interference.

MVOL $40 $40 EVOL $dC $dC


Originally posted by Wakana
$FF being the lowest, $7F being the highest.

$FF is -1, $7F is 127. $80 is -128 making it the lowest. If we're talking volume $FF should be the same as $01. $7F + $01 = $80, and it should continuously get "smaller." Could be wrong and the SPC700 does something different
#wario{-_-?}

What generates surround are inverse Volumes, EVOL L= -n R= +n, this would (for example) generate a 45o phase shift. In short the waveform has to be phased a certain way to be matrixed for surround output. This is generally done by using inverse volumes and/or mixing negative and positive FIR coefficients.

MVOL $40 $40 EVOL $dC $24

Feedback Volume
Originally posted by Wakana
$7F to $FF you get surround reverb

Basically the same as the above. Negative feedback should phase the waveform 180o. If feedback and echo volumes are negative you should be in-phase with MVOL. 180o + 180o = 360o = 0o

Originally posted by Wakana
$0F is max delay (I think?)

Yup! 240ms for 30kb ARAM. Maybe echo buffer writes can change this.

FIR Filter
Originally posted by Wakana
The difference is very thin. To compare them, take a listen to these two spcs: NO FIR WITH FIR

I think the way AMK readme has it is a bit misleading. NO FIR is a "lowpass filter" whereas FIR ON is unaltered sound. Not your fault it's like this but technically it should be the other way around? xD
The filters are explicitly defined in a table so really it doesn't even turn anything off.

Stereo Samples
Originally posted by Wakana
- This can be tricky in your .txt, since, in order to play a sample, you need 2 channels and not one.
- This takes double the space.
#smrpg{<3}

I believe these reasons alone deter many people from using stereo samples. Effective use of surround sound (and echo) can close the gap between mono/stereo. The main advantage of stereo samples is to realistically capture the acoustics of the given room. A "dry" sound loses very little information mono. Hopefully this example gets the point across. Stereo, Mono. The latter uses the echo buffer to help alleviate the deficiency. Unless we had the PSX's 512kb SPU memory then it'd be difficult to properly showcase the power of stereo samples.

Thanks for the guide as it was very much needed here!#smrpg{y}
Originally posted by Brozilla
*stuff*

Thanks for pointing all that out. I'll be doing fixes where/if needed.

Quote
$FF is -1, $7F is 127. $80 is -128 making it the lowest.

My "highest/lowest" was pointed to echo feedback, not the values themselves.
If I'm proven wrong it's okay but here is a demonstration of what I'm talking about.

SPC:MML
The FIR Filter delays output from the echo buffer (something really small) so you're unable to get "true" interference. However let's begin, MVOL -127 -127


First Loop.
Negative EVOL and negative FIR we get destructive interference. Negative * Negative is a positive output for our EVOL.

Second Loop.
Positive FIR Filter. Because MVOL and EVOL are in-phase (negative) they will provide constructive interference.

Third Loop.
Negative + Positive EVOL. This is what a "surround echo buffer" should be. However it proves Dolby Surround is not magic. It simply takes the problems of the previous loops. These are all nothing but waveform inversions of the respective channels.



This old SPC should drive the point home. You'll need to disable channel 1 or both 2 & 3 since CH 1 is surround panned. Playing all 3 simultaneously (at first) may not create a clear picture.
The SPC cycles through MVOL/EVOL parameters. Whenever M/EVOL is surround , CH1 becomes stereo whereas CH2 & CH3 become surround panned. A surround pan is y,10,1,0 or y,10,0,1. That is placing '1' will flip the waveform of that speaker output.

TLDR it's all about waveform phases/inversion. Wiki has the information, that is the SNES supports Dolby Surround. However to truly appreciate it you need a receiver, soundcard, speakers, or some hardware supporting Pro Logic II or similar matrixing technologies.
I can't believe I didn't see this tutorial before, this was a big help! Thank you so much!
Originally posted by Wakana
@9 $02$00


I feel like these tuning values are wrong for the piano sample. I tried to find something more accurate. I ended up with this:

Code
@9 $05$59


EDIT: Originally I had @9 $05$67, but some notes at different octaves were a little off.
Twitter
Originally posted by Wakana
@15 $03$00


Also these values might be off for the orchestra hit sample. This sounds better:

Code
@15 $01$E4
Twitter
Originally posted by Giftshaven
Code
@9 $05$59

Code
@15 $01$E4

Can confirm. In recent unsampled ports where I used both, I ended up using @9 $E5 $58 and @15 $01 $E7, which is very close to what Giftshaven has.


edit: why did i write $07 instead of $E7
LINKS Twitter | YouTube | SoundCloud | Fortaleza Reznor
to hear birds and see none.
Thank you both for reporting the errors. I've fixed them (even though from InstrumentData.asm, seems that the original values were right... unless I'm misreading it)
While I was at it, I also added the ADSR of them, using #instruments notation (copypasted from InstrumentsData.asm). I can't test if all of them are right atm, so if you spot more errors, do post, thanks!
Originally posted by Wakana
Once you finished, click on the blue floppy disk, and save the sample as .wav



You might want to specify that it's the one in the samples tab! It's not the one from "File", or the one crossed out in the image. Apparently doing it the wrong way corrupts your .wav file and C700 will fail to convert it.
Twitter
Originally posted by Giftshaven
You might want to specify that it's the one in the samples tab! It's not the one from "File", or the one crossed out in the image. Apparently doing it the wrong way corrupts your .wav file and C700 will fail to convert it.
It's possible the author assumed the programs were intuitive enough for anyone to pick-up-and-play.
On a similar note I do believe the External Sample Ripping Section could use an update. Maybe a path with and without OpenMPT. OpenMPT can load most popular formats making Audacity almost redundant the way things are now. Adding a section for BRR tools would be nice as well.

Originally posted by Wakana
The first thing I do is to remove the rest at the beginning: remember, your sample has to play instantly, as soon as you press play (the note icon).
This advice works most of the time except when it doesn't. Certain instruments such as Ride Cymbals, Crashes, Celesta, and anything reliant on sharp attacks may not take too well as it's recommended to pad 16 zeros (silence) for BRR buffer initialization. This can result in an obnoxious pop and/or unintended effects during playback start.

I'd also like to bring forward for people to start favoring ADSR: $FE $E0 instead of ADSR: $FF $E0. Unless authenticity is desired you're MUCH less likely to get sample pop/clicking with the former.
following this tutorial, i have to point out 2 errors so far:


Originally posted by Wakana
So yes, let's transcribe the lower notes of the chords now.
Be careful not to use the same notes you wrote in #0! That's a common error.
In #1, there will be notes alternating with rests where channel #1 plays the notes on the very bottom of the MIDI. Both notes and rests have length 32, so we can use the lXX command again.
If you didn't quite understand, we will only transcribe the red notes in this picture. The green ones are the ones we wrote into #0.

In the underlined sentence the 2nd "#1" should be a "#0", since you try to point out the difference between the first two channels.


Originally posted by Wakana
SMW Samples' tuning values
Note: the format used is the ones used by #instruments

[...]
@2 $AE, $2F, $B8, $04, $00

@2 $XX $XX $XX $04 $00 is detuned. A $03 $00 sounds better to me (don't know if it is 100% correct though).








Originally posted by Sariel
Originally posted by Wakana
SMW Samples' tuning values
Note: the format used is the ones used by #instruments

[...]
@2 $AE, $2F, $B8, $04, $00

@2 $XX $XX $XX $04 $00 is detuned. A $03 $00 sounds better to me (don't know if it is 100% correct though).

Although I have to say that $03 $00 sound really better (especially since that's what YI uses for its glockenspiel which is similar so SMW's one), $04 is still SMW's tuning, though.
Updated the tutorial a bit:
- Added Gifty's pic which mentions which floppy disk to click when saving a sample in OpenMPT;
- Added a better description for what to do when cutting the beginning of a .wav, as Brozilla pointed out in his post;
- Fixed both things Sariel mentioned. On the latter one, while $04$00 is what SMW uses for the glockenspiel, using that in #instruments makes the glockenspiel detuned. I added a small mention on its side in the table. If you spot more detunings, let me know.
- Always on that table, percussions (@21 onward) were reporting an extra byte, which specified the note the percussion played on. I replaced the $XX with the note value (oX Y) for clarity reasons.
So I went in stupidly and clueless into using the tools provided here without reading a thing other then the bad readme provided with Addmusik.

I figured out most of this by downloading song after song and trying my best to reverse engineer the way it was done. I managed, badly.

I so wish I found this kind of tutorial earlier.
How can I test the .wav or .brr file when there's no play button in C700? How can I change the pitch and such?
This is a footer.
I wish such a tutorial were around when I was younger. It would have come in handy! As a rusty porter returning to the scene, someone recommended I come here. I'm pretty glad I did; you're a rather good teacher!


VTuber, musician, composer, voice actor. Check out my socials!

.





#thp{O_O1}
Im trying to follow your tutorial to sample my song but it says
Originally posted by AMK
There were errors while compiling:

File: Boss/boss sampled.txt Line: 10:
Error parsing replacement directive; could not find '='

you tutorial doesnt say how to fix this or anything about it so here is my music data (sampling part)
Code
#amk 2
#path "samples"
#samples
{
#default
"piano.brr"
"steeldrums.brr"
}
{
"piano.brr" $FF $EF $B8 $03 $1A ;@30
"steeldrums.brr" $9E $1F $B8 $05 $48 ;@31
}

really hope i can fix this


Keep your spirits high, and your noodle sweaty!
Originally posted by Sheeplover1011
Code
#amk 2
#path "samples"
#samples
{
#default
"piano.brr"
"steeldrums.brr"
}
{
"piano.brr" $FF $EF $B8 $03 $1A ;@30
"steeldrums.brr" $9E $1F $B8 $05 $48 ;@31
}

really hope i can fix this

You forgot to write #instruments in between the first } and second {. As it currently is, the second bracket group is just floating there.
LINKS Twitter | YouTube | SoundCloud | Fortaleza Reznor
to hear birds and see none.

Custom MusicPortingSamples