ioa747 Posted February 24 Share Posted February 24 the other day I saw a post 129594-piano-autoplayer that inspired me to do this. Here I must say that I have no idea about music. I googled a bit and found this page, with which I tuned my instrument. the letters were selected based on the page https://virtualpiano.net/ Just for fun expandcollapse popup#include <Array.au3> Local $iTempo = 120 Local $sSong = "" #Region ; ===( Pink Panther )=== ;https://virtualpiano.net/music-sheet/pink-panther-main-theme/ ;Pink Panther (Main Theme) ;TARGET LENGTH 00:57 ;<<|>> transposition -5 ;TEMPO 110 $sSong &= "Q w W e|||" $sSong &= "W w Q q|||" $sSong &= "Q w W e|||" $sSong &= "W w Q q|||" $sSong &= "Q w [WO] [ep]||a s||O" $sSong &= "p a s g f [Wp] [ws] [Qf]" $sSong &= "[qD]| |dspop| |" $sSong &= "Q w [WO] [ep]||a s||O" $sSong &= "p a s g f [ws] [Wf] [ej]" $sSong &= "[EH]|||" $sSong &= "Q w [WO] [ep]||a s||" $sSong &= "O p a s g f [Wp] [ws] [Qf]" $sSong &= "[qD]| |dspop| |" $sSong &= "Q w W e| j h f d s p" $sSong &= "[qD]d| Dd| [0D]d| Dd|" $sSong &= "[es]pop p|" $sSong &= "W w Q" $sSong &= "[qs]pop p| Q w W" $sSong &= "[es]pop p| W w Q" $sSong &= "[qs]pop p||[0f]|" $sSong &= "[6j] " #EndRegion ; ===( Pink Panther )=== _PlaySong($sSong, $iTempo) ;-------------------------------------------------------------------------------------------------------------------------------- Func _PlaySong($sSong, $iTempo = 220, $iLayer = 0) Local $sKey = "" $sKey &= "1=65.41;!=69.30;2=73.42;@=77.78;3=82.41;4=87.31;$=92.50;5=98.00;%=103.83;6=110.00;^=116.54;7=123.47" $sKey &= ";8=130.81;*=138.59;9=146.83;(=155.56;0=164.81;q=174.61;Q=185.00;w=196.00;W=207.65;e=220.00;E=233.08;r=246.94" $sKey &= ";t=261.63;T=277.18;y=293.66;Y=311.13;u=329.63;i=349.23;I=369.99;o=392.00;O=415.30;p=440.00;P=466.16;a=493.88" $sKey &= ";s=523.25;S=554.37;d=587.33;D=622.25;f=659.26;g=698.46;G=739.99;h=783.99;H=830.61;j=880.00;J=932.33;k=987.77" $sKey &= ";l=1046.50;L=1108.73;z=1174.66;Z=1244.51;x=1318.51;c=1396.91;C=1479.98;v=1567.98;V=1661.22;b=1760.00;B=1864.66;n=1975.53" $sKey &= ";m=2093.00" Local $aVal, $mKey[], $aKey = StringSplit($sKey, ";", 1) For $i = 1 To $aKey[0] $aVal = StringSplit($aKey[$i], "=", 1) $mKey[$aVal[1]] = $aVal[2] Next Local $aSong = StringSplit($sSong, "") Local $Frequency, $iScale = 1 Local $aSynChorTone[9], $bSynChor = False Local $hTimer1 = TimerInit() Local $hTimer For $i = 1 To $aSong[0] $hTimer = TimerInit() ConsoleWrite("->" & $aSong[$i] & "<- ") ConsoleWrite($mKey[$aSong[$i]]) Switch $aSong[$i] Case " " Sleep(20) ConsoleWrite("slp:20") Case "|" Sleep(700) ConsoleWrite("slp:700") Case ":" ;Sleep($iTempo + $iTempo) ConsoleWrite(":::::") Case "]" ;Sleep($iTempo + $iTempo) ConsoleWrite("]]]]]] [") $bSynChor = False For $x = 1 To $aSynChorTone[0] Run(@AutoItExe & ' /AutoIt3ExecuteLine "Beep(' & $aSynChorTone[$x] & ', ' & $iTempo & ')"') ConsoleWrite(' +' & $aSynChorTone[$x]) Next ConsoleWrite("]") $aSynChorTone[0] = 0 Sleep($iTempo) Case "[" ;Sleep($iTempo + $iTempo) ConsoleWrite("[[[[[[") $bSynChor = True Case Else If $bSynChor = False Then Beep(($mKey[$aSong[$i]] * $iScale), $iTempo) Else $aSynChorTone[0] += 1 $aSynChorTone[$aSynChorTone[0]] = $mKey[$aSong[$i]] * $iScale ConsoleWrite(" [" & $mKey[$aSong[$i]] * $iScale & "]") EndIf EndSwitch ConsoleWrite(" metro:" & Round(TimerDiff($hTimer) / 1000, 3) & " seconds " & @LF) Next ConsoleWrite("> Total time:" & Round(TimerDiff($hTimer1) / 1000, 0) & " seconds " & @LF) EndFunc ;==>_PlaySong jaberwacky 1 I know that I know nothing Link to comment Share on other sites More sharing options...
ioa747 Posted February 27 Author Share Posted February 27 Local $GoldenRatio = 1, $iFibonacciPrev = 1, $iFibonacciCurr = 1 For $x = 1 To 50 $iFibonacciCurr = $iFibonacciPrev + $iFibonacciCurr $GoldenRatio = Round($GoldenRatio * 1.618033988749, 0) ConsoleWrite($iFibonacciCurr & " - " & $GoldenRatio & " = " & $iFibonacciCurr - $GoldenRatio & @CRLF) $iFibonacciPrev = $iFibonacciCurr - $iFibonacciPrev Next I know that I know nothing 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