


FUNCTION FMSounds()

/* Chromatic scale starting from C# */
LOCAL aNotes  := { 363, 385, 408, 432, 458, 485, 514, 544, 577, 611, 647, 686 }

LOCAL nInd
LOCAL aPiano  := FMLoadSBI( "piano.sbi" )
LOCAL aViolin := FMLoadSBI( "violin.sbi" )
LOCAL aBass   := FMLoadSBI( "bass.sbi" )

    IF sbInit()

      BoxMessage( "FM sounds created with FAST.lib. C# Chromatic scale" )

      FMReset()

      FMSetVoice( 0, aPiano[ 2 ] )
      FMSetVoice( 1, aViolin[ 2 ] )
      FMSetVoice( 2, aBass[ 2 ] )

      BoxWarning( "this instrument is... piano" )
      FOR nInd := 1 TO 12
        FMKeyOn( 0, aNotes[ nInd ], 3 )
        FMDelay( 9 )
      NEXT
      FMKeyOff( 0 )

      BoxWarning( "this instrument is... violin" )
      FOR nInd := 1 TO 12
        FMKeyOn( 1, aNotes[ nInd ], 3 )
        FMDelay( 9 )
      NEXT
      FMKeyOff( 1 )

      BoxWarning( "this instrument is... bass" )
      FOR nInd := 1 TO 12
        FMKeyOn( 2, aNotes[ nInd ], 3 )
        FMDelay( 9 )
      NEXT
      FMKeyOff( 2 )

      FMReset()

    ELSE

      BoxMessage( "Sorry, Sound Blaster not found" )

    ENDIF

RETURN NIL


