From: ptran@sciborg.uwaterloo.ca (Phat H Tran)
Subject: Re: Calling all GUS SDKers and users!
Organization: University of Waterloo
Date: Sun, 20 Dec 1992 09:32:58 GMT

In article <1992Dec18.225839.62168@cc.usu.edu> sl8nl@cc.usu.edu writes:
>Ouch, I just ran into a major brick wall in my GUS modplayer...
>
>All you with SDK's, listen up.  Maybe I'm missing a command...
>
>OK,  as you are all aware, module samples have a start, length, loops, and
>loope, illustrated like.
>
>Start                       Length
>+--------------------------------+
>      -----------------  
>   LoopS            LoopE            
>
>Alright, as far as I can tell, the GUS only supports this.
>
>Start-----------------------End
>           LoopS------------End
>
>Am I missing something??????????    This is going to really hurt in looping
>samples if it can't do it like Amiga modules!
>
>Joshua Jensen
>

The GUS seems to be oriented toward playing MIDI instruments.  You
have the attack transient, which is played once and is located before
loopS, and you have the sustain waveform that is looped for the sustain
and faded for the release.  Since few real instruments experience a
significant change in waveform as their sustain dies, this approach is
quit simple and yet realistic.  Instrument samples for MOD files also
have the attack and sustain phases.  However, I don't think MOD players
merely fade the sustain waveform for the release, and as a result, 
there's a release phase in which the sample itself fades.

The MOD approach is more flexible in the sense that you can have weird
and wonderful waveform changes occuring at the end of a note.  But a
disadvantage is that you can only end notes right at the end of the
loop.  If you end the note when the middle of the looped section is 
played, you will probably hear a "pop" since the release section of the
sample was only aligned for the end of the loop.  The GUS approach will
let you end a note at any time.  Also, the MOD sample format means that
a long release time means a huge sample size.

If you want to play MOD files faithfully on the GUS, then you can split
the MOD sample into two GUS patches:

Start--------------------------------------------------------Length
          LoopS---------------------------LoopE
Start---------------------------------------EndStart------------End
          LoopS---------------------------LoopE                    
Patch 1                                        Patch 2

Play the first patch at the note on signal, and then play the 
second patch on note off.  I don't know how easily it would be to
implement so that the two patches meld nicely together.

A better way to play MODs on the GUS is to drop the release phase
from the MOD samples altogether, keep only up to LoopE, and then have
the GUS handle the release in its hardware.  This approach will save
a lot of memory, and should not affect the sound of the MOD any since
practically all release phases are copies of the sustain phase with
the volume diminishing over time.

Well, there ya have it!  I just wrote a whole article on two subjects
I know next to nothing about.  I have no idea how the GUS actually works 
(No, I don't have the SDK.) and I know even less about the MOD format.
I am just going on what info Josh presented in his query and some 
assumptions of mine, the biggest being that the release phase of the
MOD sample is a complete sample of a note fading.  For all I know,
it could actually be a fixed-amplitude waveform that the MODPlayer
fades during playback instead.  Please correct me if I'm wrong
anywhere, anybody.  I'm just tossing ideas around.

Phat.