Sound driver fun

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
User avatar
Movax12
Posts: 541
Joined: Sun Jan 02, 2011 11:50 am

Re: Sound driver fun

Post by Movax12 »

Wordpad.exe can handle both types of newlines.
User avatar
Augustus Blackheart
Posts: 61
Joined: Sat Jul 26, 2014 9:50 am

Re: Sound driver fun

Post by Augustus Blackheart »

tepples wrote:For use as a programmers' text editor, Microsoft did update Notepad. It's called Visual Studio Code.

I'd like to see a tutorial on how to best set up Notepad++ or your other favorite Windows text editor.
I still think since Notepad is the default text editor that it should know what to do with LF.

Thankfully, I haven't had to use Windows in awhile, but I will be forced to in a couple of months. I already know I'll be annoyed by how changing the colors used for the GUI doesn't fully apply to each and every application.

I'll let you know what I end up using for text editing.
KungFuFurby wrote:Some of my older psuedo-SNES songs actually use Ixy (normally I improvise with volume envelopes, but it would be neat to see that actually get implemented).
I'd be interested in hearing any songs which use this command.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: Sound driver fun

Post by psycopathicteen »

How do you get an .spc file to actually play in a game?
User avatar
Augustus Blackheart
Posts: 61
Joined: Sat Jul 26, 2014 9:50 am

Re: Sound driver fun

Post by Augustus Blackheart »

psycopathicteen wrote:How do you get an .spc file to actually play in a game?
The necessary files are in smconv which is linked to in the first post.
User avatar
Augustus Blackheart
Posts: 61
Joined: Sat Jul 26, 2014 9:50 am

Re: Sound driver fun

Post by Augustus Blackheart »

Is anyone interested in having the following added to SNESMod?

Code: Select all

S9? ~ zmode filter sweep evol/delay
      > default EVOL < 80h: set evol_max [default 40h]
      80h: Turn off EVOL sweep
      81h-0ffh: Set delay between filter changes (-80h)
S9? ~ zmode noise freq/min filter sweep evol
      00-1eh: Set minimum noise freq during noise freq sweep
      1f: set Noise freq sweep mode to single decrease [default]
      20: set Noise freq sweep mode to ping pong
      21h-7ch: Set minimum band pass DSP_C0 [default 34h]
      80h-ffh: Set minimum echo volume for filter sweeps (-80h) [default 20h]
S9? ~ zmode filter sweep
      00: Disable filter sweep
      01: Sweep to bandpass filter one shot
      02: Sweep to bandpass filter ping pong
      03: Sweep to lowpass filter one shot
      04: Sweep from bandpass filter one shot
      05: Sweep from bandpass filter ping pong
      06-ffh: Delay before changing filter coefficients [default 80h]
* no noise freq sweep increase (yet)
* noise freq sweep values currently use S5x command
* need to find other ways set these values that don't conflict with exisiting .it commands (maybe something like S4[3-f] also sets parameters)
* negative values for filter sweep echo volume not supported.
* I didn't spend anytime thinking about how to set this up, I just did the first thing I thought of, so maybe there's a better way to handle the coefficent changes that would allow for more options while still avoiding overflows.

I also have a command (currently sacrificing the ability to set the master volume with negative values) which decreases the master volume while increasing the echo volume (old mvol value becomes vol value and minimum mvol value can be 0-7eh)

Bug wise the tempo and envelope processing for note delays are fixed.

Anyway, mostly wanted to see if adding any of this would be useful for anybody before moving on to smconv and adding in any other features.
User avatar
Augustus Blackheart
Posts: 61
Joined: Sat Jul 26, 2014 9:50 am

Re: Sound driver fun

Post by Augustus Blackheart »

I updated the first post with a link to the latest smconv, drivers and examples.
User avatar
Augustus Blackheart
Posts: 61
Joined: Sat Jul 26, 2014 9:50 am

Re: Sound driver fun

Post by Augustus Blackheart »

Whoops, SPC creation is broken for SuperSNESMod under some circumstances (I haven't done enough testing yet to determine why it's happening). With a couple of songs I've managed to crash SPCTool2 and OpenSPCLite. AudioOverload doesn't crash but bad things happen soundwise. Other songs work fine so I'm assuming it's some specific command that's causing issues. Soundbanks work fine.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: Sound driver fun

Post by psycopathicteen »

How are you doing filter sweeps?
User avatar
Augustus Blackheart
Posts: 61
Joined: Sat Jul 26, 2014 9:50 am

Re: Sound driver fun

Post by Augustus Blackheart »

Actually, it appears the SPC file itself is fine as putting it into a ROM causes no issues. It has always worked on real hardware and every emulator I've tried.

The current code slowly increases or decreases several echo filter coeffcients based on a short user specifed delay until it reaches specific hard coded values. It also, optionally, increases or decreases the echo volume as it does so. Before I start working to isolate the issue I'm going to try some other players. What are people using to play SPCs?
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: Sound driver fun

Post by 93143 »

Augustus Blackheart wrote:The current code slowly increases or decreases several echo filter coeffcients based on a short user specifed delay until it reaches specific hard coded values.
That sounds almost exactly like something I was going to try so as to get a phaser effect (far down the road, of course; I've done essentially no SPC700 programming as yet)...

I really need to read through the source code at some point and see how Super SNESMod does what it does.
What are people using to play SPCs?
Winamp, using this: http://alpha-ii.com/Download/Main.html#SNESamp
Also this (standalone Windows): http://dgrfactory.jp/spcplay/index.html

EDIT: Avast is blocking the downloads on that Japanese site (the second link). I'd assume it's a false positive, but I can't be certain. Way old version (with English translation) here: http://www.smwcentral.net/?p=section&a=details&id=4616
User avatar
Augustus Blackheart
Posts: 61
Joined: Sat Jul 26, 2014 9:50 am

Re: Sound driver fun

Post by Augustus Blackheart »

93143 wrote:
Augustus Blackheart wrote:The current code slowly increases or decreases several echo filter coeffcients based on a short user specifed delay until it reaches specific hard coded values.
That sounds almost exactly like something I was going to try so as to get a phaser effect (far down the road, of course; I've done essentially no SPC700 programming as yet)...

I really need to read through the source code at some point and see how Super SNESMod does what it does.
Yeah, it's not the best code at the moment but it works. I have some ideas to improve it. The main concern is ensuring avoiding overflows with the coefficents.
93143 wrote: Winamp, using this: http://alpha-ii.com/Download/Main.html#SNESamp
Also this (standalone Windows): http://dgrfactory.jp/spcplay/index.html
All the SPC files that crashed the other players play perfectly in SPCPlay. I've emailed the author of AudioOverload to let him know about the issues with his player. It looks like OpenSPC Lite has been abandoned(?), since there's source available perhaps I'll add it to my list of projects (it doesn't support pitch modulation... what?).

In case anybody is interested in testing this issue with other SPC players, the file pause.spc is one of the files that crashes SPCTool2, OpenSPC Lite and causes mayhem--and sometimes crashes--AudioOverload. The file is in the example directory of the smconv link in the first post.
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: Sound driver fun

Post by KungFuFurby »

This reminds me of Shin Togenkyo, which did the same thing.

Here are my results...

Game Music Box ~ Fails after a few seconds (just like Shin Togenkyo)
Audio Overload 1.5 ~ Sticks on the first note (Shin Togenkyo worked)
Audio Overload 2.0 ~ Fails just like Shin Togenkyo (causes glitched audio)
vspcplay (I manually compiled a version originally ported/fixed up by bazz... the pre-compiled version gave me an Illegal Instruction error) ~ Doesn't even play (the PC constantly reads $FFCF... huh) (Shin Togenkyo worked, but accidentally missed the first note)
PSF/SPCPlay (command line application for Mac OS X) ~ Works perfectly (uses libopenspc++ if you're curious)

I do know of a few things that may have caused these SPC players a headache...
- Shin Togenkyo may have accidentally used memory wraparound for its stack.
- Memory wraparound was also not handled when it came to addressing if I remember correctly. In SNESMod's case, that was great for me, because I could catch myself if I failed to initialize the instruments in a .it file. In other player's cases (including the real deal), you'd get everything playing the wrong instrument.
- Are register wraparounds also implemented? Hmm... this one I didn't test.
User avatar
Augustus Blackheart
Posts: 61
Joined: Sat Jul 26, 2014 9:50 am

Re: Sound driver fun

Post by Augustus Blackheart »

KungFuFurby wrote:This reminds me of Shin Togenkyo, which did the same thing.

Here are my results...

Game Music Box ~ Fails after a few seconds (just like Shin Togenkyo)
Audio Overload 1.5 ~ Sticks on the first note (Shin Togenkyo worked)
Audio Overload 2.0 ~ Fails just like Shin Togenkyo (causes glitched audio)
vspcplay (I manually compiled a version originally ported/fixed up by bazz... the pre-compiled version gave me an Illegal Instruction error) ~ Doesn't even play (the PC constantly reads $FFCF... huh) (Shin Togenkyo worked, but accidentally missed the first note)
PSF/SPCPlay (command line application for Mac OS X) ~ Works perfectly (uses libopenspc++ if you're curious)
Thanks for checking. Here's what I did to fix it:

The first four lines of FilterSweep are as follows:

Code: Select all

	inc	current_filter_time
	cmp	filter_time, current_filter_time
	bne	skip_filter_sweep
	mov	current_filter_time, #0
Here's the relevent part of main_loop before:

Code: Select all

	cmp	filter_sweep, #0
	beq	main_loop
	SPROC
	call	FilterSweep
skip_filter_sweep:
...and after:

Code: Select all

	cmp	filter_sweep, #0
	beq	main_loop

	inc	current_filter_time
	cmp	filter_time, current_filter_time
	bne	skip_filter_sweep
	mov	current_filter_time, #0

	SPROC
	call	FilterSweep
skip_filter_sweep:
Moving those first four lines in FilterSweep to main_loop was all it took to fix the issue.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: Sound driver fun

Post by psycopathicteen »

Anybody had the idea of implementing flanging? I think it could be done by manually shifting the echo memory by variable amounts. I'll test it out with Bad Apple.
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: Sound driver fun

Post by KungFuFurby »

Your SNESMod has a bug that I had fixed (and got incorporated into an actual updated version of SNESMod)...

The bug that occurs has to do with loading sound effects. It happens when loop points go bad and cause the carry flag to accidentally get set, resulting in the sample pointers to be out of alignment by one byte. Here's what I speak of...

Code: Select all

;********************************************************
CMD_LOADE:
;********************************************************
	mov	a, xfer_address
	mov	y, next_sample
	mov	!EffectDirectory+y, a
	clrc
	adc	a, SPC_PORT2
	mov	!EffectDirectory+2+y, a
	
	mov	a, xfer_address+1
	mov	!EffectDirectory+1+y, a
	
	adc	a, SPC_PORT3
	mov	!EffectDirectory+3+y, a
	
	clrc				; safety clear for invalid loop points (thanks KungFuFurby)
	adc	next_sample, #4
	call	StartTransfer
	
	jmp	CommandRet
A clrc is added there because I discovered the bug during the development of MazezaM Challenge in 2012 (one of the songs I made managed to accidentally break the SFX under one condition), and adding the clrc opcode fixed the bug. This was actually the very first successful modification I made to SNESMod, and it was for bugfixing purposes. I actually sent the revision I made to the original developer, given the sound driver's original purpose was to play music and sound effects.
Post Reply