Page 1 of 1

Peace and Love

Posted: Tue Jun 17, 2008 5:14 pm
by dobro
vous souvenez vous de mon prg psychedelique d'il y a quelques années

ben je vous le reposte pour ceux qui n'on pas connu ma periode Pattes d'eph et bigoudi rose dans les cheveux Laughing

rappel :

avec ce prg vous choisissez n'importe quel fichier (exe,dll,txt,images,bref ! tout) et ce fichier sera interpreté par mon Ame, que j'ai reussi a encoder dans le code , je vous jouerai donc, la partition que represente les Octets de votre fichier
you remember my prg psychedelique a few years ago

I ben you reposte for those who have not seen my period Hippies

Reminder:

with this prg you choose any file (exe, dll, txt, images, brief! all) and this file will be interpreted by my soul, that I managed a encode in the code, you'll therefore, the partition that represents the Bytes of your file


; Prg realisé par DOBRO
; mis en Version purebasic 4.00
#dobro =1
#Police =1
Declare MIDIOpen()
Declare ChargeInstrument(Canal.b,Instrument.b)
Declare SendMIDIMessage(nStatus.l,nCanal.l,nData1.l,nData2.l)
Declare PlayNoteMIDI(Canal.b,Note.b,VelociteDown.b,VelociteUp.b)
 
Global m_hMidiOut,m_MIDIOpen.b
 
MIDIOpen() : ChargeInstrument(0,0) ; canal , instrument
 
PlayNoteMIDI(0,12,50,12) ; note de 12 (C) a 236
Delay (200)
PlayNoteMIDI(0,47,50,12) ; note de 12 (C) a 236 (G#)
InitKeyboard () : ; j'espere qu'il y a un clavier au moins !!
Resultat = InitSprite ()
 
 
   ; ***********************************
FontID = LoadFont ( #Police , "arial" , 18, #PB_Font_Bold )
EcranX = GetSystemMetrics_ ( #SM_CXSCREEN ): ;=largeur de l'ecran
EcranY = GetSystemMetrics_ ( #SM_CYSCREEN ): ;=hauteur de l'ecran
   WindowID = OpenWindow (1, 0, 0, 400, 200, "Synth_text by Dobro" , #PB_Window_SystemMenu|#PB_Window_MinimizeGadget |#PB_Window_MaximizeGadget |#PB_Window_SizeGadget|#PB_Window_BorderLess |#PB_Window_ScreenCentered )
  
   WindowID = WindowID (1)
  Result = OpenWindowedScreen ( WindowID ,0,0, EcranX, EcranY, 1, 0,0)
  
  xp1=300:yp1=300
  xp2=200:yp2=200
  xp3=400:yp3=400
  MIDIOpen() :
  ChargeInstrument(0,50) ; canal , instrument
   ;{ juste au cas ou
   ; ;coupe tout les sons
   ; For t=12 To 236
   ; PlayNoteMIDI(0,t,0,0) ; note c
   ; SendMIDIMessage(t,0,0,0) ;(nStatus.l,nCanal.l,nData1.l,nData2.l)
   ; Next t
   ; End
   ;}
  
  NomFichier$ = OpenFileRequester ( "Charger un fichier TEXT" , "c:\" , "*.*" , 0)
   If OpenFile (1, NomFichier$)
     Repeat
      event= WindowEvent ()
       Delay (2)
      nombre = ReadByte (1)
       If nombre<0
        nombre1=nombre+256
       Else
        nombre1=nombre
       EndIf
      nombre1=nombre%236
       ; Main Gauche (Basse)
       If nombre1 >15 And nombre1<46
        ChargeInstrument(0,35)
        PlayNoteMIDI(0,nombre1+12,127,127)
         Delay (nombre1*2)
         Gosub basse
       EndIf
       If nombre1 >46 And nombre1<108
        ChargeInstrument(0,4)
        PlayNoteMIDI(0,nombre1-12,127,127)
         Delay (nombre1*2)
         Gosub maindroite
       EndIf
       If nombre1 >108 And nombre1<236
        ChargeInstrument(0,12)
        PlayNoteMIDI(0,nombre1-48,127,127)
         Delay (nombre1*2)
         Gosub percu
       EndIf
       FlipBuffers (): ; affiche l'ecran
       ; ClearScreen(0, 0, 0) :;efface l'ecran
      
     Until event= #PB_Event_CloseWindow Or Eof (1)<>0
   EndIf
   CloseFile (1)
   ;coupe tout les son
   For t=12 To 236
    ChargeInstrument(0,12)
    PlayNoteMIDI(0,t,0,0) ; note c
    SendMIDIMessage(t,0,0,0) ;(nStatus.l,nCanal.l,nData1.l,nData2.l)
   Next t
   ;
   End
  
   ;{ percu
  percu:
  de=10
  compt1+1
  yp1= Sin (compt1*(nombre1*5)/10000) * xp1/3.14159 + (EcranY / 2)
  xp1= 360* Cos ( compt1*2*3.1415926/360) + (EcranX / 2)
   StartDrawing ( ScreenOutput ())
     Circle (xp1, yp1, de, RGB (nombre1*8, 0, 0))
   StopDrawing ()
   Return
   ;}
   ;{ basse
  basse:
  compt2+1
  de=10
  yp2= Sin (compt2*(nombre1*5)/10000) * xp2/3.14159 + (EcranY/ 2)
  xp2=360* Cos ( compt2*2*3.1415926/360) + (EcranX / 2)
   StartDrawing ( ScreenOutput () )
     Circle (xp2, yp2,de, RGB (30,nombre1*16, nombre1*16))
   StopDrawing ()
   Return
   ;}
   ;{ Maindroite
  maindroite:
  compt3+1
  de=10
  
  yp3= Sin (compt3*(nombre1*5)/10000) * yp3/3.14159 + (EcranY / 2)
  xp3= 360* Cos ( compt3*2*3.1415926/360) + (EcranX / 2)
  
   StartDrawing ( ScreenOutput () )
     Circle (xp3, yp3, de, RGB (nombre1*8, 0, nombre1*8 ) )
   StopDrawing ()
   Return
   ;}
  
  
  
  
  
  
   Procedure SendMIDIMessage(nStatus.l,nCanal.l,nData1.l,nData2.l)
    dwFlags.l = nStatus | nCanal | (nData1 << 8 ) | (nData2 << 16)
    temp.l = midiOutShortMsg_ (m_hMidiOut,dwFlags) ;
     If temp<>0
       MessageRequester ( "Problème" , "Erreur dans l'envoi du message MIDI" ,0)
     EndIf
   EndProcedure
   Procedure MIDIOpen()
     If m_MIDIOpen = 0
       If midiOutOpen_ (@m_hMidiOut,MIDIMAPPER,0,0,0) <> 0
         MessageRequester ( "Problème" , "Impossible d'ouvrir le périphérique MIDI" ,0)
       Else
        SendMIDIMessage($C0,0,0,0)
        m_MIDIOpen = 1
       EndIf
     EndIf
   EndProcedure
   Procedure PlayNoteMIDI(Canal.b,Note.b,VelociteDown.b,VelociteUp.b)
     If m_MIDIOpen
      SendMIDIMessage($80 | Canal,0,Note,VelociteDown)
      SendMIDIMessage($90 | Canal,0,Note,VelociteUp)
     EndIf
   EndProcedure
   Procedure ChargeInstrument(Canal.b,Instrument.b)
     If m_MIDIOpen
      SendMIDIMessage($C0 | Canal,0,Instrument,0)
     EndIf
   EndProcedure

Posted: Tue Jun 17, 2008 6:41 pm
by Joakim Christiansen
Cool, it basically convert the file you open to music and draws a cool image :D

Posted: Tue Jun 17, 2008 7:48 pm
by dobro
Joakim Christiansen wrote:Cool, it basically convert the file you open to music and draws a cool image :D

Yes :)

this code include polyphonie and percussions (Drums piste 10)


; Prg realisé par DOBRO
; mis en Version purebasic 4.00
#dobro =1
#Police =1
Declare MIDIOpen()
Declare ChargeInstrument(Canal.b,Instrument.b)
Declare SendMIDIMessage(nStatus.l,nCanal.l,nData1.l,nData2.l)
Declare PlayNoteMIDI(Canal.b,Note.b,VelociteDown.b,VelociteUp.b)
 
Global m_hMidiOut,m_MIDIOpen.b
 
MIDIOpen() : ChargeInstrument(0,0) ; canal , instrument
 
PlayNoteMIDI(0,12,50,12) ; note de 12 (C) a 236
Delay (200)
PlayNoteMIDI(0,47,50,12) ; note de 12 (C) a 236 (G#)
InitKeyboard () : ; j'espere qu'il y a un clavier au moins !!
Resultat = InitSprite ()
 
 
   ; ***********************************
FontID = LoadFont ( #Police , "arial" , 18, #PB_Font_Bold )
EcranX = GetSystemMetrics_ ( #SM_CXSCREEN ): ;=largeur de l'ecran
EcranY = GetSystemMetrics_ ( #SM_CYSCREEN ): ;=hauteur de l'ecran
   WindowID = OpenWindow (1, 0, 0, 400, 200, "Synth_text by Dobro" , #PB_Window_SystemMenu|#PB_Window_MinimizeGadget |#PB_Window_MaximizeGadget |#PB_Window_SizeGadget|#PB_Window_BorderLess |#PB_Window_ScreenCentered )
  
   WindowID = WindowID (1)
  Result = OpenWindowedScreen ( WindowID ,0,0, EcranX, EcranY, 1, 0,0)
  
  xp1=300:yp1=300
  xp2=200:yp2=200
  xp3=400:yp3=400
  MIDIOpen() :
  ChargeInstrument(0,50) ; canal , instrument
   ;{ juste au cas ou
   ; ;coupe tout les sons
   ; For t=12 To 236
   ; PlayNoteMIDI(0,t,0,0) ; note c
   ; SendMIDIMessage(t,0,0,0) ;(nStatus.l,nCanal.l,nData1.l,nData2.l)
   ; Next t
   ; End
   ;}
  
  NomFichier$ = OpenFileRequester ( "Charger un fichier TEXT" , "c:" , "*.*" , 0)
   If OpenFile (1, NomFichier$)
     Repeat
      event= WindowEvent ()
       Delay (2)
      nombre = ReadByte (1)
       If nombre<0
        nombre1=nombre+256
       Else
        nombre1=nombre
       EndIf
      nombre1=nombre%236
       ; Main Gauche (Basse)
       If nombre1 >15 And nombre1<46
        ChargeInstrument(0,35)
        PlayNoteMIDI(0,nombre1+12,127,127)
         Delay (nombre1*2)
         Gosub basse
       EndIf
       If nombre1 >46 And nombre1<108
        ChargeInstrument(1,4)
        PlayNoteMIDI(1,nombre1-12,127,127)
         Delay (nombre1*2)
         Gosub maindroite
       EndIf
       If nombre1 >108 And nombre1<236
        ChargeInstrument(9,12)
        PlayNoteMIDI(9,nombre1-48,127,127)
         Delay (nombre1*2)
         Gosub percu
       EndIf
       FlipBuffers (): ; affiche l'ecran
       ; ClearScreen(0, 0, 0) :;efface l'ecran
      
     Until event= #PB_Event_CloseWindow Or Eof (1)<>0
   EndIf
   CloseFile (1)
   ;coupe tout les son
   For t=12 To 236
    ChargeInstrument(0,12)
    PlayNoteMIDI(0,t,0,0) ; note c
    SendMIDIMessage(t,0,0,0) ;(nStatus.l,nCanal.l,nData1.l,nData2.l)
    
    ChargeInstrument(1,12)
    PlayNoteMIDI(1,t,0,0) ; note c
    SendMIDIMessage(t,0,0,0) ;(nStatus.l,nCanal.l,nData1.l,nData2.l)
    
    ChargeInstrument(9,12)
    PlayNoteMIDI(9,t,0,0) ; note c
    SendMIDIMessage(t,0,0,0) ;(nStatus.l,nCanal.l,nData1.l,nData2.l)
   Next t
   ;
   End
  
   ;{ percu
  percu:
  de=10
  compt1+1
  yp1= Sin (compt1*(nombre1*5)/10000) * xp1/3.14159 + (EcranY / 2)
  xp1= 360* Cos ( compt1*2*3.1415926/360) + (EcranX / 2)
   StartDrawing ( ScreenOutput ())
     Circle (xp1, yp1, de, RGB (nombre1*8, 0, 0))
   StopDrawing ()
   Return
   ;}
   ;{ basse
  basse:
  compt2+1
  de=10
  yp2= Sin (compt2*(nombre1*5)/10000) * xp2/3.14159 + (EcranY/ 2)
  xp2=360* Cos ( compt2*2*3.1415926/360) + (EcranX / 2)
   StartDrawing ( ScreenOutput () )
     Circle (xp2, yp2,de, RGB (30,nombre1*16, nombre1*16))
   StopDrawing ()
   Return
   ;}
   ;{ Maindroite
  maindroite:
  compt3+1
  de=10
  
  yp3= Sin (compt3*(nombre1*5)/10000) * yp3/3.14159 + (EcranY / 2)
  xp3= 360* Cos ( compt3*2*3.1415926/360) + (EcranX / 2)
  
   StartDrawing ( ScreenOutput () )
     Circle (xp3, yp3, de, RGB (nombre1*8, 0, nombre1*8 ) )
   StopDrawing ()
   Return
   ;}
  
  
  
  
  
  
   Procedure SendMIDIMessage(nStatus.l,nCanal.l,nData1.l,nData2.l)
    dwFlags.l = nStatus | nCanal | (nData1 << 8 ) | (nData2 << 16)
    temp.l = midiOutShortMsg_ (m_hMidiOut,dwFlags) ;
     If temp<>0
       MessageRequester ( "Problème" , "Erreur dans l'envoi du message MIDI" ,0)
     EndIf
   EndProcedure
   Procedure MIDIOpen()
     If m_MIDIOpen = 0
       If midiOutOpen_ (@m_hMidiOut,MIDIMAPPER,0,0,0) <> 0
         MessageRequester ( "Problème" , "Impossible d'ouvrir le périphérique MIDI" ,0)
       Else
        SendMIDIMessage($C0,0,0,0)
        m_MIDIOpen = 1
       EndIf
     EndIf
   EndProcedure
   Procedure PlayNoteMIDI(Canal.b,Note.b,VelociteDown.b,VelociteUp.b)
     If m_MIDIOpen
      SendMIDIMessage($80 | Canal,0,Note,VelociteDown)
      SendMIDIMessage($90 | Canal,0,Note,VelociteUp)
     EndIf
   EndProcedure
   Procedure ChargeInstrument(Canal.b,Instrument.b)
     If m_MIDIOpen
      SendMIDIMessage($C0 | Canal,0,Instrument,0)
     EndIf
   EndProcedure

Posted: Wed Jun 18, 2008 2:51 am
by Rook Zimbabwe
I saved a copy of the program as a txt file as well... Play that!

Rock on Dobro! :D

Posted: Wed Jun 18, 2008 3:07 am
by rsts
very impressive.

many thanks for sharing this with us :D

peace,