czardas Posted May 14, 2011 Share Posted May 14, 2011 (edited) Hirajoshi Wind ChimeLet me introduce you to the AutoIt Hirajoshi Wind Chime. There are seven 15 different chime arrangements to choose from : Gong, Okinawa, Insen, Nando-kyemyonjo, Kata-kumoi, Hirajoshi and Chaio. Thanks to the authors of the original Midi UDF. Without their contributions, Hirajoshi Wind Chime would never have existed.Latest Version is in expandcollapse popup#include 'MidiOutLite.au3' Global $open = _MidiOutOpen() ; $iChime - values range from 0 to 14 ; 0 .... Gong (CN) ..................... C D E G A C ; 1 .... Okinawa (JP) .................. C E F G B C ; 2 .... Insen (JP) .................... C Db F G Bb C ; 3 .... Nando-kyemyonjo (KR) .......... C D Eb F G C ; 4 .... Kata-kumoi (JP) ............... C D Eb F Ab C ; 5 .... Hirajoshi (JP) ................ C D Eb G Ab C ; 6 .... Chaio (CN) .................... C D F Ab Bb C ; 7 .... Ritsu (JP) .................... C Db Eb F Ab Bb C ; 8 .... Niagari (JP) .................. C Db F G Ab Bb C ; 9 .... Takemitsu Tree Line Mode 1 (JP) C D Eb Gb Ab B C ; 10 ... Takemitsu Tree Line Mode 2 (JP) C D Eb Gb Ab Bb C ; 11 ... P'yongio (KR) ................. C D F G A Bb C ; 12 ... Eskimo (1) .................... C D Eb F G Bb C ; 13 ... Eskimo (2) .................... C D E Gb Ab B C ; 14 ... Stravinsky .................... C Db Eb E F# G A Bb C HotKeySet("{ESC}", "_Quit") _AddLightBreeze(Random(0,14,1), 1) ; First param - Chime number 0 to 14 - see list. ; Second param - Randomise chimes 0 or 1. ; Third param Maximum calm in miliseconds. Func _AddLightBreeze($iChime, $iRandomise = 0, $iMaxCalm = 30000) Local $aChime = _LoadChime($iChime) Local $iRandomCalm, $iRandomNote, $iVolume = 65535, $iTranspose = 12 _MidiOutShortMsg($open,256 * 14 + 192) _MidiOutSetVolume() While 1 $iRandomNote = Random(0,7,1) _MidiOutshortmsg($open,$MIDINOTE[ $aChime[ $iRandomNote ] + $iTranspose ][0]) _MidiOutshortmsg($open,$MIDINOTE[ $aChime[ $iRandomNote ] + $iTranspose + 12 ][0]) ; Octave added. $iRandomCalm = Random(20,1000,1) If $iRandomCalm > 950 Then Sleep(Random(0,$iMaxCalm,1)) $iVolume = 65535 _MidiOutSetVolume() ElseIf $iRandomCalm > 750 Then Sleep(Int($iRandomCalm*Random(0.5,5))) $iVolume = Int($iVolume*1.2) If ($iVolume < 32768) Or ($iVolume > 65535) Then $iVolume = 65535 _MidiOutSetVolume($iVolume) Else Sleep(Random(50,500,1)) $iVolume = Int($iVolume*.9) If $iVolume < 6554 Then $iVolume = 32768 _MidiOutSetVolume($iVolume) EndIf If $iRandomise And Not Random(0, 10, 1) Then $aChime = _LoadChime(Random(0, 14, 1)) ; $iTranspose = Random(7, 18, 1) ; Optional - transposes the notes. EndIf WEnd EndFunc Func _LoadChime($iChime = 3) Local $aScale[15][8] = _ [[39,41,43,46,48,51,53,55], _ ; Gong [39,43,44,46,50,51,55,56], _ ; Okinawa [37,39,40,44,46,49,51,53], _ ; Insen [39,41,42,44,46,51,53,54], _ ; Nando-kyemyonjo [39,41,42,44,47,51,53,54], _ ; Kata-kumoi [39,41,42,46,47,51,53,54], _ ; Hirajoshi [37,39,41,44,46,49,51,53], _ ; Chaio [37,39,40,42,44,47,49,51], _ ; Ritsu [37,39,40,43,44,46,49,51], _ ; Niagari [39,41,42,45,47,50,51,53], _ ; Takemitsu Tree Line Mode 1 [37,39,41,42,45,47,49,51], _ ; Takemitsu Tree Line Mode 2 [39,41,44,46,48,49,51,53], _ ; P'yongio [37,39,41,42,44,46,49,51], _ ; Eskimo (1) [39,41,43,45,47,50,51,53], _ ; Eskimo (2) [40,41,43,44,46,47,49,50]] ; Stravinsky Local $aTemp[8] For $i = 0 To 7 $aTemp[$i] = $aScale[$iChime][$i] Next Return $aTemp EndFunc Func _Quit() Sleep(1000) ; Allow the volume to fade a little before closing. _MidiOutSetVolume() _MidiOutclose($open) Exit EndFuncCredit must go to Eynstyne and Ascend4nt for the functions in the following script.MidiOutLite.au3expandcollapse popup; This code is a minimalistic version of Ascend4nt's adaptation of the original midi UDF by Eynstyne. ; For the original source and a full description of all midi constants (including instruments): see => ; http://www.autoitscript.com/forum/topic/37072-midi-udf/page__view__findpost__p__810725 ; The selected functions are for midi output only, so any musical input needs to be hard coded. ; The midi note values are now stored in a 2D array, as opposed to using individual constants. ; One line of code has been added to _MidiOutSetVolume to ensure equal output on both speakers. ; Default midi volume has been set to maximum. Const $MIDINOTE[88][2] = [ _ ; [?][0] = Play, [?][1] = Stop [0x00401590,0x00001590], _ ; [0][?] .... A [0x00401690,0x00001690], _ ; [1][?] .... Bb [0x00401790,0x00001790], _ ; [2][?] .... B [0x00401890,0x00001890], _ ; [3][?] .... C First Octave [0x00401990,0x00001990], _ ; [4][?] .... Db [0x00401A90,0x00001A90], _ ; [5][?] .... D [0x00401B90,0x00001B90], _ ; [6][?] .... Eb [0x00401C90,0x00001C90], _ ; [7][?] .... E [0x00401D90,0x00001D90], _ ; [8][?] .... F [0x00401E90,0x00001E90], _ ; [9][?] .... Gb [0x00401F90,0x00001F90], _ ; [10][?] ... G [0x00402090,0x00002090], _ ; [11][?] ... Ab [0x00402190,0x00002190], _ ; [12][?] ... A [0x00402290,0x00002290], _ ; [13][?] ... Bb [0x00402390,0x00002390], _ ; [14][?] ... B [0x00402490,0x00002490], _ ; [15][?] ... C Second Octave [0x00402590,0x00002590], _ ; [16][?] ... Db [0x00402690,0x00002690], _ ; [17][?] ... D [0x00402790,0x00002790], _ ; [18][?] ... Eb [0x00402890,0x00002890], _ ; [19][?] ... E [0x00402990,0x00002990], _ ; [20][?] ... F [0x00402A90,0x00002A90], _ ; [21][?] ... Gb [0x00402B90,0x00002B90], _ ; [22][?] ... G [0x00402C90,0x00002C90], _ ; [23][?] ... Ab [0x00402D90,0x00002D90], _ ; [24][?] ... A [0x00402E90,0x00002E90], _ ; [25][?] ... Bb [0x00402F90,0x00002F90], _ ; [26][?] ... B [0x00403090,0x00003090], _ ; [27][?] ... C Third Octave [0x00403190,0x00003190], _ ; [28][?] ... Db [0x00403290,0x00003290], _ ; [29][?] ... D [0x00403390,0x00003390], _ ; [30][?] ... Eb [0x00403490,0x00003490], _ ; [31][?] ... E [0x00403590,0x00003590], _ ; [32][?] ... F [0x00403690,0x00003690], _ ; [33][?] ... Gb [0x00403790,0x00003790], _ ; [34][?] ... G [0x00403890,0x00003890], _ ; [35][?] ... Ab [0x00403990,0x00003990], _ ; [36][?] ... A [0x00403A90,0x00003A90], _ ; [37][?] ... Bb [0x00403B90,0x00003B90], _ ; [38][?] ... B [0x00403C90,0x00003C90], _ ; [39][?] ... C Fourth Octave - Middle C [0x00403D90,0x00003D90], _ ; [40][?] ... Db [0x00403E90,0x00003E90], _ ; [41][?] ... D [0x00403F90,0x00003F90], _ ; [42][?] ... Eb [0x00404090,0x00004090], _ ; [43][?] ... E [0x00404190,0x00004190], _ ; [44][?] ... F [0x00404290,0x00004290], _ ; [45][?] ... Gb [0x00404390,0x00004390], _ ; [46][?] ... G [0x00404490,0x00004490], _ ; [47][?] ... Ab [0x00404590,0x00004590], _ ; [48][?] ... A [0x00404690,0x00004690], _ ; [49][?] ... Bb [0x00404790,0x00004790], _ ; [50][?] ... B [0x00404890,0x00004890], _ ; [51][?] ... C Fifth Octave [0x00404990,0x00004990], _ ; [52][?] ... Db [0x00404A90,0x00004A90], _ ; [53][?] ... D [0x00404B90,0x00004B90], _ ; [54][?] ... Eb [0x00404C90,0x00004C90], _ ; [55][?] ... E [0x00404D90,0x00004D90], _ ; [56][?] ... F [0x00404E90,0x00004E90], _ ; [57][?] ... Gb [0x00404F90,0x00004F90], _ ; [58][?] ... G [0x00405090,0x00005090], _ ; [59][?] ... Ab [0x00405190,0x00005190], _ ; [60][?] ... A [0x00405290,0x00005290], _ ; [61][?] ... Bb [0x00405390,0x00005390], _ ; [62][?] ... B [0x00405490,0x00005490], _ ; [63][?] ... C Sixth Octave [0x00405590,0x00005590], _ ; [64][?] ... Db [0x00405690,0x00005690], _ ; [65][?] ... D [0x00405790,0x00005790], _ ; [66][?] ... Eb [0x00405890,0x00005890], _ ; [67][?] ... E [0x00405990,0x00005990], _ ; [68][?] ... F [0x00405A90,0x00005A90], _ ; [69][?] ... Gb [0x00405B90,0x00005B90], _ ; [70][?] ... G [0x00405C90,0x00005C90], _ ; [71][?] ... Ab [0x00405D90,0x00005D90], _ ; [72][?] ... A [0x00405E90,0x00005E90], _ ; [73][?] ... Bb [0x00405F90,0x00005F90], _ ; [74][?] ... B [0x00406090,0x00006090], _ ; [75][?] ... C Seventh Octave [0x00406190,0x00006190], _ ; [76][?] ... Db [0x00406290,0x00006290], _ ; [77][?] ... D [0x00406390,0x00006390], _ ; [78][?] ... Eb [0x00406490,0x00006490], _ ; [79][?] ... E [0x00406590,0x00006590], _ ; [80][?] ... F [0x00406690,0x00006690], _ ; [81][?] ... Gb [0x00406790,0x00006790], _ ; [82][?] ... G [0x00406890,0x00006890], _ ; [83][?] ... Ab [0x00406990,0x00006990], _ ; [84][?] ... A [0x00406A90,0x00006A90], _ ; [85][?] ... Bb [0x00406B90,0x00006B90], _ ; [86][?] ... B [0x00406C90,0x00006C90]] ; [87][?] ... C Eighth Octave ;======================================================= ;Retrieves a MIDI handle and Opens the Device ;Parameters(Optional) - Device ID, Window Callback, ; instance, flags ;Author : Eynstyne ;Library : Microsoft winmm.dll ;======================================================= Func _MidiOutOpen($devid = 0, $callback = 0, $instance = 0, $flags = 0) Local $ret = DllCall("winmm.dll", "long", "midiOutOpen", "handle*", 0, "int", $devid, "dword_ptr", $callback, "dword_ptr", $instance, "long", $flags) If @error Then Return SetError(@error,0,0) If $ret[0] Then Return SetError(-1,$ret[0],0) Return $ret[1] EndFunc ;==>_MidiOutOpen ;======================================================= ;======================================================= ;Closes Midi Output/Input devices ;Parameters - MidiHandle ;Author : Eynstyne ;Library : Microsoft winmm.dll ;======================================================= Func _MidiOutClose ($hmidiout) Local $ret = DllCall("winmm.dll", "long", "midiOutClose", "handle", $hmidiout) If @error Then Return SetError(@error,0,0) If $ret[0] Then Return SetError(-1,$ret[0],0) Return $ret[0] EndFunc ;==>_MidiOutClose ;======================================================= ;Gets the Mixer Volume for MIDI ;Parameters - None ;Author : Eynstyne ;Library : Microsoft winmm.dll ;======================================================= Func _MidiOutGetVolume ($devid = 0) Local $ret = DllCall("winmm.dll", "long", "midiOutGetVolume", "handle", $devid, "dword*",0) If @error Then Return SetError(@error,0,0) If $ret[0] Then Return SetError(-1,$ret[0],0) Return $ret[2] EndFunc ;==>_MidiOutGetVolume ;======================================================= ;Sets the Mixer Volume for MIDI ;Parameters - Volume (0 - 65535) ;Author : Eynstyne ;Library : Microsoft winmm.dll ;======================================================= Func _MidiOutSetVolume($iVolume = 65535, $devid = 0) Local $iMixVolume=BitAND($iVolume,0xFFFF)+BitShift(BitAND($iVolume,0xFFFF),-16) ; From Ascend4nt Local $ret = DllCall("winmm.dll", "long", "midiOutSetVolume", "handle", $devid, "int", $iMixVolume) If @error Then Return SetError(@error,0,0) If $ret[0] Then Return SetError(-1,$ret[0],0) Return $ret[0] EndFunc ;==> _MidiOutSetVolume ;======================================================= ;MIDI Message Send Function ;Parameters - Message as Hexcode or Constant ;Author : Eynstyne ;Library : Microsoft winmm.dll ;======================================================= Func _MidiOutShortMsg($hmidiout, $msg) Local $ret = DllCall("winmm.dll", "long", "midiOutShortMsg", "handle", $hmidiout, "long", $msg) If @error Then Return SetError(@error,0,0) If $ret[0] Then Return SetError(-1,$ret[0],0) Return $ret[0] EndFunc ;==>_MidiOutShortMsg Edited June 14, 2012 by czardas jaberwacky 1 operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
czardas Posted May 15, 2011 Author Share Posted May 15, 2011 (edited) The idea behind this script stems from a question a guitar student asked me several years ago:What would be the best arrangement of notes for a wind chime?I didn't have an answer at the time, and I don't believe there is a correct answer, however the question still intrigued me. Clearly simulating the chimes is easier than assembling real chimes. There are some technical aspects to resonance that make the standard tuning less attractive, but that's a side issue. I found the maximum volume for Tubular Bells, which is the instrument used for the chimes, a little on the low side. So I have added a second instance of each note to be played simultaneously, one octave higher than the original. I'm curious to know which chime arrangement (if any) you like best out of the seven available. Edited May 15, 2011 by czardas operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
somdcomputerguy Posted May 15, 2011 Share Posted May 15, 2011 This is an interesting script. I used to have a weather station hooked up to a PC, that then updated a webpage. Someday I'm sure I will get that whole thing operating again, and tie this script in with the anemometer. Good job! - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
czardas Posted May 15, 2011 Author Share Posted May 15, 2011 (edited) This is an interesting script. I used to have a weather station hooked up to a PC, that then updated a webpage. Someday I'm sure I will get that whole thing operating again, and tie this script in with the anemometer.Good job!Thanks for showing interest in this. I intend to add some different sounding chime arrangements shortly. I imagine it would be nice having something like this reacting to changes in real weather conditions. I would be interested to hear about it, if you set that up. Edited May 15, 2011 by czardas operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
czardas Posted June 7, 2012 Author Share Posted June 7, 2012 (edited) I've added eight new chime arrangements to this script: Ritsu, Niagari, Takemitsu Tree Line Mode 1, Takemitsu Tree Line Mode 2, P'yongio, Eskimo (1), Eskimo (2) and Stravinsky. You may now also switch randomly between chimes, as occurs in the example. Have fun! Edited June 7, 2012 by czardas operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
czardas Posted June 8, 2012 Author Share Posted June 8, 2012 (edited) Finally I decided to add a GUI to this script, albeit rather a simple one. You will need MidiOutLite.au3 in the first post above. Three more chimes have also been added. Use the arrow keys to select one from the combo. It also includes a musically brain dead artificial intelligence with ideas above its station. It is unlikely to write a number one hit in the foreseeable future. Latest Version is in expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ComboConstants.au3> #include <GUIComboBox.au3> #include <EditConstants.au3> #include 'MidiOutLite.au3' Global $open = _MidiOutOpen(), $bInterrupt ; $iChime - values range from 0 to 17 ; 0 .... Gong (CN) ..................... C D E G A C ; 1 .... Okinawa (JP) .................. C E F G B C ; 2 .... Insen (JP) .................... C Db F G Bb C ; 3 .... Nando-kyemyonjo (KR) .......... C D Eb F G C ; 4 .... Kata-kumoi (JP) ............... C D Eb F Ab C ; 5 .... Hirajoshi (JP) ................ C D Eb G Ab C ; 6 .... Chaio (CN) .................... C D F Ab Bb C ; 7 .... Ritsu (JP) .................... C Db Eb F Ab Bb C ; 8 .... Niagari (JP) .................. C Db F G Ab Bb C ; 9 .... Takemitsu Tree Line Mode 1 (JP) C D Eb Gb Ab B C ; 10 ... Takemitsu Tree Line Mode 2 (JP) C D Eb Gb Ab Bb C ; 11 ... P'yongio (KR) ................. C D F G A Bb C ; 12 ... Eskimo (1) .................... C D Eb F G Bb C ; 13 ... Eskimo (2) .................... C D E Gb Ab B C ; 14 ... Whole Tone .................... C D E F# G# A# C ; 15 ... Tritone ....................... C Db E F# G Bb C ; 16 ... Messiaen Mode 5 ............... C Db E# F# G B C ; 17 ... Stravinsky .................... C Db Eb E F# G A Bb C _Main() Func _Main() Local $hGui = GUICreate("Wind Chime", 220, 60) Local $hCombo = GUICtrlCreateCombo("Gong", 4,5, 120, 20, $CBS_DROPDOWNLIST) _GUICtrlComboBox_SetMinVisible(-1, 1) GUICtrlSetData(-1, "Okinawa|Insen|Nando-kyemyonjo|Kata-kumoi|Hirajoshi|Chaio|Ritsu|Niagari|Takemitsu (1)|" _ & "Takemitsu (2)|P'yongio|Eskimo (1)|Eskimo (2)|Whole Tone|Tritone|Messiaen Mode 5|Stravinsky","Insen") $hCheckBox = GUICtrlCreateCheckbox(" Randomise", 137, 5) $input = GUICtrlCreateInput("30", 42, 34, 45, 20, $ES_NUMBER) $updown = GUICtrlCreateUpdown($input) GUICtrlSetLimit ($updown, 999, 1) GUICtrlCreateLabel("Delay", 7, 37, 29, 20) $hBtnStart = GUICtrlCreateButton("Start", 100, 34, 50, 20) $hBtnStop = GUICtrlCreateButton("Stop", 163, 34, 50, 20) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $hBtnStart Then GUICtrlSetState($hBtnStart, $GUI_DISABLE) $iChime = _GUICtrlComboBox_GetTopIndex($hCombo) $iFlag = 0 If GUICtrlRead($hCheckBox) = $GUI_CHECKED Then $iFlag = 1 _AddLightBreeze($iChime, $iFlag, GUICtrlRead($input)*1000) GUICtrlSetState($hBtnStart, $GUI_ENABLE) EndIf WEnd EndFunc Func _AddLightBreeze($iChime, $iRandomise = 0, $iMaxCalm = 30000) Local $aChime = _LoadChime($iChime) Local $iRandomCalm, $iRandomNote, $iVolume = 65535, $iTranspose _Transpose($iChime, $iTranspose) _MidiOutShortMsg($open,256 * 14 + 192) _MidiOutSetVolume() While 1 $bInterrupt = False $iRandomNote = Random(0,7,1) _MidiOutshortmsg($open,$MIDINOTE[ $aChime[ $iRandomNote ] + $iTranspose ][0]) _MidiOutshortmsg($open,$MIDINOTE[ $aChime[ $iRandomNote ] + $iTranspose + 12 ][0]) ; Octave added. $iRandomCalm = Random(20,1000,1) If $iRandomCalm > 950 Then $iDelay = Random(0,$iMaxCalm,1) If $iDelay > 500 Then $iDelay /= 500 For $i = 1 To Round($iDelay) Sleep (500) If $bInterrupt Then $bInterrupt = False Return EndIf Next Else Sleep ($iDelay) EndIf $iVolume = 65535 _MidiOutSetVolume() ElseIf $iRandomCalm > 750 Then Sleep(Int($iRandomCalm*Random(0.5,5))) $iVolume = Int($iVolume*1.2) If ($iVolume < 32768) Or ($iVolume > 65535) Then $iVolume = 65535 _MidiOutSetVolume($iVolume) Else Sleep(Random(50,500,1)) $iVolume = Int($iVolume*.9) If $iVolume < 6554 Then $iVolume = 32768 _MidiOutSetVolume($iVolume) EndIf If $iRandomise And Not Random(0, 10, 1) Then $iChime = Random(0, 17, 1) $aChime = _LoadChime($iChime) _Transpose($iChime, $iTranspose) EndIf If $bInterrupt Then $bInterrupt = False Return EndIf WEnd EndFunc ;==> _AddLightBreeze Func _LoadChime($iChime = 2) Local $aScale[18][8] = _ [[39,41,43,46,48,51,53,55], _ ; Gong [39,43,44,46,50,51,55,56], _ ; Okinawa [37,39,40,44,46,49,51,53], _ ; Insen [39,41,42,44,46,51,53,54], _ ; Nando-kyemyonjo [39,41,42,44,47,51,53,54], _ ; Kata-kumoi [39,41,42,46,47,51,53,54], _ ; Hirajoshi [37,39,41,44,46,49,51,53], _ ; Chaio [37,39,40,42,44,47,49,51], _ ; Ritsu [37,39,40,43,44,46,49,51], _ ; Niagari [39,41,42,45,47,50,51,53], _ ; Takemitsu Tree Line Mode 1 [37,39,41,42,45,47,49,51], _ ; Takemitsu Tree Line Mode 2 [39,41,44,46,48,49,51,53], _ ; P'yongio [37,39,41,42,44,46,49,51], _ ; Eskimo (1) [39,41,43,45,47,50,51,53], _ ; Eskimo (2) [39,41,43,45,47,49,51,53], _ ; Whole Tone [39,40,43,45,46,49,51,52], _ ; Tritone [39,40,44,45,46,50,51,52], _ ; Messiaen Mode 5 [40,41,43,44,46,47,49,50]] ; Stravinsky Local $aTemp[8] For $i = 0 To 7 $aTemp[$i] = $aScale[$iChime][$i] Next Return $aTemp EndFunc ;==> _LoadChime Func _Transpose($iChime, ByRef $iTranspose) Switch $iChime Case 2, 6, 7, 8, 10, 15 $iTranspose = 10 Case 14, 17 $iTranspose = 14 Case Else $iTranspose = 15 EndSwitch EndFunc ;==> _Transpose Func _Quit() Sleep(1000) ; Allow the volume to fade a little before closing. _MidiOutSetVolume() _MidiOutclose($open) Exit EndFunc ;==> _Quit Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam) If BitAND($wParam, 0x0000FFFF) = 9 Then $bInterrupt = True EndFunc ;==> _WM_COMMANDEditOops, I just realised I forgot to change one value during an edit. Updated code. Probably doesn't make much difference to the outcome. LOL Edited June 15, 2012 by czardas jaberwacky 1 operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
somdcomputerguy Posted June 8, 2012 Share Posted June 8, 2012 (edited) You know, I have been using your windchime script since shortly after you originally posted it here. I was running the script in the background just yesterday! I'm excited that you've added a GUI; I planned on doing that myself, well I occasionally thought about it anyway.. I once ran a 'weather station', so I also briefly thought about integrating the data returned from the anemometer with the script. I'm certainly going to get the updated version posted here. Thanks again! add: I just read thru this whole thread.. the monkey on my back (that used to smoke too many Camels..) seems to be accompanied with a parrot now.. Edited June 8, 2012 by somdcomputerguy czardas 1 - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
czardas Posted June 8, 2012 Author Share Posted June 8, 2012 (edited) Thanks somdcomputerguy. I'm happy at least two people like this script. I just spent about an hour listening in Randomise mode with an minimum maximum delay (calm period) of one second. It drove me crazy. In Randomise mode the program loads different chimes randomly and then plays a few notes before selecting another chime. Something like this requires a lot of testing (ie listening) to figure out how closely it resembles a real wind chime. Eskimo (2) is becoming one of my favourites. It sounds better with a longer delay. when you are busy doing something in the next room. It just pipes up out of the blue every time there is a random gust of wind. If you have fancy echo effects on your sound card, I suggest you also give them a try. Edited June 8, 2012 by czardas operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
MvGulik Posted June 9, 2012 Share Posted June 9, 2012 (edited) to figure out how closely it resembles a real wind chime.Simulating the ((yep) effect of the) wind. Mmm. Probably would need some blobbing, or other smoother functions, to make it act more like a real chime with the wind blowing trough it. (just a fast thought. As I have not tried, or looked at, your script.) Edited June 9, 2012 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
czardas Posted June 9, 2012 Author Share Posted June 9, 2012 (edited) Well it's more a case of simulating the effect of the wind rather than simulating the wind itself. My simulation is actually very crude. I also didn't spend much time on the musical element. All the chimes kind of center around Eb major or minor (a kind of mixed tonality), so when in Randomise mode, switching chimes is less obvious. However the scales used are mainly ethnic in origin and such a theoretical framework is, to a greater degree, out of context. I think somdcomputerguy's idea of hooking this up to a real anemometer is more aesthetically pleasing. To me this script is more of a diversion from other more serious work, but perhaps it's worth spending a bit more time on because I don't think there are many free wind chimes online. Some parts of the code are a bit sloppy, but that's easy to fix. I'll clean it up this weekend. Edited June 9, 2012 by czardas operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
czardas Posted June 12, 2012 Author Share Posted June 12, 2012 (edited) New Version includes major changes:Improvements made to wind simulation and more realisic correlation between average wind speed and chime activity using an asymptotic algorithm. Wind speeds range from 1 to 60 mph. There are now eleven different instruments to choose from - each creating a unique ambience. I have retuned all the chimes to produce much better musical results in Randomise mode. There will always be some accidental dissonances with wind chimes, but the random element can sometimes produce surprising and interesting results. I have also fixed a couple of errors in the earlier chime arrangements, created a new Custom GUI. Latest Version (30-12-2012)hirajoshi2.4.3.zipPrevious Downloads 87Change Log (20-06-2012)Added hirajoshi iconAdded the option to update wind speed in real timeAdded the option to switch to randomise mode in real timeAdded the option to change display picture in real timeRenamed Chime 1 to Tubular BellsRenamed Chime 2 to FX CrystalRenamed Guitar 1 to Classical GuitarRenamed Guitar 2 to Jazz GuitarRenamed Atmospheric to Metalic (may be removed altogether)Added Instrument - PianoRewritten much of the code handling midi functionsFurther GUI related ChangesChange Log (14-06-2012)Fixed: combo navigation - Thanks for the feedback BrewManNHAdded: combo auto-validationTransposed: the whole tone chime arrangement up by one semitoneRemoved: tritone chime arrangementRemoved: Messiaen mode 5 chime arrangementMinor changes to the codeChange Log (30-12-2012)Increased the top wind speedAdded dynamicsEat your heart out Pink Floyd! Have fun! Edited January 2, 2013 by czardas powbam 1 operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
BrewManNH Posted June 12, 2012 Share Posted June 12, 2012 I found a problem with using this on my system (Win7 x64), not sure if it is my computer or how the script is written. _GUICtrlComboBox_SetMinVisible(-1, 1) This won't display anything in the drop down for the combo boxes, so I didn't realize at first that there were different settings to use until I clicked the randomize button. Also, if I comment out those lines, I get the dropdown box to open but the $ichimes and $iInstrument values later in the script always returned 0. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator Link to comment Share on other sites More sharing options...
czardas Posted June 12, 2012 Author Share Posted June 12, 2012 (edited) Have you tried using the arrow keys to navigate the combo boxes? I think this could be because I'm using $CBS_DROPDOWNLIST to create a read only control. For some reason this didn't seem to like scroll bars, so I set the minimum visible to 1. You have to navigate the combo boxes using the arrow keys. Did you get any sound? 0 is a valid return valiue for both $ichime and $iInstrument. Edited June 12, 2012 by czardas operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
BrewManNH Posted June 12, 2012 Share Posted June 12, 2012 Yes I got it to work with the arrow keys. But my only point in the second part was that if you comment out the setminvisible lines, it always returns the wrong values. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator Link to comment Share on other sites More sharing options...
czardas Posted June 12, 2012 Author Share Posted June 12, 2012 (edited) Okay, I don't know why it would do that. (I think I figured it out). At least it's not a bug because the program is working as intended. I didn't want the dropdown to extend beyond the lower border of the GUI and I don't think you can combine $CBS_DROPDOWNLIST with a scroll bar because the style creates a static text field. I might try to figure something out later (maybe) - there are alternatives, although I think using the arrow keys is okay.EditI have now changed the combos, so you can type rubbish in them if you want to (v2.1). Anyway the GUI is by far the least interesting aspect of this program. I didn't manage to resolve the Read Only Combo with a Scroll Bar. Maybe the solution will come to me. Edited June 15, 2012 by czardas operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
czardas Posted June 14, 2012 Author Share Posted June 14, 2012 (edited) New Version - see the zip file attached to Now that I have removed two of the synthetic scales from the set, the consonance to dissonance ratio in Randomise mode seems about right. It's probably about as good as it can get (with the current set of chimes) considering the pseudo-randomness of the rhythm. As far as experiments go, I'd have to say I'm pleased with the results - it's definately much more harmonious than it was previously.StatisticsNote Distribution - among all chimes (excluding octave repeats)C = 15 occurencesC# = 0D = 12D# = 2E = 11F = 10F# = 4G = 8G# = 6A = 11A# = 2B = 10The above statistics are a result of the chimes being tuned to the following tonic notes.C GongC OkinawaG InsenA Nando-kyemyonjoA Kata-kumoiA HirajoshiA ChaioE RitsuB NiagariA Takemitsu Tree Line Mode 1D Takemitsu Tree Line Mode 2G P'yongioA Eskimo (1)C Eskimo (2)C Whole ToneB Stravinsky(Perhaps not universally) Stravinsky's name is sometimes associated with the diminished scale formed from the following repeating sequence: semitone - whole tone. Full details of all scale arrangements are notated in the source code.In all my years of listening to music I have never heard the harp played by the wind before. Edited June 15, 2012 by czardas operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
MvGulik Posted June 16, 2012 Share Posted June 16, 2012 Speaking of faith, I hope you noticed that I added blobbing to the wind at your suggestion. Yes yes. ... Well, I saw the GUI "wind speed" speed setting that is. (nice GUI background) ... Upped your DL count while I'm at it. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
MvGulik Posted June 16, 2012 Share Posted June 16, 2012 Sound pretty good to me. PS: Randomize and Wind-speed are still active while in playing mode. But ... while changing the wind-speed the change was ignored. (assuming the same for Randomize, although I'm not sure what it's randomizes - As I did not hear any significant change when using it (was short use.)) "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
czardas Posted June 16, 2012 Author Share Posted June 16, 2012 (edited) Yes yes. ... Well, I saw the GUI "wind speed" speed setting that is. (nice GUI background) ... Upped your DL count while I'm at it. LOL, I shouldn't go prompting people (but for your earlier comment about wind simulation). I'm glad you like the way it sounds. I'm not sure how closely it resembles wind in reality. The following line of code controls the time delay intended to mimic periods of calm between gusts of wind. Line 194 $iDelay = Round((Random(.001,1)^2) *Random(999,Round((3600 /($iSpeed^2)) *1000)) *$fAdjustDelay) Where $iDelay is the delay in miliseconds between notes. $iSpeed is the wind speed $fAdjustDelay is a floating point number to fine tune the result Admittedly - it was pretty much a question of trial and error. PS: Randomize and Wind-speed are still active while in playing mode. But ... while changing the wind-speed the change was ignored. That's a valid point. I only disabled the combo controls and the picture during play because it was necessary and to keep the code simple. I'll think about whether to allow the other controls to respond or whether to disable them during play (the easier option). This does require attention. For now you will need to hit the stop button for new settings to take effect. .. (assuming the same for Randomize, although I'm not sure what it's randomizes - As I did not hear any significant change when using it (was short use.) Randomise randomises the chime selection at random intervals, so the note selection varies just enough to keep it interesting without wandering too far off key or sounding badly out of tune (at least most of the time ) Thanks to all for your comments: the feedback has been very helpful.. Edited June 20, 2012 by czardas operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
MvGulik Posted June 19, 2012 Share Posted June 19, 2012 Oops, I think I have a "really" crappy midi player. (some obscure on-board SoundMax thing.) When playing Atmospheric it tents to leave some background tone playing after pressing [stop] (will stop playing that note when closing the application) Something similar also happened when using guitar2 ... but that one is still ringing after closing the application. (Seems a system restart is in order in this case.) Seems related to playing a note for a second time wile the same note is also currently being played. Other than that ... I still like it. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now