It is currently Thu Jul 20, 2017 7:51 pm

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 43 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Sound driver fun
PostPosted: Thu Jul 30, 2015 10:04 am 
Offline

Joined: Sat Jul 26, 2014 9:50 am
Posts: 48
Code:
=pitchmod-1.2 only
M7F ~ Use direct gain mode for the current channel [default]
M80-FF ~ Enable ADSR for current channel and set the attack and decay rate (%Adddaaaa)
Z00-FF ~ Set sustain rate and level for the current channel (%rrrlllll)

=supernofx-0.4 current commands=
S01 ~ Turn on echo for channel
S02 ~ Turn off echo for channel
S03 ~ Turn on echo for all channels
S04 ~ Turn off echo for all channels
S05 ~ Turn on pitch modulation for one channel
S06 ~ Turn off pitch modulation for one channel
S07 ~ Turn on pitch modulation for all channels
S08 ~ Turn off pitch modulation for all channels
S09 ~ Turn on noise generation for one channel
S0A ~ Turn off noise generation for one channel
S0B ~ Turn on noise generation for all channels
S0C ~ Turn off noise generation for all channels
S0D ~ Reset echo delay
S0E ~ Reset echo volume
S0F ~ Reset echo feedback

S1x-S2x ~ Noise frequency (-10h to get your frequency, applies to all channels that have noise enabled). These commands also disable the noise frequency sweep.

S30/S40/S50 ~ Set vibrato/tremolo/panbrello waveform to sine [default]
S31/S41/S51 ~ Set vibrato/tremolo/panbrello waveform to ramp down
S32/S42/S52 ~ Set vibrato/tremolo/panbrello waveform to square
S33/S43/S53 ~ Random not implemented
S34 ~ Set vibrato/tremolo/panbrello waveform to triangle
S35 ~ Set vibrato/tremolo/panbrello waveform to ramp up
S36 ~ Set vibrato/tremolo/panbrello waveform to square 2

S37 ~ Disable echo writes
S38 ~ Enable echo writes

S39 ~ Reset EFIR, master volume, echo volume, echo feedback, and echo delay to default in song message
S3A ~ Set/sweep EFIR to $7f,$00,$00,$00,$00,$00,$00,$00 sweep if zmode is set to channel filter sweep
S3B ~ Set/sweep EFIR to $34,$33,$00,$d9,$e5,$01,$fc,$eb
S3C ~ Set/sweep EFIR to $58,$bf,$db,$f0,$fe,$07,$0c,$0c
S3D ~ Set/sweep EFIR to $0a,$17,$23,$29,$12,$fe,$f3,$f9
S3E ~ Set/sweep EFIR to $f8,$08,$11,$1c,$1c,$11,$08,$f8
S3F ~ Set/sweep EFIR to $0d,$22,$22,$24,$11,$f0,$03,$ff

S44 ~ EVOL sweep max -> min
S45 ~ EVOL sweep min -> max
S46 ~ Enable swing tempo (Use S9D, ZF1-FF for different speeds. The default is 1.)
S47 ~ Disable swing tempo [default]
S48 ~ Enable duty cycle. This replaces Sample 1 with the duty cycle samples. Sample 1 length should be 16 samples
          and 8372 Hz.
S49 ~ Disable duty cycle [default] It is not possible to restore the original sample at this time.
S4A ~ Noise frequency increase
S4B ~ Noise frequency decrease [default]
S4C ~ Noise frequency repeat on
S4D ~ Noise frequency repeat off [default]
S4E ~ Noise frequency ping pong on
S4F ~ Noise frequency ping pong off [default]

S5[4-F] ~ Noise frequency sweep starting at 14h-1Fh; set ending value with S9D, Z24-Z2F
                (This is a shortcut for S9D, Z14-Z1F)

S91 ~ Surround sound
S92 ~ Mute channel
S93 ~ Unmute channel
S96 ~ Set ZMODE to channel filter sweep and reset EDL, EFB, EFIR, EVOL, and disable any active filter sweeps first.
S97 ~ Set ZMODE to channel filter sweep
S98 ~ Zmode: EFIR; z80 reset all coefficients to default; all other set efir channel = coefficient
S99 ~ Zmode: MVOL; z80 reset MVOL (default defined in src code); all other set MVOL
S9A ~ Zmode: EVOL; set echo volume
S9B ~ Zmode: EFB; set echo feedback

S9C ~ Zmode: EDL/special
      Z[0-F] ~ Set echo delay
      Z10 ~ Reset EFIR/MVOL/EVOL/EFB/EDL
      Z11-4F - Set delay between duty cycle update [(xxh-10h)*4]

S9D ~ Zmode: set noise frequency/echo volume speed
      Z00-1F - Noise frequency
      Z20-3F - Set minimum noise frequency value [-20h]
      Z40-5F - Set maximum noise frequency value [-40h]
      Z60 - Disable noise frequency sweep [default]
      Z61-D9 - Set noise frequency sweep speed
      ZDA - Noise frequency increase
      ZDB - Noise frequency decrease [default]
      ZDC - Noise frequency repeat on
      ZDD - Noise frequency repeat off [default]
      ZDE - Noise frequency ping pong on
      ZDF - Noise frequency ping pong off [default]
      ZE0 - Disable echo volume sweep
      Z[E1-EF] - Enable echo volume sweep with speed x [default 1]
      ZF0 - Disable swing tempo
      ZF1-FF - Enable swing tempo; mod_speed+x-F0h, mod_speed [default 1]

S9E ~ Zmode: Set minimum echo volume/set maximum echo volume
      Z[00-7F] - Set minimum echo volume for filter sweep [default 20h]
      Z80 - Turn off echo volume sweep
      Z[81-FF] - Set maximum echo volume for filter sweep [-80h, default 40h]

S9F ~ Zmode: Filter sweep delay
      Z[00-FF] - Delay before changing filter coefficients (default 80h)

[TODO] ??? ~ Turn on phase inversion (Volume = Volume - 1 EOR FF)
[TODO] ??? ~ Turn off phase inversion
[TODO] ??? ~ Turn on phase inversion all
[TODO] ??? ~ Turn off phase inversion all
[TODO] ??? ~ Zmode direct gain
[TODO] ??? ~ Set pitch modulation control to Modify Direct Gain (Direct Gain = Originally Intended Volume, and Volume = 7Fh)
[TODO] ??? ~ Set pitch modulation control to Do Not Modify Direct Gain (Direct Gain = 7Fh)

Super SNESMod TODO:
* ability to toggle stereo/mono
* pitchmod direct gain on/off
* fix tempo command/frst tick bug

SMCONV TODO:
* Get increase in maximum number of available patterns, samples, and instruments working
* The original smconv over reported the available ram (if lots of volume envelopes are used) and this updated version over reports the available ram by a tiny bit. Need to report the *actual* ram available.
* Get rid of the pattern break command. If SMCONV encounters it just changes the pattern length. This will save 11 bytes in the sound driver and depending on how often the command was used in a song it could free up many bytes.
* Export sample list


What's new:
Added examples (IT & SPC) for ADSR [Pitchmod] and duty cycle sweep [Super SNESMod]

Current smconv :: all source with SNESmod, Pitchmod, Super SNESMod (this one is not ready yet), and Super SNESMod NoFX drivers. (updated January 2017:: no Windows binary yet.)

11 songs


Attachments:
File comment: Tremolo test
tremolo-test.sfc [128 KiB]
Downloaded 78 times
File comment: Example ROM
supersnesmod.sfc [256 KiB]
Downloaded 93 times


Last edited by Augustus Blackheart on Mon Feb 20, 2017 10:02 pm, edited 43 times in total.
Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Thu Jul 30, 2015 3:17 pm 
Offline

Joined: Wed Jul 09, 2008 8:46 pm
Posts: 233
Filesize-wise, I kept everything below 5632 bytes. Anything bigger, and you're forced to modify the SNESMod compiler application and the source code to deal with the change (I stopped just 10 bytes short of having to do this)... and for me, I wanted to just simply implant the code using a hex editor.

The glitch that I mentioned deals with noise generation and SFX (pitch modulation might technically count, too).

I really don't like the idea of overwriting existing IT tracker effects (that makes things worse for me to test when composing in Schism Tracker, as I have no way to disable those effects, which means my pre-conversion testing can seriously get hampered). I prefer either unused effects in Impulse Tracker (either that, or I prefer implementing the original effects)... I did S0x-S3x for that reason, and I did S9x, too.

I actually had the following ideas for extra features (from 2013, actually), but I stopped short because I would have to modify the compiler source code to reallocate the module files due to memory consumption (and some of these are brand new, literally conjured up right on cue):

S94 ~ Turn on phase inversion for one channel (Volume = Volume - 1 EOR FF)
S95 ~ Turn off phase inversion for one channel
S96 ~ Turn on phase inversion for all channels
S97 ~ Turn off phase inversion for all channels
S98 ~ Set Zxx Mode to Direct Gain
S99 ~ Set Zxx Mode to FIR Filter Coefficients
S9A ~ Set Zxx Mode to Master Volume
S9B ~ Set Zxx Mode to Echo Volume (this one's new... and it's supposed to be a substitute for overwriting an Impulse Tracker effect)
S9C ~ Set Zxx Mode to Echo Feedback (this one's new... and it's supposed to be a substitute for overwriting an Impulse Tracker effect)
S9D ~ Set Zxx Mode to Echo Delay/Special (this one's new... and it's supposed to be a substitute for overwriting an Impulse Tracker effect)
S9E~ Set pitch modulation control to Modify Direct Gain (Direct Gain = Originally Intended Volume, and Volume = 7Fh)
S9F~ Set pitch modulation control to Do Not Modify Direct Gain (Direct Gain = 7Fh)

Zxx ~ Set Parameter
If Zxx Mode is set to Direct Gain, then the corresponding channel's direct gain will be modified as such. This can become a Custom Gain if the value is above 7F. Unfortunately gain is not tempo-sensitive... and it doesn't care about volume.
If Zxx Mode is FIR Filter Coefficients than the corresponding channel will modify the corresponding coefficient (either that, or an alternative implementation is that you could link to an array that contains a list of FIR coefficent parameters, provided by the song message... but please don't go out of bounds if this implementation is selected).
If Zxx Mode is Echo Volume, then odd channels modify left echo volume, and even channels modify right echo volume.
If Zxx Mode is Echo Delay/Special, then...
- 00h restores all parameters to original settings
- 01h-0Fh sets the delay (but only up to the original value specified in the module... if you want to go further, then set your default rate higher.)
- 10h resets the FIR coefficients to the module's default settings
- 11h resets the echo volume to the module's default settings
- 12h resets the echo feedback to the module's default settings
- 13h disables echo writes. This essentially means your echo buffer plays nothing but looped audio.
- 14h re-enables echo writes.
- I haven't decided on 15-FF yet.

Warning: You must set the Zxx mode first, or else you'll get an undefined effect.
Warning 2: Echo delay has a semi-delayed effect on the song due to the way the hardware processes the echo.


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Thu Jul 30, 2015 4:56 pm 
Offline

Joined: Sat Jul 26, 2014 9:50 am
Posts: 48
That's a great point about IT tracker effects, I never had to think about that before because I use an XM tracker. That should definately be changed.


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Fri Jul 31, 2015 11:38 am 
Offline

Joined: Sat Jul 26, 2014 9:50 am
Posts: 48
I've got the sample directory starting at 0100h and the program at 0300h for the extended pitchmod spc program. I've changed it2spc.cpp and include/snesmod.asm to reflect this change*. Everything works fine in ROM and as an SPC file. Is there any reason why 0100h-01ffh shouldn't be used?

One of the things that I've never gotten around to, but have been meaning to work on, is adding a command line option to SMCONV to select between the various spc programs. So, that's something I'll add soon.

*The original SNESMOD and Pitchmod spc programs are still using the orginal addresses.


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Fri Jul 31, 2015 12:50 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 18650
Location: NE Indiana, USA (NTSC)
Augustus Blackheart wrote:
I've got the sample directory starting at 0100h [...] Is there any reason why 0100h-01ffh shouldn't be used?

Stack pointer starts at $01EF and grows down. Too many nested subroutine calls will blow up your sample directory.


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Sat Aug 01, 2015 11:41 am 
Offline

Joined: Sat Jul 26, 2014 9:50 am
Posts: 48
tepples wrote:
Stack pointer starts at $01EF and grows down. Too many nested subroutine calls will blow up your sample directory.


D'oh! I probably should have read a doument on the SPC or something. I figured that it was programmed that way for a reason. Everything has been put back in it's proper place.

KungFuFurby, what about using S0D, S0E, S0F to reset delay, echo and feedback to the default settings. S00 could possibly reset delay, echo and feedback, or reset the FIR coefficients.

It's up to 5679 bytes right now but I haven't implemented the following yet: phase inversion, direct gain Zxx mode, FIR coefficients Zxx mode, pitch modulation control to modify/not modify direct gain, disable echo writes, and enable echo writes. Zxx mode echo volume sets the actual echo level right now and doesn't have odd channels modify left echo volume, and even channels modify right echo volume.


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Sun Aug 09, 2015 5:50 pm 
Offline

Joined: Wed Jul 09, 2008 8:46 pm
Posts: 233
Quote:
S0D ~ reset echo delay (alternately, this could be disable echo writes)
S0E ~ reset echo volume (alternately, this could be enable echo writes)
S0F ~ reset echo feedback


I'll accept these changes and move Z13-Z14 to Z11-Z12 since now there's nothing there.

May as well call this big featureset "Super SNESMod" for what it's doing right now.

As of your current version (0.4)...

- Master volume can go past 7Fh... but they'll all be negative values. You can omit the check to save some bytes... just make sure to indicate that you'll get negative volume values if you go past that value.

- I actually wanted to have echo volume be applied without scaling via the master volume (Zxx can help with that by enabling and disabling the scaling). I have a special effect that I could use that involves fooling around with FIR coefficients, setting the EDL as low as possible for smooth transitions, zeroing out the feedback and master volume (without zeroing out the echo volume)... and you'll get filtering on the entire sound output.

- MODULE can be a dynamically changing variable that can also be not divisible by $100. Simply pre-compile the SPC700 source code (with MODULE being essentially a pointer to the end of the current source code... I think that converts OK for TASM), and have SMCONV make its pointers based off of which version you choose.

The following are bugs/concerns from the original SNESMod:

- Fast linear increase is never executed due to multiplication limitations. Volume only ever gets to 7E rather than 7F. This is because of a series of three multiplication operations, none of them skipped, that turns FF into FD, which in turn results in the rather unusual maximum.

- Envelope processing is improperly handled with note delays: they are not delayed with the note, and the previous envelope appears to get frozen in their tracks.

- Envelopes are reset with note slides regardless of whether they finished or not. That's not natural tracker behavior if I remember correctly... I did take advantage of this bug once, though, but I prefer mine not reset.

- The tempo change command can accidentally cause the first tick to come around much later than expected. Most commonly, this is because it's not in the first channel, at least when I noticed it.

- Why is tempo limited to 200? I understand why a lower limit of 80 is mandatory, but tempo can go all the way up to 255, and the timer is able to go that fast.

- Tempo ticks need to be recalibrated. SNESMod's timing, compared to Schism Tracker, is off by (current tempo - 3). This is best indicated when using samples that are timing sensitive to go smoothly, drumbeat samples in particular.

- Ultra low pitches produce glitched values instead of actual low value. Yes, I was crazy enough to go that low with the pitch.

The following are bugs of my original modifications:

- Noise and pitch modulation are not safe with SFX. Echo is in the same boat, but it is not as serious.

Your current version concerns me in the following fashion:

- The way your Zxx code is executed looks quite fatal to SNESMod's standard. That's because the X register is reserved for the channel ID. I would recommend saving the accumulator in m0 (which is fully open in this case), get the parameter mode, then

Also, where did your smconv and snesmod_dev.asm files go? They were here previously...


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Thu Aug 13, 2015 5:10 pm 
Offline

Joined: Sat Jul 26, 2014 9:50 am
Posts: 48
KungFuFurby wrote:
As of your current version (0.4)...

- Master volume can go past 7Fh... but they'll all be negative values. You can omit the check to save some bytes... just make sure to indicate that you'll get negative volume values if you go past that value.

...

Your current version concerns me in the following fashion:

- The way your Zxx code is executed looks quite fatal to SNESMod's standard. That's because the X register is reserved for the channel ID. I would recommend saving the accumulator in m0 (which is fully open in this case), get the parameter mode, then


Thanks, I didn't get all the changes from my other version into this one. I've updated it now.

Quote:
Also, where did your smconv and snesmod_dev.asm files go? They were here previously...


I'll add new versions to the first post as soon as I test the latest code. I've only tested the version which uses unimplemented impulse tracker commands for setting all of these features.


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Sat Sep 12, 2015 2:28 pm 
Offline

Joined: Sat Jul 26, 2014 9:50 am
Posts: 48
I've added a version with all sfx streaming code removed.

Also, what would be a good option for commands to handle filter sweeps?

I could use z01-05 (which would require an additional S9x command to enable this mode) for different types of filter sweeps and values higher than that could set the delay between each change. I would also need a way to avoid overflows. I've done this so far by hardcoding the values and adding addtional delays for some of the coefficients.

I'm starting to run out of commands to use. What about repurposing the Tremor command. Does anybody actually use that?

Anyway, for anybody who is interested I made my tracker have an SNESMOD option so if I'm tracking for the SNES it shows me what the commands do and when enabled the tracker ignores SNESMOD specific commands on playback. This lets me use way more commands (at the expense of compatibility should I want to use the mod for some other purpose; then again there are already issues when pitch modultion is used).

I suppose at this point I should add spc700 emulation to the tracker.


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Sat Sep 12, 2015 3:21 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 18650
Location: NE Indiana, USA (NTSC)
I think I've used the tremor command once or twice years ago, but I forget in which song. Or maybe it was retrigger.


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Sun Sep 13, 2015 5:33 am 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2194
Looked at the asm file and I can't read it because there's no spaces. Everything is on big wall of text.


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Sun Sep 13, 2015 7:20 am 
Offline

Joined: Sun Sep 30, 2012 3:44 am
Posts: 82
psycopathicteen wrote:
Looked at the asm file and I can't read it because there's no spaces. Everything is on big wall of text.

LF newlines. Don't open it in notepad, it won't work, it will only interpret CR-LF as a new line.


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Sun Sep 13, 2015 7:49 am 
Offline

Joined: Sat Jul 26, 2014 9:50 am
Posts: 48
DoNotWant wrote:
psycopathicteen wrote:
Looked at the asm file and I can't read it because there's no spaces. Everything is on big wall of text.

LF newlines. Don't open it in notepad, it won't work, it will only interpret CR-LF as a new line.



It is ridiculous that it is 2015 and notepad still doesn't know what to do with LF newlines, something so completely trivial to implement. I suppose Microsoft is too busy removing or hiding features people have used for years or forcing them to download adware begging them to update to Windows 10 and/or forcing them to download Windows 10 rather than doing anything useful or worthwhile.

I think many people replace notepad with notepad++, notepad2, or textpad.


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Sun Sep 13, 2015 7:58 am 
Offline

Joined: Wed Jul 09, 2008 8:46 pm
Posts: 233
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).


Top
 Profile  
 
 Post subject: Re: Sound driver fun
PostPosted: Sun Sep 13, 2015 8:06 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 18650
Location: NE Indiana, USA (NTSC)
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 43 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group