Viable game sound and music solution

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

User avatar
mbrenaman
Posts: 85
Joined: Sat Jul 09, 2005 6:03 am

Post by mbrenaman » Fri Aug 26, 2005 2:34 pm

Sounds good.
Thanks. You're the first human besides me to hear it.
I don't know which emu is most accurate, but on the real system writing to $4003/$4007 will reset the duty cycle and envelope (likewise for $400B and $400F too).
Well, for my vibrato effect I do so. How else could I update the current period. I see other games do the same thing in gnsf but they don't reset the waveform. I must be missing something...

Roth
Posts: 399
Joined: Wed Aug 03, 2005 3:15 pm
Contact:

Post by Roth » Fri Aug 26, 2005 2:37 pm

Wow man, yeah, that does sound really good. I like the bass line alot :) The whole song has a nice groove to it. Good job!

User avatar
mbrenaman
Posts: 85
Joined: Sat Jul 09, 2005 6:03 am

Post by mbrenaman » Fri Aug 26, 2005 2:41 pm

Looks fairly good, actually it even is more advanced than the write I wrote on myself that is only focused on volume and that doesn't allow pitch effects at all for now (I'll surely do a second version someday).
The music is cool, in Bubbleman style
Yea, when I was a kid, I really loved the megaman series music. So you can see I've been watching those tunes in gnsf and kinda adapting the style.
About the period resed, I think you should avoid re-writing to $4003/$4007 during a note, exept if you want do this to have a grumble effect like Just Breed does. This cause problems for some vibratoes, where the period *should* be resetted anyway because the high 3 bits of frequencey are affected. This cause no problem on the triangle channel, however. (actually, all that stuff make me stay away of vibratoes/slides exept by sweeping hardware for now).
So should I use the sweep unit to do my pitch changes?
Wow man, yeah, that does sound really good. I like the bass line alot The whole song has a nice groove to it. Good job!
Thank you very much. And thank you Bregalad.

Also, I included two songs, if anyone might not have noticed.

Roth
Posts: 399
Joined: Wed Aug 03, 2005 3:15 pm
Contact:

Post by Roth » Fri Aug 26, 2005 3:15 pm

Ha, no, I didn't notice that... I missed the whole .nsf itself actually, went straight for the .nes :P I noticed there are some sounds that happen when pushing A and B in the .nes file. Are these sounds going to be part of your game?

User avatar
mbrenaman
Posts: 85
Joined: Sat Jul 09, 2005 6:03 am

Post by mbrenaman » Fri Aug 26, 2005 4:03 pm

Ha, no, I didn't notice that... I missed the whole .nsf itself actually, went straight for the .nes I noticed there are some sounds that happen when pushing A and B in the .nes file. Are these sounds going to be part of your game?
Kinda, the nes file is a test program for the sound stuff. Pressing A or B makes a test sound, Start resets the music, and Select stops it. The code is setup to play sound effects but only for one channel. That's why I made the test rom to make sure everything worked right, though those specific sounds might not be in my game.

tepples
Posts: 21843
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples » Fri Aug 26, 2005 5:07 pm

mbrenaman wrote:
About the period resed, I think you should avoid re-writing to $4003/$4007 during a note, exept if you want do this to have a grumble effect like Just Breed does. This cause problems for some vibratoes
So should I use the sweep unit to do my pitch changes?
If you write to $4002/$4006 every frame and then write to $4003/$4007 only when necessary, you'll get clicks only around a few pitches, those called A-0, B-0, D-1, F-1, A-1, D-2, A-2, and A-3 in NT2. If you want to make your pitch slides really smooth, try turning on the slide unit only when the period is about to cross a multiple of 256, so that you don't have to write to $4003 except on a new note. It's tricky, but it's probably doable.

User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg » Fri Aug 26, 2005 6:06 pm

tepples wrote:If you want to make your pitch slides really smooth, try turning on the slide unit only when the period is about to cross a multiple of 256, so that you don't have to write to $4003 except on a new note. It's tricky, but it's probably doable.


See the thread "Vibrato on square without phase reset" for demo code and a ROM that show exactly how to do this. I might look into modifying Soundy to do this if nobody else does.

User avatar
Bregalad
Posts: 7796
Joined: Fri Nov 12, 2004 2:49 pm
Location: Chexbres, VD, Switzerland

Post by Bregalad » Fri Aug 26, 2005 11:57 pm

blargg wrote: See the thread "Vibrato on square without phase reset" for demo code and a ROM that show exactly how to do this. I might look into modifying Soundy to do this if nobody else does.
Yeah, I just remembered that he's got one solution. However, it would work only if you don't use decay unit, sweep units and timelenght counters *at all* in your sound code. This should be okay since you're handling that stuff with software.
The common way to do this is effectively to write to $4002/6 anyway, but to be carefull to write only to $4003/7 if the value is different from the previous ones. This needs more variable, but this can be skipped for triangle and noise channels.
Else, the pitch slides would be okay because you'd write only once to the high frequencey register, and the clicks wouldn't be really noticable, but for vibratoes arround A, the period will *regulary* be reseted, and you'll have very noticable clicks. You can do as blargg says, or else, another fine method is just to xor the frequencey with 1 regulary. You'll be holding only little vibrato dephts, but the period will never be resseted, even with the infamous A2 note, that is $0fe (%000 - %1111'1110) on NTSC, and it definitely can't have depht more than one single step, else it would crunckle.
Yea, when I was a kid, I really loved the megaman series music. So you can see I've been watching those tunes in gnsf and kinda adapting the style.
When you was a kid ? I love it right now, personally :wink:
Actually, after comparing the two song more seriousely, I think if you would hack Megaman 2 to put your music insted of the original one in Bubbleman stage, nobody would notice it until the final part of the song that is a bit different, exept diehard megaman fans like probably a lot of people in there.
Life is complex: it has both real and imaginary components.

User avatar
mbrenaman
Posts: 85
Joined: Sat Jul 09, 2005 6:03 am

Post by mbrenaman » Sun Aug 28, 2005 8:20 am

Welp blargg, it seems to work. I've done some more work and added your solution and have uploaded a new version http://mbrenaman.com/soundy_1_1_0.zip. Works in Nintendulator, hope it'll work on the real thing.
When you was a kid ? I love it right now, personally
Actually, after comparing the two song more seriousely, I think if you would hack Megaman 2 to put your music insted of the original one in Bubbleman stage, nobody would notice it until the final part of the song that is a bit different, exept diehard megaman fans like probably a lot of people in there.
I meant that as that was the first time I heard it. I have my own NSF collection that I listen to at my computer. Of course, if anyone here found out I would be the subject of much reticule >ha ha<.

The tunes sound quite similiar indeed though. The difference's are mainly the key (mine - Ab, megaman 2 Bubbleman tune - Eb) and the format of part C. Did I do it on purpose, yes... But it came out more similiar then I expected >hehe<..

Anyways, thanks everyone.

User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg » Sun Aug 28, 2005 10:54 am

I realized that the new sweep code will prevent sound effects from using the sweep unit. The other limitations aren't a problem for the music driver, but I think this might be since sweeps are very useful for sound effects.

I also found a problem with the NSF, due apparently to the assembler generating bad code (nasty!). I've reported the details privately.

User avatar
Bregalad
Posts: 7796
Joined: Fri Nov 12, 2004 2:49 pm
Location: Chexbres, VD, Switzerland

Post by Bregalad » Sun Aug 28, 2005 12:31 pm

Cool ! This is great if that method was successfull ! I'm gonna to use it someday, and I've now no reason to stay away from vibratoes/slides in the next sound code I'll write. However...
I ask myself why you said #$0f would be written in the sweep units when not wrapping around freq for vibratoes. I understand that the bit 7 should be clear, but scince it's clear the sweep units are totally disabled and have no effect, exept for limited frequency below very small periods (that would be dog whistle or somthing), and bit 3 should be set (down2up sweep) if a frequencey period above $3ff is used (if the 11th bit is set), else the sweep unit will disable the channel when a high period is deteced in up2down mode, even if disabled.
However, writing $08 or $0f shouldn't make any difference, or does it ?
Also, does writing $40 or $c0 to $4017 while clocking the sweep units manyally make any difference ? And when not clocking them, what should it be written to ?

About the sound effects, it's sure the big flaw of this method. All hardware stuff is used to :
- Timelengt conter : Only few games uses it, and it can be done very easily with software, and it can be 100% replaced by software, scince it has a one-frame precision, and scince one APU frame is more or less the same than one PPU frame, it'll have the exact same precision.
- Triangle timer : This timer feathures more precision, (1/4 of an APU frame or am I wrong ?), so it can't be 100% replaced by software. I think a programm that would write every frame a timing value between $1 and $3 in the timer register, the result will be 1/4, 1/2 and 3/4 of a frame (from now I'll cale frame both PPU frame and APU frames, scince I'll consider them to be equivalent), so it can be shorter and make special "buzzy" sound effects. However, I'm not very sure of this.
- Decay unit : This one has sure few precision and I'm sure the software can 100% replace all it's features, with one-frame precision.
- Sweep unit : Here you are where the big problem is. I think the sweep units in slow rates can be easily replaced with software, that allow more precision while sweeping so it's definitely better. But, with very fast value, it's able to refresh the frequencey at 1/2 frame percision, which isn't negligable while doing gruble sound effects and this is probably pretty much needed for a game that would have better SFX than just beeps and bleeps. This allow very fast frequencey variations, and eventually make dynamic and cool effects. I'm very unsure on what would be the best results without using them. Maybe the same precision could be reached if the sound code would be triggered twice per frame : One time with the PPU's NMI, and one time with a frame IRQ. However, scince $4017 is manually clocked, the frame IRQ couldn't work as we wan't it to, so scanline IRQ would be needed.
Any comment/corrections/ideas, blargg ?
Life is complex: it has both real and imaginary components.

User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg » Sun Aug 28, 2005 3:32 pm

I've posted my reply to the thread "Vibrato on square without phase reset", since your questions are about the technique rather than the Soundy driver.

User avatar
mbrenaman
Posts: 85
Joined: Sat Jul 09, 2005 6:03 am

Post by mbrenaman » Mon Aug 29, 2005 1:19 am

Well, thanks to blargg, Soundy's been tested on the real NES. I fixed two small bugs and viola http://mbrenaman.com/soundy_1_1_2.zip

And I suppose that's it. Thank you everyone and I'll thank blargg just one more time.

User avatar
dXtr
Posts: 375
Joined: Tue Sep 21, 2004 12:11 am
Location: Karlshamn (Sweden)

Post by dXtr » Mon Aug 29, 2005 3:07 am

mbrenaman > don't know if this is an bugg or not.. but if you push the A and B buttons repeatedly really fast you can make the sounds get stuck. it's easiest to do it when the music is off.
Sorry for misspellings, I'm from Sweden ^^

User avatar
mbrenaman
Posts: 85
Joined: Sat Jul 09, 2005 6:03 am

Post by mbrenaman » Mon Aug 29, 2005 8:40 am

mbrenaman > don't know if this is an bugg or not.. but if you push the A and B buttons repeatedly really fast you can make the sounds get stuck. it's easiest to do it when the music is off.
Oh man... Sorry about that. Thanks for trying it out. I thought I had fixed it. It should be fixed now plus sounds should also not hang during the transition from music on to music off.

The fixed version is at the same link as above.

EDIT : Darn it, nevermind. I just remembered to try during the transition from music off to on and it screwed up abit.

Post Reply