Stream Recording

  • Moin Moin

    ich würde gerne nen Audio Stream aufnehmen, dazu hab ich versucht die Bass.dll zu verwenden bin aber beim aufnehmen gescheitert.
    Ich würde das ganze gerne ohne Umwege über die Soundkarte (Lautsprecherausgang) machen damit nix aus andern Anwendung auf einmal in meinen aufgenommanen Streams ist :D
    ich hatte im Forums auf http://www.un4seen.com/igendwo sowas in der art gefunden:

    [autoit]

    _BASS_SetConfig($bass_dll,$BASS_CONFIG_NET_PLAYLIST,1)
    $MusicHandle = _BASS_StreamCreateURL ($bass_dll, $file, 0, 1)
    _BASS_Encode_Start($bass_dll,$bassenc_dll,$MusicHandle, @ScriptDir & "\Test.wav",0)

    [/autoit]


    wenn ich es ausführe kommt kein Fehler aber er erstellt auch keine Datei ;(

    hier mal der ganze Code den ich aus dem Beispiel vom Bass.dll UDF Ersteller gemacht hab

    Spoiler anzeigen
    [autoit]

    #include <Bass.au3>
    #include <BassConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <array.au3>
    #include <BassEnc.au3>
    #include <BassEncConstants.au3>

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

    Global $playing_state = -1
    ;Open Bass.DLL. Required for all function calls.
    $bass_dll = DllOpen("BASS.dll")
    $bassenc_dll = DllOpen("BASSENC.dll")

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

    If @error Then
    MsgBox(0, "Error", "Could not load bass.dll")
    Exit
    EndIf
    ;Initalize bass. Required for most functions.
    _BASS_Init ($bass_dll, 0, -1, 44100, 0, "")

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

    ;Check if bass iniated. If not, we cannot continue.
    If @error Then
    MsgBox(0, "Error", "Could not initialize audio")
    Exit
    EndIf

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

    ;Prompt the user to select a MP3 file
    $file = "http://metafiles.gl-systemhaus.de/hr/youfm_2.m3u"

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

    _BASS_SetConfig($bass_dll,$BASS_CONFIG_NET_PLAYLIST,1)
    ;Create a stream from that file.
    $MusicHandle = _BASS_StreamCreateURL ($bass_dll, $file, 0, 1)
    _BASS_Encode_Start($bass_dll,$bassenc_dll,$MusicHandle, @ScriptDir & "\Test.wav",0)
    ;~ _BASS_ChannelPlay($bass_dll,$MusicHandle, 0)

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

    ;Check if we opened the file correctly.
    If @error Then
    MsgBox(0, "Error", "Could not connect to the internet" & @CR & "Error = " & @error)
    Exit
    EndIf

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

    ;Create GUI and controls
    $Form1 = GUICreate("Example 3", 380, 190, 193, 115)
    $lblFileName = GUICtrlCreateLabel($file, 8, 8, 379, 17)
    $progress_slider = GUICtrlCreateSlider(8, 32, 374, 29)
    GUICtrlSetLimit(-1, 100, 0)
    $rightVol = GUICtrlCreateProgress(8, 88, 366, 17)
    GUICtrlSetLimit(-1, 100, 0)
    $LeftVol = GUICtrlCreateProgress(8, 136, 366, 17)
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlCreateLabel("Right Channel Volume Level", 8, 64, 150, 17)
    GUICtrlCreateLabel("Left Channel Volume Level", 8, 112, 150, 17)
    $Close = GUICtrlCreateButton("Close", 296, 160, 75, 25, 0)
    $Play_pause = GUICtrlCreateButton("Play/Pause", 216, 160, 75, 25, 0)
    $Stop = GUICtrlCreateButton("Stop", 136, 160, 75, 25, 0)
    ;Show GUI
    GUISetState(@SW_SHOW)

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

    ;Get the length of the song in bytes.
    $song_length = _BASS_ChannelGetLength ($bass_dll, $MusicHandle, $BASS_POS_BYTE)

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

    While 1
    ;Only do this if a song is playing.
    If $playing_state = 1 Then
    ;Get cursor information for the GUI. We use this to know if the user is using the slider or no.
    $GGCI = GUIGetCursorInfo($Form1)
    ;Can't be using the slider, so update.
    If IsArray($GGCI) And Not $GGCI[2] Then
    ;Get Current playback position
    $current = _BASS_ChannelGetPosition ($bass_dll, $MusicHandle, $BASS_POS_BYTE)
    ;Calculate the percentage
    $percent = Round(($current / $song_length) * 100, 0)
    EndIf
    ;User has clicked the slider, so we must not update the song position.
    If IsArray($GGCI) And $GGCI[4] = $progress_slider And $GGCI[2] Then
    ;While the slider is being moved
    While $GGCI[2]
    ;Get updated cursor info
    $GGCI = GUIGetCursorInfo($Form1)
    ;Get position
    $gpos = Round(GUICtrlRead($progress_slider) / 100 * $song_length, 0)
    WEnd
    ;Slider is no longer clicked, so we now can set the pos.
    _BASS_ChannelSetPosition ($bass_dll, $MusicHandle, $gpos, $BASS_POS_BYTE + $BASS_MUSIC_POSRESET)
    EndIf
    EndIf
    ;Get Channel levels.
    $levels = _BASS_ChannelGetLevel ($bass_dll, $MusicHandle)
    ;Get Right and calculate percentage
    $rightChLvl = _LoWord ($levels)
    $rightChLvlper = Round(($rightChLvl / 32768) * 100, 0)
    ;Get Left and calculate percentage
    $LeftChLvl = _HiWord ($levels)
    $leftChLvlper = Round(($LeftChLvl / 32768) * 100, 0)
    ;Set the levels on GUI.
    GUICtrlSetData($rightVol, $rightChLvlper)
    GUICtrlSetData($LeftVol, $leftChLvlper)

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

    ;Get GUI Message
    $nMsg = GUIGetMsg()
    Switch $nMsg
    ;If Close button or red x, then exit. Alway remember to free resources
    Case $GUI_EVENT_CLOSE, $Close
    Exit
    Case $Play_pause
    ;Check if playing or paused, then take appropriate action
    Switch $playing_state
    Case 0; Song Paused, Resume.
    ;Resume Song
    _BASS_Start ($bass_dll)
    $playing_state = 1

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

    Case -1 ; Song stopped, start from begining.
    ;Play Song
    _BASS_ChannelPlay ($bass_dll, $MusicHandle, 0)
    $playing_state = 1
    Case 1 ; Song Playing, Pause
    ;Pause song
    _BASS_Pause ($bass_dll)
    $playing_state = 0
    EndSwitch
    Case $Stop
    ;Stop Song
    _BASS_ChannelStop ($bass_dll, $MusicHandle)
    $playing_state = -1
    EndSwitch
    WEnd

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

    Func OnAutoItExit()
    ;Free Resources
    _BASS_Free($bass_dll)
    EndFunc ;=

    [/autoit]

    hoffe einer weis da weiter

    Mfg Keyle

  • Habe leider momentan nicht viel Zeit, aber ich hab dein Script im Post mal schnell überflogen.
    Ist das gewollt dass du versuchst eine .m3u datei zu streamen? m3u ist eigentlich nur eine textdatei in der die links zu den mp3 files stehen - von daher wirst du aus eben solcher nicht viel sound rausbekommen.

  • Das is nen Radiostream und das klappt auch mit dem Apspielen und auch Sound is da ;)
    mein Problem ist einfach das aufnehmen des Streams

    Edit: und auch wenn ich ne normale mp3-Datei streame klappts net :(

    Mfg Keyle