home *** CD-ROM | disk | FTP | other *** search
/ Dave Lowe: Disk Number 4 / Lowe_DiskNumber4.img / PATT2MEG.BAS < prev    next >
Encoding:
BASIC Source File  |  1994-06-12  |  1.5 KB  |  61 lines

  1.                 DIM byte AS STRING * 1
  2.                 COMMON c AS INTEGER
  3.                 COMMON b AS INTEGER
  4.                 COMMON a AS INTEGER
  5.                 COMMON dur AS INTEGER
  6.                 COMMON note AS INTEGER
  7.                 COMMON p AS INTEGER
  8.                 COMMON g AS INTEGER
  9.                 pattlen = 128
  10.        
  11.        
  12.         CLS
  13.         g = 1: REM, start pos to read in file
  14.        
  15.         OPEN "c:/martin/megadriv/music/flink.bin" FOR BINARY AS #2
  16.         OPEN "c:/martin/megadriv/music/flink.snd" FOR BINARY AS #1
  17.        
  18.        
  19. nextpatt:
  20.         GET #2, g, a: REM  which pattern number to create
  21.         IF a = 255 THEN GOTO endpatts
  22.       
  23.         PRINT "                 creating pattern no. "; a
  24.  
  25.         p = 2984 + 32 + (a * pattlen): REM pattern pos in file
  26.         g = g + 2: REM step over patt number
  27.  
  28. readloop:
  29.         GET #2, g, a
  30.         GOSUB split
  31.         PUT #1, p, a:            REM   write note and duration to file
  32.         IF note = -1 THEN GOTO endpatt
  33.         p = p + 2
  34.         g = g + 2
  35.         GOTO readloop:
  36.  
  37. endpatt:
  38.         g = g + 2
  39.         GOTO nextpatt
  40.  
  41. endpatts:               : REM end of all patterns
  42.  
  43.         CLOSE
  44.        
  45.         PRINT "                 All patterns converted  "
  46.  
  47.         END
  48.        
  49.         REM ***************  SUBROUTINES ***************
  50.        
  51.         REM input word value output switches high/low
  52. split:
  53.         dur = a / 256: note = a - (256 * dur)
  54.        
  55.         RETURN
  56.        
  57.         REM-----------------------------------------------
  58.  
  59.  
  60.  
  61.