MuSer v 1.0.0

« Older   Newer »
  Share  
erma96
CAT_IMG Posted on 26/7/2010, 16:53     +1   -1




MuSer
Sequencer Musicale



image



Grazie a questo programma č possibile creare composizioni musicali mono traccia in formato "MSR" non esportabili.
L'utilizzo č molto semplice:
La inputbox "tempo" serve per definire la velocitą del brano,che č meglio tenere compresa tra 60 e 220.
La inputbox "Lunghezza note..." serve per modificare la lunghezza delle note o delle pause, da considerare che 64/64 equivale a una semibreve.
Le due radio( nota, pausa) servono per dire cosa si vuole inserire all'interno del brano. In entrambi i casi, l'inserimento si effettua cliccando su una nota della tastiera virtuale, dopo aver attivato la registrazione.
Per attivare la registrazione, č necessario cliccare sul pulsante di record.Quando il pulsante sarą rosso, la registrazione sarą attivata.
Per riprodurre cliccare su play


Ora prendiamo come esempio una nota: +27016
le prime tre cifre definiscono l'altezza(DO) e le ultime tre la lunghezza (1/4)

Per le pause le prime tre cifre devono essere composte da tre trattini bassi: ___

Le note e le pause posseno essere separate fra di loro da un qualsiasi numero di caratteri, l'importante č che fra questi caratteri non siano presenti: 0 1 2 3 4 5 6 7 8 9 0 + - _


Ho creato anche una canzone d'esempio: Per Elisa
Si trova nella stessa cartella dell'exe

Inoltre la grafica č interamente fatta da me con paint :P

Ora posto il source, ma sappiate che per farlo funzionare avete bisogno delle immagini

SPOILER (click to view)
CODICE
#include <Sound.au3>
#include <GUIConstants.au3>
#include <EditConstants.au3>
#Include <Array.au3>

dim $caratteri[14] =["0","1","2","3","4","5","6","7","8","9","+","-","_",""]
$nomeprvd=@desktopdir&"\"
$nome=""
$recst=false
$indirizzo=""
$title="(Senza Titolo) -  MuSer v 1.0.0"
$t=120
$lunghezza="016"
$l1="16"



guicreate("(Senza Titolo) -  MuSer v 1.0.0",855,500,-1,-1)
GuiSetIcon(@ScriptDir & "\icona.ico", 0)
guictrlcreatepic(@scriptdir&"\sfondo.bmp",0,0,855,481)
GUICtrlSetState(-1,128)
$file=GUICtrlCreateMenu("File")
$help=GUICtrlCreateMenu("Help")
$file1=GUICtrlCreateMenuitem("Nuovo",$file)
$file2=GUICtrlCreateMenuitem("Apri...",$file)
$file4=GUICtrlCreateMenuitem("Salva",$file)
$file5=GUICtrlCreateMenuitem("Salva Come...",$file)
$file6=GUICtrlCreateMenuitem("Salva una Copia...",$file)
$help3=GUICtrlCreateMenuitem("About",$help)
$edit1=GUICtrlCreateEdit("120",10,30,200,350)
guictrlsetfont(-1,8.5,400,0,"Lucida Console")

$play=guictrlcreatepic(@scriptdir&"\play.bmp",750,350,34,34)
$rec=guictrlcreatepic(@scriptdir&"\record.bmp",784,350,34,34)

GUICtrlCreateLabel("Tempo",225,60)
guictrlsetfont(-1,8.5,400,0,"Lucida Console")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT )

$tempo=guictrlcreateinput("120",230,80,30,16,$ES_NUMBER)
guictrlsetfont(-1,8.5,400,0,"Lucida Console")

GUICtrlCreateLabel("  Lunghezza"&@crlf&"Note o Pause",215,300,90)
guictrlsetfont(-1,8.5,400,0,"Lucida Console")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT )

$lunghezza1=guictrlcreateinput("16",230,331,30,16,$ES_NUMBER)
guictrlsetfont(-1,8.5,400,0,"Lucida Console")

guictrlcreatelabel("/64",265,332)
guictrlsetfont(-1,8.5,400,0,"Lucida Console")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT )

$radio1=guictrlcreatepic(@scriptdir&"\radioCH.bmp",310,316,16,16)
$radio2=guictrlcreatepic(@scriptdir&"\radioUN.bmp",310,340,16,16)
$rad=0


$text1=GUICtrlCreateLabel("Nota",328,319)
guictrlsetfont(-1,8.5,400,0,"Lucida Console")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT )

$text2=GUICtrlCreateLabel("Pausa",328,343)
guictrlsetfont(-1,8.5,400,0,"Lucida Console")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT )







GUISetState()

hotkeyset("{esc}","end")
hotkeyset("^n","new")
hotkeyset("^o","open")
hotkeyset("^s","save")
hotkeyset("^+s","saveas")
hotkeyset("^+p","savecopy")





while 1
       $a = GUIGetCursorInfo($title)
       if winactive($title) then
               if $a[1]<501 and $a[1]>409 and $a[0]<856 and $a[0]>0 then
               if $a[1]>450 Then
                       $nota=Int(45*$a[0]/855-0.05)
                       $notatro=False
                       $gs=0
                       while $notatro=false
                           if $nota=2+$gs then
                                       $nota=$gs/7*12+3
                                   $notatro=true
                           elseif $nota=3+$gs then
                                   $nota=$gs/7*12+5
                                   $notatro=true
                           elseif $nota=4+$gs then
                                   $nota=$gs/7*12+7
                                   $notatro=true
                           elseif $nota=5+$gs then
                                   $nota=$gs/7*12+8
                                   $notatro=true
                           elseif $nota=6+$gs then
                                   $nota=$gs/7*12+10
                                   $notatro=true
                           elseif $nota=0+$gs then
                                   $nota=$gs/7*12+0
                                   $notatro=true
                           elseif $nota=1+$gs then
                                   $nota=$gs/7*12+2
                                   $notatro=true
                           endif
                               
                           $gs+=7
                   WEnd
                       $nota-=36
                       if $nota<10 and $nota>-1 then $nota="0"&$nota
                       if $nota>-10 and $nota<0 then $nota="-0"&StringTrimLeft($nota,1)
                       if $nota>-1 then $nota="+"&$nota
                       if $recst=true and $a[2]=1 and $rad=0 then  
                       GUICtrlSetData($edit1,guictrlread($edit1)&@crlf&$nota&$lunghezza)        
                       elseif $recst=true and $a[2]=1 and $rad=1 then
                       GUICtrlSetData($edit1,guictrlread($edit1)&@crlf&"___"&$lunghezza)
                       EndIf
                       
                       while $a[2]=1
                               $a = GUIGetCursorInfo($title)
                               beep(440*2^($nota/12),10)
                       wend
               Else
                       
                       $nota=Int(43*($a[0]-10)/817-0.05)
                       $notatro=False
                       $gs=0
                       while $notatro=false
                           if $nota=0+$gs then
                                       $nota=$gs/7*12+1
                                   $notatro=true
                           elseif $nota=2+$gs then
                                   $nota=$gs/7*12+4
                                   $notatro=true
                           elseif $nota=3+$gs then
                                   $nota=$gs/7*12+6
                                   $notatro=true
                           elseif $nota=5+$gs then
                                   $nota=$gs/7*12+9
                                   $notatro=true
                           elseif $nota=6+$gs then
                                   $nota=$gs/7*12+11
                                   $notatro=true
                               elseif $nota=1+$gs or $nota=4+$gs then
                                       $nota=$gs/7*12+11
                                   $notatro=true
                           endif
                               
                           $gs+=7
                   WEnd
                       $nota-=36
                       if $nota<10 and $nota>-1 then $nota="0"&$nota
                       if $nota>-10 and $nota<0 then $nota="-0"&StringTrimLeft($nota,1)
                       if $nota>-1 then $nota="+"&$nota
                       if $recst=true and $a[2]=1 and $rad=0 then  
                       GUICtrlSetData($edit1,guictrlread($edit1)&@crlf&$nota&$lunghezza)        
                       elseif $recst=true and $a[2]=1 and $rad=1 then
                       GUICtrlSetData($edit1,guictrlread($edit1)&@crlf&"___"&$lunghezza)
                       EndIf
                       
                       while $a[2]=1
                               $a = GUIGetCursorInfo($title)
                               beep(440*2^($nota/12),10)
                       wend
               EndIf
               endif
       endif
       
       if guictrlread($tempo)<>$t then
               $t=guictrlread($tempo)
               $t1=$t
               if $t<100 then $t1="0"&$t
               if $t<10 then $t1="00"&$t
               GUICtrlSetData($edit1,$t1&stringtrimleft(guictrlread($edit1),3))
       EndIf
       
       
       
       if guictrlread($lunghezza1)<>$l1 then
               $lunghezza=guictrlread($lunghezza1)
               $l1=$lunghezza
               if $l1<100 then $lunghezza="0"&$l1
               if $l1<10 then $lunghezza="00"&$l1

       EndIf
       
       
       
       
       switch guigetmsg()
               
               case -3
               
                       Exit
               
               Case $file1
                       new()
               case $file2
                       open()
               case $file4
                       save()
               Case $file5
                       saveas()
               case $file6
                       savecopy()
               
               Case $help3
                       msgbox(0,"About","MuSer®  ©2010"&@crlf&"Questo programma č stato creato da erma96,"&@crlf&" Ed č protetto da una licenza Creative Commons ©"&@cRlf&"Tu puoi modificare questo file solo con il permesso di erma96.")        
               case $play
                       guictrlsetimage($play,@scriptdir&"\playg.bmp")
                       sleep(100)
                       guictrlsetimage($play,@scriptdir&"\play.bmp")
                       $data=guictrlread($edit1)
               $tmpg= 60/$t*1000/16
                       
                       toglicaratteri()
                       
                       $data=stringtrimleft($data,3)
                       
                       toglicaratteri()
                       while $data<>""
                               if stringleft($data,3)="___" then
                                       
                                       $data=stringtrimleft($data,3)
                                       sleep($tmpg*stringleft($data,3))
                                       $data=stringtrimleft($data,3)
                                       toglicaratteri()
                                       
                               Else
                                       
                           $ee=440*2^((stringleft($data,3))/12)
                                       $data=stringtrimleft($data,3)
                                       $ff=$tmpg*stringleft($data,3)
                                       beep($ee,$ff)
                                       $data=stringtrimleft($data,3)
                                       toglicaratteri()
                                       
                               EndIf
                       wend
           case $rec
                   if $recst=false Then
                           $recst=true
                               
                               guictrlsetimage($rec,@scriptdir&"\recordg.bmp")
                               sleep(100)
                               guictrlsetimage($rec,@scriptdir&"\recordpremuto.bmp")
                   Else
                           $recst=false
                               guictrlsetimage($rec,@scriptdir&"\recordpremutog.bmp")
                               sleep(100)
                               guictrlsetimage($rec,@scriptdir&"\record.bmp")
                   EndIf
                       
               case $radio1
                       
                       if $rad=1 Then
                               
                       
                               guictrlsetimage($radio1,@scriptdir&"\radioCH.bmp")
                               guictrlsetimage($radio2,@scriptdir&"\radioUN.bmp")
                               $rad=0
                               endif
                       
               case $radio2
                       
                       if $rad=0 Then
                               
                               guictrlsetimage($radio1,@scriptdir&"\radioUN.bmp")
                               guictrlsetimage($radio2,@scriptdir&"\radioCH.bmp")
                               $rad=1
                       
               endif
               
       case $text1
               
                       if $rad=1 Then
                               
                       
                               guictrlsetimage($radio1,@scriptdir&"\radioCH.bmp")
                               guictrlsetimage($radio2,@scriptdir&"\radioUN.bmp")
                               $rad=0
                               endif
       Case $text2
               
                       if $rad=0 Then
                               
                               guictrlsetimage($radio1,@scriptdir&"\radioUN.bmp")
                               guictrlsetimage($radio2,@scriptdir&"\radioCH.bmp")
                               $rad=1
                       
               endif
       EndSwitch
WEnd



func end()
       exit
EndFunc



func new()
       $MSGBOX=msgbox(4,"Attenzione!","Se inizi un nuovo progetto, Perderai i dati non salvati."&@crlf&" Vuoi continuare?")
       If $MSGBOX=6 Then
           GUICtrlSetData($edit1,"")
               guictrlsetdata($tempo,"120")
               
               WinSetTitle ( $title, "", "(Senza Titolo) -  MuSer v 1.0.0" )
               $title="(Senza Titolo) -  MuSer v 1.0.0"
               $indirizzo=""
       endif
EndFunc



func open()
       $MSGBOX=msgbox(4,"Attenzione!","Se apri un altro progetto, perderai i dati non salvati."&@crlf&" Vuoi continuare?")
       If $MSGBOX=6 Then
       $indirizzo = FileOpenDialog("Open File", @desktopDir & "\", "MuSer Files (*.msr)", 1+2 )
               if @error then
                       else
           GUICtrlSetData($edit1,fileread($indirizzo))
               
               WinSetTitle ( $title, "", $indirizzo&" -  MuSer v 1.0.0" )
               $title=$indirizzo&" -  MuSer v 1.0.0"
               $nomeprvd=$indirizzo
               while stringright($nomeprvd,1)<>"\"
               $nome=stringright($nomeprvd,1)&$nome
               $nomeprvd=StringTrimRight($nomeprvd,1)
       wend
       
       guictrlsetdata($tempo,1000-(1000-stringleft(guictrlread($edit1),3)))
endif
endif
EndFunc



func save()
       if $indirizzo="" Then
               saveas()
       Else
               FileDelete ($indirizzo)
               filewrite($indirizzo,GUICtrlRead($edit1))
               msgbox(0,"Salvato!","Il file č stato salvato!")
       endif
EndFunc



func saveas()
       $indirizzo=FileSaveDialog("Salva File",$nomeprvd,"MuSer Files (*.msr)",2,$nome)
       if @error then
                       else
       If stringright($indirizzo,4)<>".msr" then $indirizzo=$indirizzo&".msr"
         
          if Fileexists($indirizzo)=1 then
                       
                       $MSGBOX=msgbox(4,"Attenzione!","Il file esiste gią, vuoi sovrascriverlo?")
               If $MSGBOX=6 Then FileDelete ($indirizzo)
                               
               endif
           filewrite($indirizzo,GUICtrlRead($edit1))
           msgbox(0,"Salvato!","Il file č stato salvato!")
               WinSetTitle ( $title, "", $indirizzo&" -  MuSer v 1.0.0" )
               $nomeprvd=$indirizzo
               $title=$indirizzo&" -  MuSer v 1.0.0"
               
       while stringright($nomeprvd,1)<>"\"
               $nome=stringright($nomeprvd,1)&$nome
               $nomeprvd=StringTrimRight($nomeprvd,1)
       wend
       endif
EndFunc
       
       
       
func savecopy()
       
       if $indirizzo="" Then
               
               saveas()
               
       Else
               
           $indirizzo2=FileSaveDialog("Salva Copia",$nomeprvd,"",2,$nome)
               if @error then
                       else
           If stringright($indirizzo2,4)<>".msr" then $indirizzo2=$indirizzo2&".msr"
           
               if Fileexists($indirizzo2)=1 then
                       
               $MSGBOX=msgbox(4,"Attenzione!","Il file esiste gią, vuoi sovrascriverlo?")
               If $MSGBOX=6 Then
                               FileDelete ($indirizzo2)
               filewrite($indirizzo2,GUICtrlRead($edit1))
               msgbox(0,"Salvato!","La copia č stata salvata!")
               endif
               endif
               
           endif
       
   ENDIF
       
EndFunc

func toglicaratteri()
       $caR=stringleft($data,1)
       $abc=1
       while $abc=1
               for $afg=0 to ubound($caratteri)-1
                       
               if $caR=$caratteri[$afg] Then
                       $abc=0
               endif
       next
       if $abc=1 then
               $data=stringtrimleft($data,1)
               $caR=stringleft($data,1)
       endif
       
               wend
endfunc






Download exe +"Per Elisa.msr"





Spero vi piaccia :D

Edited by erma96 - 29/7/2010, 11:13
 
Top
bradipooso
CAT_IMG Posted on 26/7/2010, 17:34     +1   -1




Ingegnoso
 
Top
1 replies since 26/7/2010, 16:53   147 views
  Share