Musik Visualiserung

  • Habe ein Skript gefunden das sehr coole Muster auf das Display zeichnet

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <FontConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    Opt("OnExitFunc", "endscript")
    Global Const $Pi = 3.1415926535897932384626
    Global Const $width = @DesktopWidth+ 100
    Global Const $height = @DesktopHeight+100
    Global $hGUI, $hWnd, $hGraphic, $ParticleBitmap, $ParticleBuffer, $hBrush0, $hBrush1, $hBrush2, $Pen
    Global $starting_point, $i, $j, $k, $xcoord1, $ycoord1, $xcoord2, $ycoord2, $size, $red, $green, $blue, $start

    [/autoit] [autoit][/autoit] [autoit]

    ; Create GUI
    $hGUI = GUICreate("", $width, $height, -50, -50, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
    $hWnd = WinGetHandle($hGUI)
    ;Send("#m")
    GUISetState()
    ;ControlHide("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]")

    [/autoit] [autoit][/autoit] [autoit]

    Global $s = TimerInit()

    [/autoit] [autoit][/autoit] [autoit]

    ; Draw an ellipse
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) ;create graphic
    $ParticleBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic) ;create bitmap
    $ParticleBuffer = _GDIPlus_ImageGetGraphicsContext($ParticleBitmap) ;create buffer
    $hBrush1 = _GDIPlus_BrushCreateSolid(0x7F777777)
    AntiAlias($ParticleBuffer, 4)
    _GDIPlus_GraphicsClear($ParticleBuffer) ;clear buffer

    [/autoit] [autoit][/autoit] [autoit]

    $start = -25
    $i = $start
    $starting_point = 0

    [/autoit] [autoit][/autoit] [autoit]

    ; Loop until user exits
    Do
    $red = ((Sin(2 ^ 0 * $i / 2 ^ 5) + 1) / 2) * 256
    $green = ((Sin(2 ^ 0 * $i / 2 ^ 7) + 1) / 2) * 256
    $blue = ((Sin(2 ^ 0 * $i / 2 ^ 9) + 1) / 2) * 256
    $hBrush1 = _GDIPlus_BrushCreateSolid("0x0F" & Hex($red, 2) & Hex($green, 2) & Hex($blue, 2))
    $Pen = _GDIPlus_PenCreate("0xEF" & Hex($red, 2) & Hex($green, 2) & Hex($blue, 2), 1)
    _GDIPlus_GraphicsClear($ParticleBuffer) ;clear buffer
    $k = 2 ^ 9
    $starting_point -= 0.05
    For $j = 1 To $k Step 8
    $size = $i - $j
    $xcoord1 = $width / 2 - (($i - $j) / 2) + Sin($starting_point) * - Sin(($i - $j) * $Pi / 90) * 64
    $ycoord1 = $height / 2 - (($i - $j) / 2) + - Cos($starting_point) * Cos(($i - $j) * $Pi / 90) * 32
    $xcoord2 = $width / 2 - (-($i - $j) / 2) + Sin($starting_point) * - Sin(($i - $j) * $Pi / 90) * 64
    $ycoord2 = $height / 2 - (($i - $j) / 2) + - Cos($starting_point) * Cos(($i - $j) * $Pi / 90) * 32
    _GDIPlus_GraphicsDrawRect($ParticleBuffer, $xcoord1, $ycoord1, $size, $size, $Pen)
    ;~ _GDIPlus_GraphicsFillRect($ParticleBuffer, $xcoord1, $ycoord1, $size, $size, $hBrush1)
    Next
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $ParticleBitmap, 0, 0, $width, $height) ;copy to bitmap
    $i += 2
    If $i > $k + 2 ^ 9 Then $i = $start

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(20)
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func AntiAlias($hGraphics, $iMode)
    Local $aResult
    $aResult = DllCall($ghGDIPDll, "int", "GdipSetSmoothingMode", "hwnd", $hGraphics, "int", $iMode)
    If @error Then Return SetError(@error, @extended, False)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc ;==>AntiAlias

    [/autoit]

    Nun wollte ich das dieses Muster (oder auch andere die ich noch später schreiben werde) im Musikrhytmus
    mit "wippen" oda irgendwas Musik abhängig machen.
    Dazu müsste ich das Signal auslesen die die Musikkarte ausgebt bzw, aus 2 Auswahl das Micro.
    Und dieses Signal dan genauer analysieren.
    Nur habe ich keine Ahnung wie ich das anstellen soll.
    Jemand eine Idee

    Einmal editiert, zuletzt von Amateur (14. Januar 2012 um 20:00)