SPC700 help

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Post by mic_ »

I'd suggest disabling echo, clearing the ADSR registers, setup the gain registers / master volume for a constant volume, setting up the sample source dir, the pitch register, clear KOF, set KON.
wiiqwertyuiop
Posts: 19
Joined: Tue Apr 17, 2012 8:30 am

Post by wiiqwertyuiop »

ok i think im getting closer the only problem i have now is that sound effects constantly play,is there some way to make them stop after a bit (I guess using a timer?).
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Post by mic_ »

Either use a timer to key the channel off, or mark the BRR sample as non-looped if it's a one-shot sound (e.g. an explotion/scream/etc).
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

Have you even read my long post ?
I explained how you need to have a routine that is called regularly, and one of the first things you should do is to deal with key on, key off and pitches.
Useless, lumbering half-wits don't scare us.
wiiqwertyuiop
Posts: 19
Joined: Tue Apr 17, 2012 8:30 am

Post by wiiqwertyuiop »

Yes I read it now and it helped me very much, thank you.

Ok I got the sound effect to stop after a certain amount of frames and everything seems to work fine.... but now the sound effect plays too quietly and im not sure why. I have the master volume (left and right) set to #$7f and the volume for the voice at #$7f as well yet I can barely hear it. Here is my current code.
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

I think it's a problem with the enveloppe. It looks like you write 0, 0, 0 to enveloppe regs which should normally not work (in fact its weird if you hear sound with this settings, this should result in silence !)

You should write 0xFF to ADSR1 and 0xE0 to ADSR2 to have no enveloppe (sustain at max value forever). In this setting the value in GAIN have no effect.

Alternatifely you could write 0x00 to ADSR1, and 0x7F to GAIN, to directly force the enveloppe to 0x7F. Both should be completely equivalent.
Useless, lumbering half-wits don't scare us.
wiiqwertyuiop
Posts: 19
Joined: Tue Apr 17, 2012 8:30 am

Post by wiiqwertyuiop »

Er.. sorry for all the questions... but now channel 3 seems to cut in and out when I activate it for some reason. None of the other channels seem to do this and I have all the channels set the same way. Here is my current code. Thanks!
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Post by mic_ »

I don't see anything in your SPC code that prevents processing the same command over and over. Does your code on the 65816 side write zero to the communication port a while after sending a "START CHANNEL X" command?
wiiqwertyuiop
Posts: 19
Joined: Tue Apr 17, 2012 8:30 am

Post by wiiqwertyuiop »

mic_ wrote:I don't see anything in your SPC code that prevents processing the same command over and over. Does your code on the 65816 side write zero to the communication port a while after sending a "START CHANNEL X" command?
Yes, all im doing is making the channel stay active for as long as im holding a button, but for some reason when I hold up (which activates channel 3) it cuts in and out while the other ones don't.
KungFuFurby
Posts: 264
Joined: Wed Jul 09, 2008 8:46 pm

Post by KungFuFurby »

Try using a different button to activate channel 3... sometimes it ends up being on the SNES end that causes a hiccup (or it could be your keyboard). Either that, or make sure your auto-fire is completely off (you may have accidentally activated it for the up key).
wiiqwertyuiop
Posts: 19
Joined: Tue Apr 17, 2012 8:30 am

Post by wiiqwertyuiop »

Um... sorry if this is considered a bad bump...

After taking a break from this for a while and working on some other things I decided to try to make a functional sound engine, I first wanted to start off with just playing sound effects so I wrote this:

http://www.pastebay.net/1069545

and when i try to play it in snes9x it makes some short sounds but never plays the whole things, and i get nothing in bsnes! Getting rid of the second:

Code: Select all

mov $f2, #$4c   ;\
mov $f3, #$00   ; | Turn off all voices
mov $f2, #$5c   ; |
mov $f3, #$FF ;/
plays the whole thing but only once and still nothing in bsnes! So yeah any help would be great!
Jsolo
Posts: 27
Joined: Mon Jun 27, 2011 4:14 am
Location: Lurker Cave

Post by Jsolo »

A channel that has KOFF=1 (and does not play any sound yet) is effectively muted and will be put into release state immediately after it has been turned on; try clearing the KOFF bit for channel 0 before toggling KON.
Furthermore, you don't need to write 1 to KOFF at all; writing $FF to KOFF once at startup puts all channels into release state.
wiiqwertyuiop
Posts: 19
Joined: Tue Apr 17, 2012 8:30 am

Post by wiiqwertyuiop »

Ok thanks, i think im getting closer now. The sounds play correctly in snes9x, but in bsnes I get this loud beeping sound and I don't know why. Here is the code im using:

http://www.pastebay.net/1069601
wiiqwertyuiop
Posts: 19
Joined: Tue Apr 17, 2012 8:30 am

Re: SPC700 help

Post by wiiqwertyuiop »

Does anyone have any ideas?...

If not, does anyone know of a working SPC engine I can study (Preferably one with comments :P)?
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Re: SPC700 help

Post by Shiru »

You can check out my engine from Christmas Craze sources (spc700.asm).
Post Reply