PureBasic Forum
https://www.purebasic.fr/english/

Speaker-Tecno
https://www.purebasic.fr/english/viewtopic.php?f=12&t=14625
Page 1 of 2

Author:  Hroudtwolf [ Fri Apr 01, 2005 2:40 pm ]
Post subject:  Speaker-Tecno

Code updated For 5.20+

EVERYBODY, CLAP YOUR HANDS !!! :lol:



Code:
#Grad2Rad=0.017453
OpenConsole()                                 
ConsoleTitle ("Tecno-Mucke")
repeat
For a=1 To 150 Step 10
Beep_(Int(Sin(a*#Grad2Rad)*1000), 10)
Beep_(Int(Sin(a*#Grad2Rad)*500), 5)
Beep_(Int(Cos(a*#Grad2Rad)*1000), 10)
Next
Delay(40)
For x=1 To 20
Beep_(100+Random (1000),3)
Beep_(100+Random (1000),3)
Next x
Delay(40)
For a=1 To 400 Step 10
Beep_(Int(Sin(a*#Grad2Rad)*1000), 10)
Beep_(Int(Sin(a*#Grad2Rad)*500), 5)
Beep_(Int(Cos(a*#Grad2Rad)*1000), 10)
Next
Delay(40)
For x=1 To 20
Beep_(100+Random (1500),3)
Beep_(100+Random (1000),3)
Next x
Delay(40)
For a=1 To 150 Step 10
Beep_(Int(Sin(a*#Grad2Rad)*2000), 10)
Beep_(Int(Sin(a*#Grad2Rad)*500), 5)
Beep_(Int(Cos(a*#Grad2Rad)*1000), 10)
Next
Delay(20)
For x=1 To 20
Beep_(100+Random (1000),3)
Beep_(100+Random (1000),3)
Next x
Delay(20)
For x=1 To 20
Beep_(100+Random (1500),3)
Beep_(100+Random (1000),3)
Next x
Until Inkey()<>""
CloseConsole()

Author:  Tommeh [ Fri Apr 01, 2005 3:02 pm ]
Post subject: 

Lol, My PC is dying! :)

Author:  Hroudtwolf [ Fri Apr 01, 2005 3:13 pm ]
Post subject: 

Yeah ,there must die more PCs.... :lol:


Code:
Declare synth1()
Declare synth2()
Declare synth3()
Declare synth4()
OpenConsole()                                 
ConsoleTitle ("Tecno-Mucke")

Repeat
Read note

Select note
Case 1
synth1()
Case 2
synth2()
Case 3
synth3()
Case 4
synth4()

EndSelect

x=x+1
If x>23:x=0:Restore mucke::EndIf
Delay (30)
Until Inkey()<>""
CloseConsole()



Procedure synth1()
For a=1 To 500 Step 10
Beep_(Int(Sin(a*0.017453)*1000), 5)
Beep_(Int(Cos(a*0.017453)*3000), 5)
Next
EndProcedure
Procedure synth3()
For a=1 To 500 Step 10
Beep_(Int(Sin(a*0.017453)*5000), 2)
Beep_(Int(Cos(a*0.017453)*2000), 5)
Next
EndProcedure
Procedure synth2()
For a=1 To 800 Step 10
Beep_(Int(Sin(a*0.017453)*Random(1000)), 1)
Beep_(Int(Cos(a*0.017453)*Random(5000)), 1)
Next
EndProcedure
Procedure synth4()
For a=1 To 800 Step 10
Beep_(Int(Sin(a*0.017453)*3000), 2)
Beep_(Int(Sin(a*0.017453)*1500), 2)
Next
EndProcedure








DataSection
Mucke:
Data.l 1,2,1,3,1,2,1,3,1,2,1,3,1,1,4,1,4,1,4,1,2,1,3,1,4
EndDataSection

Author:  traumatic [ Fri Apr 01, 2005 3:34 pm ]
Post subject: 

horrible!

Author:  GeoTrail [ Fri Apr 01, 2005 11:57 pm ]
Post subject: 

:lol:
Annoying, but kinda funny.
First time I ran it, it gave me a flash back from the olden days hehehe

Author:  jack [ Sat Apr 02, 2005 12:04 am ]
Post subject: 

kind of reminds me of Moon Cresta :)

Author:  kenmo [ Thu Apr 14, 2005 1:14 am ]
Post subject: 

Hows this?

Code:
; Sloppily Coded Rave by kenmo
; Tune written by "Toby"!

Structure Note
   base.b
   note.b
EndStructure

Global length.w : Read length.w : Global tempo.w : Read tempo.w : Dim Note.Note(length-1)
For tmp=0 To length-1
   Read note(tmp)\base : Read note(tmp)\note
Next tmp
Global a.b : Global b.b

Dim notefreq.w(11,9) : For tmp=0 To 11 : For tmp2=0 To 9 : Read notefreq(tmp,tmp2) : Next tmp2 : Next tmp
OpenWindow(0,0,0,300,40,#PB_Window_ScreenCentered|#PB_Window_SystemMenu,"Tempo: "+Str(tempo)+" bpm")
CreateGadgetList(WindowID())
TrackBarGadget(0,10,10,280,20,30,200) : SetGadgetState(0,tempo)

Procedure PlayIt()
   tmp=0
   Repeat
      a=note(tmp)\note-1 : b=note(tmp)\base-1
      Beep_(notefreq(a,b),15000/tempo)
      tmp+1 : If tmp=length : tmp=0 : EndIf
   ForEver
EndProcedure

   thread=CreateThread(@playit(),0)
   If thread
   Repeat
      e=WindowEvent()
      While e
         If e=#PB_EventCloseWindow : KillThread(thread) : End
         ElseIf e=#PB_EventGadget And EventGadgetID()=0
            tempo=GetGadgetState(0) : SetWindowTitle(0,"Tempo: "+Str(tempo)+" bpm")
         EndIf
         e=WindowEvent() : Delay(2)
      Wend
      Delay(2)
   ForEver
   Else : End : EndIf
   
DataSection
   ; Song Length, Tempo
   Data.w 64,100
   ; Base/Note
   Data.b 5,1
   Data.b 5,8
   Data.b 6,1
   Data.b 5,1
   Data.b 5,8
   Data.b 6,1
   Data.b 5,1
   Data.b 5,8
   Data.b 5,1
   Data.b 5,8
   Data.b 6,4
   Data.b 5,1
   Data.b 5,8
   Data.b 6,4
   Data.b 5,1
   Data.b 5,8
   Data.b 5,4
   Data.b 5,9
   Data.b 6,4
   Data.b 5,4
   Data.b 5,9
   Data.b 6,4
   Data.b 5,4
   Data.b 5,9
   Data.b 5,6
   Data.b 6,1
   Data.b 6,6
   Data.b 5,6
   Data.b 6,1
   Data.b 6,6
   Data.b 5,6
   Data.b 6,1
   Data.b 5,1
   Data.b 5,8
   Data.b 6,8
   Data.b 5,1
   Data.b 5,8
   Data.b 6,8
   Data.b 5,1
   Data.b 5,8
   Data.b 5,1
   Data.b 5,8
   Data.b 6,6
   Data.b 5,1
   Data.b 5,8
   Data.b 6,6
   Data.b 5,1
   Data.b 5,8
   Data.b 5,4
   Data.b 5,11
   Data.b 6,9
   Data.b 5,4
   Data.b 5,11
   Data.b 6,9
   Data.b 5,4
   Data.b 5,11
   Data.b 5,6
   Data.b 6,1
   Data.b 6,6
   Data.b 5,6
   Data.b 6,1
   Data.b 6,6
   Data.b 5,6
   Data.b 6,1
   
   ; Note Frequencies
   Data.w 16,32,65,130,261,523,1046,2093,4186,8372
   Data.w 17,34,69,138,277,554,1108,2217,4434,8869
   Data.w 18,36,73,146,293,587,1174,2344,4698,9397
   Data.w 19,38,77,155,311,622,1244,2489,4978,9956
   Data.w 20,41,82,164,329,659,1318,2637,5274,10548
   Data.w 21,43,87,174,349,698,1396,2793,5587,11175
   Data.w 23,46,92,184,369,739,1479,2959,5919,11839
   Data.w 24,48,97,195,391,783,1567,3135,6270,12541
   Data.w 25,51,103,207,415,830,1661,3322,6644,13289
   Data.w 27,55,110,220,440,880,1760,3520,7040,14080
   Data.w 29,58,116,233,466,932,1964,3729,7458,14917
   Data.w 30,61,123,246,493,987,1975,3951,7902,15804
EndDataSection

Author:  traumatic [ Thu Apr 14, 2005 11:29 am ]
Post subject: 

kenmo wrote:
Hows this?

First tune posted here to meet the defintion of music! Like it! :D

Author:  GeoTrail [ Thu Apr 14, 2005 11:48 am ]
Post subject: 

Pretty cool, I kinda like it :)

Author:  benny [ Thu Apr 14, 2005 1:20 pm ]
Post subject: 

@kenmo:

Indeed ... nice piece of melody :!:

Author:  Tommeh [ Thu Apr 14, 2005 3:36 pm ]
Post subject: 

Ok i can't take credit for this, ages ago in my DarkBASIC years somebody posted a melody tune for the beginning of Guns & Roses, so i changed it to be and here it is:

Code:
tempo=180
Beep_(284,tempo)
Beep_(568,tempo)
Beep_(426,tempo)
Beep_(379,tempo)
Beep_(758,tempo)
Beep_(426,tempo)
Beep_(716,tempo)
Beep_(426,tempo)

Beep_(284,tempo)
Beep_(568,tempo)
Beep_(426,tempo)
Beep_(379,tempo)
Beep_(758,tempo)
Beep_(426,tempo)
Beep_(716,tempo)
Beep_(426,tempo)

Beep_(319,tempo)
Beep_(568,tempo)
Beep_(426,tempo)
Beep_(379,tempo)
Beep_(758,tempo)
Beep_(426,tempo)
Beep_(716,tempo)
Beep_(426,tempo)

Beep_(319,tempo)
Beep_(568,tempo)
Beep_(426,tempo)
Beep_(379,tempo)
Beep_(758,tempo)
Beep_(426,tempo)
Beep_(716,tempo)
Beep_(426,tempo)

Beep_(379,tempo)
Beep_(568,tempo)
Beep_(426,tempo)

Author:  traumatic [ Thu Apr 14, 2005 5:25 pm ]
Post subject: 

To my ears, you've got to change the second note of the first two rows:
Code:
Beep_(568,tempo)


first is note is too sharp as well, but... ;)

Author:  Tommeh [ Thu Apr 14, 2005 5:26 pm ]
Post subject: 

As i said, i didnt make it but i've changed it.. if you think its for the better ;p

Author:  akee [ Thu Apr 14, 2005 8:19 pm ]
Post subject: 

Trigger back memories when we were in DOS using GWBASIC trying to write a game.

Author:  Rescator [ Thu Apr 14, 2005 10:24 pm ]
Post subject: 

I couldn't help myself, turned this into a ringtone'ish function. heh.
minimum 1 loop, maximum 10 loops. has a finishing note when the loop is do ne.

Code:
Procedure play(replay.l)
 tempo=180
 If replay>10 : replay=10 : EndIf
 If replay<1 : replay=1 : EndIf
 Repeat
  replay-1
  Beep_(284,tempo)
  Beep_(568,tempo)
  Beep_(426,tempo)
  Beep_(379,tempo)
  Beep_(758,tempo)
  Beep_(426,tempo)
  Beep_(716,tempo)
  Beep_(426,tempo)
 
  Beep_(284,tempo)
  Beep_(568,tempo)
  Beep_(426,tempo)
  Beep_(379,tempo)
  Beep_(758,tempo)
  Beep_(426,tempo)
  Beep_(716,tempo)
  Beep_(426,tempo)
 
  Beep_(319,tempo)
  Beep_(568,tempo)
  Beep_(426,tempo)
  Beep_(379,tempo)
  Beep_(758,tempo)
  Beep_(426,tempo)
  Beep_(716,tempo)
  Beep_(426,tempo)
 
  Beep_(319,tempo)
  Beep_(568,tempo)
  Beep_(426,tempo)
  Beep_(379,tempo)
  Beep_(758,tempo)
  Beep_(426,tempo)
  Beep_(716,tempo)
  Beep_(426,tempo)
 
  Beep_(379,tempo)
  Beep_(568,tempo)
  Beep_(426,tempo)
  Beep_(379,tempo)
  Beep_(758,tempo)
  Beep_(426,tempo)
  Beep_(716,tempo)
  Beep_(426,tempo)
 
  Beep_(379,tempo)
  Beep_(568,tempo)
  Beep_(426,tempo)
  Beep_(379,tempo)
  Beep_(758,tempo)
  Beep_(426,tempo)
  Beep_(716,tempo)
  Beep_(426,tempo)
 Until replay=0
 Beep_(284,tempo*2)
EndProcedure

play(2)

Page 1 of 2 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/