home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR22 / JORF21_2.ZIP / MUSIC.J < prev    next >
Text File  |  1993-07-05  |  3KB  |  83 lines

  1. Music:Start
  2.   New(Response,Row,Col,Forg,Back,Tone,Time)
  3.   Response=Msg:Add("Beautiful Music")
  4.     This 42 line program generates random music.  Just in case you
  5.     do not like random music, I have made the program display a
  6.     tapestry of color proclaiming "Beautiful Music" to convince you.
  7.  
  8.     It is a demonstration for these functions:
  9.  
  10.       Num:Rand(Lo,Hi)                   -Generates random numbers
  11.       Jorf:Sound(Tone,Duration)         -Plays a musical tone
  12.       Win:Attr("Forground/Background")  -Changes screen colors
  13.  
  14.     You are encouraged to change this program around to change the
  15.     music and the colors.  For instance make the music higher or
  16.     lower, faster or slower, and make the colors follow the rainbow
  17.     instead of being random.  (We wasted 18 lines just on this
  18.     message . . .  only 20 lines to go!)
  19.  
  20.     You could spend hours here, making Beautiful Music!
  21.  
  22.   If (Response==Ok)
  23.     Win:Add ("Beautiful Music", 2, 3, 22, 75, Here)
  24.     Win:Msg ("Press any key for relief . . .")
  25.     While (Kbd:Hit()==0)        | Do until they give up
  26.       ++Row                     | Next row
  27.       If (Row > Win:Ptr->Len)   | If too low
  28.         Row=1                   |   back to row 1
  29.       For (Col = 0 thru 4)      | Display "B.. Music 5 times
  30.         Forg=Num:Rand(0,15)
  31.         Back=Num:Rand(0,15)
  32.         Move:To(Row,(Col*15+1))
  33.         Win:Attr(Forg+"/"+Back)
  34.         Str:Put("Beautiful Music")
  35.       Time=Num:Btw(Time*Num:Rand(-4,4),1,8)
  36.       Tone=Tone+((Tone/12)*Num:Rand(-2,2))
  37.       If (Tone<60 Or Tone > 1400)
  38.         Tone=440
  39.       Jorf:Sound(Tone,Time*10)
  40.   Return (Ok)
  41.  
  42.  usic:Start
  43.   New(Response,Row,Col,Forg,Back,Tone,Time)
  44.   Response=Msg:Add("Beautiful Music")
  45.     This 42 line program generates random music.  Just in case you
  46.     do not like random music, I have made the program display a
  47.     tapestry of color proclaiming "Beautiful Music" to convince you.
  48.  
  49.     It is a demonstration for these functions:
  50.  
  51.       Num:Rand(Lo,Hi)                   -Generates random numbers
  52.       Jorf:Sound(Tone,Duration)         -Plays a musical tone
  53.       Win:Attr("Forground/Background")  -Changes screen colors
  54.  
  55.     You are encouraged to change this program around to change the
  56.     music and the colors.  For instance make the music higher or
  57.     lower, faster or slower, and make the colors follow the rainbow
  58.     instead of being random.  (We wasted 18 lines just on this
  59.     message . . .  only 20 lines to go!)
  60.  
  61.     You could spend hours here, making Beautiful Music!
  62.  
  63.   If (Response==Ok)
  64.     Win:Add ("Beautiful Music", 2, 3, 22, 75, Here)
  65.     Win:Msg ("Press any key for relief . . .")
  66.     While (Kbd:Hit()==0)        | Do until they give up
  67.       ++Row                     | Next row
  68.       If (Row > Win:Ptr->Len)   | If too low
  69.         Row=1                   |   back to row 1
  70.       For (Col = 0 thru 4)      | Display "B.. Music 5 times
  71.         Forg=Num:Rand(0,15)
  72.         Back=Num:Rand(0,15)
  73.         Move:To(Row,(Col*15+1))
  74.         Win:Attr(Forg+"/"+Back)
  75.         Str:Put("Beautiful Music")
  76.       Time=Num:Btw(Time*Num:Rand(-4,4),1,8)
  77.       Tone=Tone+((Tone/12)*Num:Rand(-2,2))
  78.       If (Tone<60 Or Tone > 1400)
  79.         Tone=440
  80.       Jorf:Sound(Tone,Time*10)
  81.   Return (Ok)
  82.  
  83.