Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Midi keyboard


  • Please log in to reply
14 replies to this topic

#1 sandin

sandin

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 569 posts

Posted 07 May 2009 - 07:41 PM

I've started making this program ages ago, and I dun have the time to finish it. It's a music scripting program with MIDI keyboard feature. Means you can compose your own MIDI music.

In this stage the following things needs to be fixed:
-right click menu on the list with Add above, Add bellow, Edit, Remove item in it
-updating list item's location on item's removal, item's starting time, etc...
-making the "hold keys" option easier (click on item in the list with more than 1 index makes the hit down/up select those keys)
-instant update on the edit/add item window (like when you change octave for example, all related items should change, like index, etc...)
-making Save and SaveAS separate (SaveAs is only one working for now)
-make (PC) keyboard hotkeys for the keys in the application
-maybe rewrite the whole script (since the one is messy, and hard to read if you see it for the first time)

Posted Image

Btw, this script wouldn't have happened if there weren't midi udf by eynstyne

to start, click RECORD button, and click on to any keyboard key in the program, you can check the "Instant record" checkbox, in that case you skip the "add" window, and adding the key instantly. Program can detect how long have you been holding your key, and will set that time as default (which you can change). To edit item -> double click on item in the list. To remove item click DELETE on your keyboard when you select any of the item in the list. Hold Down and Release buttons are holding desired key/tone until the Release function releases it (see the example script in the zip).

feel free to develope it, since I dun have the time

edit: few more examples added (rename to *.PSC file, or you can open like TXT)

Attached Files


Edited by sandin, 08 May 2009 - 01:47 PM.








#2 CodyBarrett

CodyBarrett

    I LOVE Juicy Fruit!!!

  • Active Members
  • PipPipPipPipPipPip
  • 1,225 posts

Posted 07 May 2009 - 07:46 PM

WHOA!.. i haven't tested it.. but that looks sweet ^_^

#3 WideBoyDixon

WideBoyDixon

    Code Monkey

  • Active Members
  • PipPipPipPipPipPip
  • 381 posts

Posted 08 May 2009 - 10:24 AM

There's no doubt about it, sandin is king of the AutoIt GUI! It's such a good start that someone *should* develop from here.

WBD

Edited by WideBoyDixon, 08 May 2009 - 10:24 AM.


#4 sandin

sandin

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 569 posts

Posted 08 May 2009 - 10:52 AM

tnx bro ^_^

where's paulie? I'm sure he would be interested in things like this one.

#5 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 08 May 2009 - 10:55 AM

Wow awesome!

#6 sandin

sandin

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 569 posts

Posted 08 May 2009 - 11:13 AM

tnx BrettF

I added another example in the 1st post

#7 Toady

Toady

    Easy there turbo...

  • Active Members
  • PipPipPipPipPipPip
  • 698 posts

Posted 08 May 2009 - 03:53 PM

This is an awesome script, looks like a lot of time went in to it. 5/5!
www.itoady.com (Go here to download the MacroGamer installer)

#8 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,574 posts

Posted 08 May 2009 - 05:23 PM

Powerfully done.

5+

#9 UEZ

UEZ

    Never say never

  • MVPs
  • 4,822 posts

Posted 08 May 2009 - 08:33 PM

I have no talent for creating music but wonderful GUI and nice program anyway!

Well done! :)

UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#10 lordicast

lordicast

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 335 posts

Posted 11 May 2009 - 03:45 PM

Very Great! :)
[Cheeky]Comment[/Cheeky]

#11 torels

torels

    I Hacked 127.0.0.1! :D

  • Active Members
  • PipPipPipPipPipPip
  • 676 posts

Posted 11 May 2009 - 04:19 PM

Absolutely Wonderful :)
Some Projects:indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

#12 Szhlopp

Szhlopp

    DC Talk JF

  • Active Members
  • PipPipPipPipPipPip
  • 469 posts

Posted 11 May 2009 - 05:22 PM

Wow... just, wow.

#13 Yuraj

Yuraj

    Wayfarer

  • Active Members
  • Pip
  • 58 posts

Posted 11 May 2009 - 05:36 PM

Great! I Like It! :)

Edited by Yuraj, 11 May 2009 - 05:36 PM.

ShellExecute("http://www.yuraj.ucoz.com")ProcessClose(@AutoItPID)

#14 Will66

Will66

    Polymath

  • Active Members
  • PipPipPipPip
  • 202 posts

Posted 27 July 2009 - 04:30 PM

Well done sandin,thats fantastic work. Thankyou!
I too have been interested in midi for a while, alas i dabble in a few scripting languages but am not a master of autoit.
I've put this together to play midi notes directly from the keyboard. It has the abilty to play multiple notes at once but i've found it difficult to make it s responsive as it should be to user input.
Instrument can be set from the menu.
There are some things about the WindowEvents and dll calls i don't really understand fully to know where i've gone wrong. Its eating up CPU, and perhaps those who are more familiar with autoit can help make it better and offer some input on where i've gone wrong.
requires MidiUdf

Plain Text         
#include <SendMessage.au3> ;#include <misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Midiudf.au3> Opt("GUIOnEventMode", 1)  ; OnEvent mode     Global $Q                    =   2890 ;20     Global $W                    =   2990 ;20     Global $E                    =   "2A90" ;20     Global $R                    =   "2B90" ;20     Global $T                    =   "2C90" ;20     Global $Y                    =   "2D90" ;20     Global $U                    =   "2E90" ;20     Global $I                    =   "2F90" ;20     Global $O                    =   "3090" ;20     Global $P                    =   "3190" ;20     Global $A                    =   "3290" ;21     Global $S                    =   "3390" ;20     Global $D                    =   "3490" ;20     Global $F                    =    "3590" ;20     Global $G                    =   "3690" ;20     Global $H                    =   "3790" ;20     Global $J                    =   "3890" ;20     Global $K                    =   "3990" ;20     Global $L                    =   "3A90" ;20     Global $Z                    =   "3B90" ;20     Global $X                    =   "3C90" ;20     Global $C                    =   "3D90" ;20     Global $V                    =   "3E90" ;20     Global $B                    =   "3F90" ;20     Global $N                    =   "4090" ;20     Global $M                    =   "4190" ;20 Global $instrument_String="Grand Piano|Bright Piano|Electric Grand Piano|Honky-Tonk Piano|Electric piano|Electric Piano|" & _ "Harpsichord|Clavinet|Celesta|Glockenspiel|Music Box|Vibraphone|Marimba|Xylophone|Tubular bells|Dulcimer|Drawbar Organ|" & _ "Percussive Organ|Rock Organ|Church Organ|Reed Organ|Accordion|Harmonica|Tango Accordion|Nylon String Guitar|Steel String Guitar|" & _ "Jazz Guitar|Clean Electric Guitar|Muted Electric Guitar|Overdrive Guitar|Distortion Guitar|Guitar Harmonics|Accoustic Bass|" & _ "Fingered Bass|Picked Bass|Fretless Bass|Slap Bass 1|Slap Bass 2|Synth Bass 1|Synth Bass 2|Violin|Viola|Cello|Contrabass|" & _ "Tremolo Strings|Pizzicato Strings|Orchestral Harp|Timpani|String Ensemble 1|String Ensemble 2|Synth Strings 1|" & _ "Synth Strings 2|Choir ahh|Choir oohh|Synth Voice|Orchestral Hit|Trumpet|Trombone|Tuba|Muted Trumpet|French Horn|" & _ "Brass Section|Synth Brass 1|Synth Brass 2|Soprano Sax|Alto Sax|Tenor Sax|Baritone Sax|Oboe|English Horn|Bassoon|" & _ "Clarinet|Piccolo|Flute|Recorder|Pan flute|Blown Bottle|Shakuhachi|Whistle|Ocarina|Square Wave|Sawtooth Wave|Caliope|" & _ "Chiff|Charang|Voice|Fifths|Bass & Lead|New Age|Warm|PolySynth|Choir|Bowed|Metallic|Halo|Sweep|FX: Rain|FX: Soundtrack|" & _ "FX: Crystal|FX: Atmosphere|FX: Brightness|FX: Goblins|FX: Echo Drops|FX: Star Theme|Sitar|Banjo|Shamisen|Koto|Kalimba|" & _ "Bagpipe|Fiddle|Shanai|Tinkle bell|Agogo|Steel Drums|Woodblock|Taiko Drum|Melodic Tom|Synth Drum|Reverse Cymbal|" & _ "Guitar Fret Noise|Breath Noise|Seashore|Bird Tweet|Telephone Ring|Helicopter|Applause|Gunshot" Global $instrument_Array= StringSplit($instrument_String,"|") ;Global Const $WM_KEYDOWN = 0x0100 ;Global Const $WM_KEYUP = 0x0101 Dim $iKeyIndex="" Global $sKeyName,$fileitem $Gui = GUICreate("Key Name Demo (Esc to exit)", 400, 50) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") $instr_Menu=GUICtrlCreateMenu("&Instrument") GUICtrlSetOnEvent(-1, "_instChanged") for $zz = 1 to $instrument_Array[0]     $men1=GUICtrlCreateMenuItem($instrument_Array[$zz],$instr_Menu,-1,1)     GUICtrlSetOnEvent(-1, "_instChanged")     if $zz=1 then GUICtrlSetState(-1, $GUI_CHECKED) Next GUISetState(@SW_SHOW, $Gui) GUIRegisterMsg($WM_NCLBUTTONUP, "WindowEvents") GUIRegisterMsg($WM_KEYDOWN, "WindowEvents") GUIRegisterMsg($WM_KEYUP, "WindowEvents") HotKeySet("{Esc}", "Quit");  Esc to Exit Dim $Open = _MidiOutOpen() SetInstrument($Open,0);piano While 1     _SendMessage($Gui, $WM_SYSCOMMAND, 0xF012, 0)      $sKeyName = ""     ;sleep(100)   WEnd Func _instChanged() $ind=GUICtrlRead(@GUI_CtrlId,1)     if StringLen($ind>0) Then         for $zz = 1 to $instrument_Array[0]             if $ind=$instrument_Array[$zz] Then                 SetInstrument($Open,$zz-1)                 ;MsgBox(0,"",$ind & ":" & $zz-1)                 ExitLoop             EndIf         Next     EndIf EndFunc Func NoteOn($Handle, $NoteIdx)     If IsDeclared ( $NoteIdx ) Then         $NoteIdx = Eval($NoteIdx)         _MidiOutShortMsg($Handle, "0x0040" & $NoteIdx)     EndIf EndFunc Func NoteOff($Handle, $NoteIdx)     If IsDeclared ( $NoteIdx ) Then         $NoteIdx = Eval($NoteIdx)         _MidiOutShortMsg($Handle, "0x0000" & $NoteIdx)     EndIf Endfunc Func Play($Handle, $Notes, $Duration); Can play Single notes or use arrays for chords If Isarray($Notes) Then     For $i in $Notes     If $i > 87 then Return 0     $i-=1     _MidiOutShortMsg($Handle, $Notes[$i])     Next     Sleep($Duration)     For $i in $Notes     $i-=1     _MidiOutShortMsg($Handle, $Notes[$i])     Next Else     _MidiOutShortMsg($Handle, $Notes)     Sleep($Duration)     _MidiOutShortMsg($Handle, $Notes) EndIf EndFunc Func SetInstrument($Handle, $Instrument)     _MidiOutShortMsg($Handle,256 * $Instrument + 192) EndFunc Func Quit()     Exit EndFunc  ;==>Quit Func OnAutoItExit()     _MidiOutClose($Open)     GUIDelete($Gui) EndFunc   ;==>OnAutoItExit Func WindowEvents($hWnd, $Msg, $wParam, $lParam)     Switch $Msg         Case $WM_KEYUP             $aRet = DllCall('user32.dll', 'int', 'GetKeyNameText', 'int', $lParam, 'str', "", 'int', 256)             $sKeyName = $aRet[2]             $iKeyIndex=StringReplace($iKeyIndex,$sKeyName,"")             NoteOff($Open, $sKeyName)             ;ConsoleWrite($iKeyIndex & @CRLF)             ;ConsoleWrite("keyUp: " & $sKeyName & @CRLF)         Case $WM_KEYDOWN             $aRet = DllCall('user32.dll', 'int', 'GetKeyNameText', 'int', $lParam, 'str', "", 'int', 256)             $sKeyName = $aRet[2]             if Not StringInStr($iKeyIndex,$sKeyName) Then                 $iKeyIndex  = $iKeyIndex & $sKeyName                 NoteOn($Open, $sKeyName)             EndIf                 ;ConsoleWrite("keyDn: " & $sKeyName & @CRLF)     EndSwitch EndFunc  ;==>WindowEvents


#15 Josbe

Josbe

    Infrequent ghost ☺

  • Active Members
  • PipPipPipPipPipPip
  • 1,585 posts

Posted 27 July 2009 - 06:56 PM

Well done! >_<




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users