nacerbaaziz

easy audio player progect

5 posts in this topic

#1 ·  Posted

hellow guys
I am a blind young man
I started a project to make an audio player
with recorder
I ended the player and i did not know how to recorder
This player is Compatible with the blind and visually impaired and ordinary users
Unfortunately I do not see so I could not merge images and icons

So I hope you will be able to help me in this matter

I will bring you the open source project and please help me to add images, icons and recorder, the project is requires easy access in order to be compatible with the screen readers, Please take this into account.
the software is organized so the recorder is In a special  menu that Contains stop and start and pause and save.
The same is true for player
Please help
And greetings to all

easy player.zip

1 person likes this

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Thanks for this script.  It was a lot of fun.  The script is doing things that I want to know how to do.  Your examples will help me quickly learn how to do this stuff. :)

(Things that probably aren't an issue anymore)

Spoiler

In easyPlayer.au3: Code had scope issues due to order of includes.  

I replaced Include FileOptions.au3 with File.au3.  Rewrote _FileGetDirPath, _GetFileName using _PathSplit() this was just to make it work.  I'm not sure my changes are the right way to go about things.

In options.au3: $Color_Green was giving me warnings replaced with 0x00C000.

 

Here is an updated example of easyPlayer.au3 in case anyone else wants to pickup with this running at default AutoIt settings.

#RequireAdmin
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_Comment=easy player
#AutoIt3Wrapper_Res_Description=easy player
#AutoIt3Wrapper_Res_Fileversion=1.5.0.22
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=2017, by nacer baaziz
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Global $sound = "", $MusicHandle, $reverb = false, $echo = false, $Chorus = false, $Reverse = false, $ReverbHandle, $EchoHandle, $ChorusHandle, $param

#######
#include <include\Bass.au3>
#include <include\BassConstants.au3>
#include <include\BassFX.au3>
#include <GUIConstants.au3>
#include <File.au3>
#include <include\restart.au3>
#include <include\func.au3>
#include <include\options.au3>
#include <include\Sec2Time.au3>
#include <include\languages.au3>
#include <ColorConstantS.au3>
#include <SliderConstants.au3>
#include <Sound.au3>
#include <ToolTipConstants.au3>
#include <UpDownConstants.au3>
#include <MenuConstants.au3>
#include <MsgBoxConstants.au3>

#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListBox.au3>
;#include <FileOptions.au3>
########
Opt("GUICloseOnESC", 0)
main()
func main()
    _BASS_Startup(@scriptDir & "\dll\bass.dll")
    If @error = -1 Then
        MsgBox (0, "", "DLL Does not exist?  Please check file exists.")
        Exit
    EndIf

    _BASS_FX_Startup(@scriptDir & "\dll\bass_fx.dll")
    If @error = -1 Then
        MsgBox (0, "", "DLL Does not exist?  Please check file exists.")
        Exit
    EndIf
    _BASS_Init(0, -1, 44100, 0, "")
    If @error Then
        MsgBox(0, "Error", "Could not initialize audio")
        Exit
    EndIf

    ;global $sound = "", $MusicHandle, $reverb = false, $echo = false, $Chorus = false, $Reverse = false, $ReverbHandle, $EchoHandle, $ChorusHandle, $param
    global $file = False, $dir = 0, $filePos
    global $volume = ""
    $volume = RegRead("HKEY_CURRENT_USER\SOFTWARE\easy audio player", "volume")
    if @error then
    $volume = INIRead(@scriptdir&"settings.ini", "settings", "volume", "")
    If @Error then
    $volume = 50
    endIf
    _BASS_ChannelSetVolume($MusicHandle, $volume)
    endIf

    Global $Playing = False, $state = false
    global $sFilePath
    global $vlm = ""
    GUICreate("2")
    global $List = GUICtrlCreateList("", -1, -1, -1, -1)

    ###### command line ######
    If $CmdLine[0] = 0 Then
    $file = False
    ElseIf $CmdLine[0] = 1 Then
    $File = $CmdLine[1]
    $dir = _FileGetDirPath($file)
        _GUICtrlListBox_BeginUpdate($List)
        _GUICtrlListBox_Dir($List, $dir & "\*.mp3")
        _GUICtrlListBox_Dir($List, $dir & "\*.wav")
        _GUICtrlListBox_Dir($List, $dir & "\*.ogg")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp1")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp2")
        _GUICtrlListBox_Dir($List, $dir & "\*.m3u")
        _GUICtrlListBox_Dir($List, $dir & "\*.pls")

        _GUICtrlListBox_endUpdate($List)
    _GUICtrlListBox_SelectString($list, _GetFileName($file))

    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    else
       Switch $CmdLine[1]
    Case "-play"

    $File = $CmdLine[2]
    $dir = _FileGetDirPath($file)
        _GUICtrlListBox_BeginUpdate($List)
        _GUICtrlListBox_Dir($List, $dir & "\*.mp3")
        _GUICtrlListBox_Dir($List, $dir & "\*.wav")
        _GUICtrlListBox_Dir($List, $dir & "\*.ogg")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp1")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp2")
        _GUICtrlListBox_Dir($List, $dir & "\*.m3u")
        _GUICtrlListBox_Dir($List, $dir & "\*.pls")

        _GUICtrlListBox_endUpdate($List)
    _GUICtrlListBox_SelectString($list, _GetFileName($file))

    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    $Playing = True
    case else
    $file = $file
    endSwitch
    endIf
    ####### command line end #######
    ### check ###
    if not fileExists(@scriptdir & "\" & StringTrimRight(@scriptName, 4) & ".ini") then
    Opt("GUICloseOnESC", 1)
    Options()
    _scriptRestart()
    endIf
        Local $hGUI = GUICreate(_t("10"), 1000, 700)
        GUISetBkColor($COLOR_RED)

    ######### menu bar #######
    $FileMenu = GUICtrlCreateMenu(_t("100"))
        GUICtrlSetBkColor(-1, 0x8080ff)
    #######
    local $opene = GUICtrlCreateMenuItem(_t("101") & "... (ctrl+o)", $FileMenu)
        GUICtrlSetBkColor(-1, 0x8080ff)
    local $openURL = GUICtrlCreateMenuItem("open an url...", $FileMenu)
    local $explore = GUICtrlCreateMenuItem(_t("103") & "... (ctrl+e)", $FileMenu)
    local $ExitItem = GUICtrlCreateMenuItem(_t("102"), $FileMenu)
    #######
    local   $playMenu = GUICtrlCreateMenu(_t("200"))
    ####
    local $play = GUICtrlCreateMenuItem(_t("201") & "... (space)", $playMenu)

    local $stop = GUICtrlCreateMenuItem(_t("202") & "... (ctrl+space)", $playMenu)

    local $FORWARD = GUICtrlCreateMenuItem(_t("203") & "... (right key)", $playMenu)

    local $rearward = GUICtrlCreateMenuItem(_t("204") & "... (left key)", $playMenu)
    local $goto = GUICtrlCreateMenuItem(_t("210") & "... (ctrl+g)", $playMenu)
    local $up = GUICtrlCreateMenuItem(_t("205") & "... (up key)", $playMenu)
    local $down = GUICtrlCreateMenuItem(_t("206") & "... (down key)", $playMenu)
    local $fast = GUICtrlCreateMenuItem("faster", $playMenu)
    local $slow = GUICtrlCreateMenuItem("slowly", $playMenu)
    local $next = GUICtrlCreateMenuItem(_t(208) & "... (tab)", $playMenu)
    local $back = GUICtrlCreateMenuItem(_t(209) & "... (shift+tab)", $playMenu)
    ###
    local $efectMenu = GUICtrlCreateMenu(_t(300))
    local $rev = GUICtrlCreateMenuItem(_t(301) & "...", $efectMenu)
    local $ech = GUICtrlCreateMenuItem(_t(302) & "...", $efectMenu)
    local $chor = GUICtrlCreateMenuItem(_t(303) & "...", $efectMenu)

    ########
    local $toolsmenu = GUICtrlCreateMenu(_t("400"))
    ###########
    local $options = GUICtrlCreateMenuItem(_t("401"), $toolsMenu)
    local $recorderMe = GUICtrlCreateMenuItem("go to recorder mod...", $toolsMenu)
    ##########
    local $helppMenu = GUICtrlCreateMenu(_t("500"))
    ####

    ###
    ##########  menu bar end########
    ###label #####

    local $Label = GUICtrlCreateLabel("", 50, 80, 300, 70)

        GUICtrlSetBkColor(-1, 0xffffff)
    local $My = GUICtrlCreateLabel("welcom to easy player", 50, 10, 150, 50)
    local $Label1 = GUICtrlCreateLabel("00:00:00 / 00:00:00" & @crlf & "0%", 50, 120, 200, 70)
        GUICtrlSetBkColor(-1, 0x5ffffff)


    local $play2 = GUICtrlCreateLabel("play", 0, 200, 100, 50)
    local $stop2 = GUICtrlCreateLabel("stop", 350, 200, 100, 50)
    local $up2 = GUICtrlCreateLabel("volume(up)", 0, 250, 100, 50)
    local $down2 = GUICtrlCreateLabel("volume(down)", 350, 250, 100, 50)
    local $FORWARD2 = GUICtrlCreateLabel("FORWARD", 0, 300, 100, 50)
    local $reaRWARD2 = GUICtrlCreateLabel("reaRWARD", 350, 300, 100, 50)
    local $next2 = GUICtrlCreateLabel("next", 0, 360, 100, 50)

    local $back2 = GUICtrlCreateLabel("back", 350, 360, 100, 50)


    ########### label end########
    $hrecorder = GUICreate("recorder", 700, 700)
    GUICtrlCreateLabel("welcom to audio recorder" & @crlf & "please select your microphone and press start to begin recording." & @crlf & "if you want to stop it press stop, or press pause to pause the recorde." & @crlf & "when you finish your record press save to get your audio file.", 50, 10, 500, 100)
    GUICtrlCreateLabel("microphone", 100, 90, 100, 50)
    $microphone = GUICtrlCreateCombo("", 100, 100, 150, 50, $CBS_DROPDOWNList)
    $rstart = GUICtrlCreateButton("&start", 0, 200, 50, 50)
    $rstop = GUICtrlCreateButton("&stop", 150, 200, 50, 50)
    if $file then
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
        GUISetState(@SW_SHOW, $hGUI)
    $volume = RegRead("HKEY_CURRENT_USER\SOFTWARE\easy audio player", "volume")
    if @error then
    $volume = INIRead(@scriptdir&"settings.ini", "settings", "volume", "")
    If @Error then
    $volume = 50
    endIf
    _BASS_ChannelSetVolume($MusicHandle, $volume)
    endIf

    dim $aAccelKeys = [["^o", $opene], ["{space}", $play], ["{up}", $up], ["{down}", $down], ["{right}", $FORWARD], ["{left}", $rearward], ["^+o", $options], ["{tab}", $next], ["+{tab}", $back], ["{enter}", $play], ["!{left}", $back], ["!{right}", $next], ["^{space}", $stop], ["^g", $goto], ["^e", $explore], ["r", $rev], ["e", $ech], ["c", $chor], ["n", $next], ["b", $back], ["^u", $openURL], ["{MEDIA_NEXT}", $next], ["{MEDIA_PREV}", $back], ["{MEDIA_STOP}", $stop], ["{MEDIA_PLAY_PAUSE}", $play]]
        GUISetAccelerators($aAccelKeys, 0)
        While 1


        GUISetAccelerators($aAccelKeys, 0)

            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE, $exititem
    _BASS_ChannelStop($MusicHandle)
        _BASS_Free()
                    Exit
    case $explore
    $oPath = _fileGetDirPath($file)
    ShellExecute("explorer.exe","/select, " & $oPath & GUICtrlRead($list))

    case $up, $up2
    if $volume >= 100 then
    $vlm = 100
    else
    $vlm = $volume+10
    endIf
    $volume = $vlm
    INIWrite(@scriptDir&"\" & StringTrimRight(@scriptName, 4) & ".ini", "settings", "volume", $vlm)
    RegWrite("HKEY_CURRENT_USER\SOFTWARE\easy audio player", "volume", "REG_SZ", $vlm)
    _BASS_ChannelSetVolume($MusicHandle, $vlm)

    case $down, $down2

    if $volume <= 0 then
    $vlm = 0
    else
    $vlm = $volume-10
    endIf
    $volume = $vlm
    INIWrite(@scriptDir&"\" & StringTrimRight(@scriptName, 4) & ".ini", "settings", "volume", $vlm)
    RegWrite("HKEY_CURRENT_USER\SOFTWARE\easy audio player", "volume", "REG_SZ", $vlm)
    _BASS_ChannelSetVolume($MusicHandle, $vlm)


                Case $play, $play2
    if not $file then
    $Fileopen = FileOpenDialog("Select Audio file","","Sound Files(*.mp1;*.mp2;*.mp3;*.wav;*.ogg;*.m3u;*.pls)|All siported Files(*.*)")
    if not @error then
    $file = $fileOpen
    $dir = _FileGetDirPath($file)
        _GUICtrlListBox_BeginUpdate($List)
        _GUICtrlListBox_Dir($List, $dir & "\*.mp3")
        _GUICtrlListBox_Dir($List, $dir & "\*.wav")
        _GUICtrlListBox_Dir($List, $dir & "\*.ogg")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp1")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp2")
        _GUICtrlListBox_Dir($List, $dir & "\*.m3u")
        _GUICtrlListBox_Dir($List, $dir & "\*.pls")
        _GUICtrlListBox_endUpdate($List)
    _GUICtrlListBox_SelectString($list, _GetFileName($file))
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetDevice($MusicHandle, 1)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    autoefect()
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    msgbox(16, "error", @error)
    else
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    GUICtrlSetData($PLAy,_t(207) & "... (space)")
    GUICtrlSetData($PLAy2,"&pause")
    $Playing = True
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))

    endIf



    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    else
    SWITCH _BASS_ChannelIsActive($MusicHandle)
    case 0
    _BASS_ChannelSetDevice($MusicHandle, 1)
    _BASS_ChannelSetvolume($MusicHandle, $volume)

    _BASS_ChannelPlay($MusicHandle, 1)
    GUICtrlSetData($PLAy,_t(207) & "... (space)")
    GUICtrlSetData($PLAy2,"&pause")

    $Playing = True

    case 1
    _BASS_ChannelPause($MusicHandle)
    GUICtrlSetData($PLAY,_t(201) & "... (space)")
    GUICtrlSetData($PLAY2,"play")
    $Playing = False

    case 3
    _BASS_ChannelSetDevice($MusicHandle, 1)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 0)
    GUICtrlSetData($PLAy,_t(207) & "... (space)")
    GUICtrlSetData($PLAy2,"&pause")

    $Playing = True

    case else
    $Fileopen = FileOpenDialog("Select Audio file","","Sound Files(*.mp1;*.mp2;*.mp3;*.wav;*.ogg;*.m3u;*.pls)|All siported Files(*.*)")
    if not @error then
    $file = $fileOpen
    $dir = _FileGetDirPath($file)
        _GUICtrlListBox_BeginUpdate($List)
        _GUICtrlListBox_Dir($List, $dir & "\*.mp3")
        _GUICtrlListBox_Dir($List, $dir & "\*.wav")
        _GUICtrlListBox_Dir($List, $dir & "\*.ogg")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp1")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp2")
        _GUICtrlListBox_Dir($List, $dir & "\*.m3u")
        _GUICtrlListBox_Dir($List, $dir & "\*.pls")

        _GUICtrlListBox_endUpdate($List)
    _GUICtrlListBox_SelectString($list, _GetFileName($file))
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetDevice($MusicHandle, 1)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    autoefect()
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    msgbox(16, "error", @error)
    endIf
    GUICtrlSetData($PLAy,_t(207) & "... (space)")
    GUICtrlSetData($PLAy2,"&pause")
    $Playing = True

    endIf
    endSwitch
    endIf
    case $opene

    $Fileopen = FileOpenDialog("Select Audio file","","Sound Files(*.mp1;*.mp2;*.mp3;*.wav;*.ogg;*.m3u;*.pls)|All siported Files(*.*)")
    if not @error then
    $file = $fileOpen
    $dir = _FileGetDirPath($file)
        _GUICtrlListBox_BeginUpdate($List)
        _GUICtrlListBox_Dir($List, $dir & "\*.mp3")
        _GUICtrlListBox_Dir($List, $dir & "\*.wav")
        _GUICtrlListBox_Dir($List, $dir & "\*.ogg")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp1")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp2")
        _GUICtrlListBox_Dir($List, $dir & "\*.m3u")
        _GUICtrlListBox_Dir($List, $dir & "\*.pls")

        _GUICtrlListBox_endUpdate($List)
    _GUICtrlListBox_SelectString($list, _GetFileName($file))

    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetDevice($MusicHandle, 1)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    autoefect()
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    msgbox(16, "error", _BASS_ErrorGetCode())
    else
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    GUICtrlSetData($PLAy,_t(207) & "... (space)")
    GUICtrlSetData($PLAy2,"&pause")
    $Playing = True
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))

    endIf

    endIf
    case $openUrl
    $url = InputBox("play an url audio", "enter the file url")
    if not @error then
    $MusicHandle = _BASS_StreamCreateURL($url, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    autoefect()
    _BASS_ChannelPlay($MusicHandle, 0)
    $file = $url
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    Case $STOP, $stop2
    GUICtrlSetData($PLAY,_t("201") & "... (space)")
    GUICtrlSetData($PLAY2,"play")
    $Playing = False
    _BASS_ChannelStop($MusicHandle)
    _BASS_ChannelSetPosition($MusicHandle, 0, $BASS_POS_BYTE)
    GUICtrlSetData($label1, _Sec2Time(Round(_BASS_ChannelBytes2Seconds($MusicHandle, _BASS_ChannelGetPosition($MusicHandle, 0)))) & " / " & _sec2Time(Round(_BASS_ChannelBytes2Seconds($MusicHandle, _BASS_ChannelGetLength($MusicHandle, 0)))) & @crlf & Round((_BASS_ChannelGetPosition($MusicHandle, 0) / _BASS_ChannelGetLength($MusicHandle, 0)) * 100, 0) & "%")
    Case $rearward, $rearward2
    $pos = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)
    if $pos < _BASS_ChannelSeconds2Bytes($MusicHandle, 5) then
    _BASS_ChannelSetPosition($MusicHandle, 0, $BASS_POS_BYTE)
    else
    _BASS_ChannelSetPosition($MusicHandle, $pos-_BASS_ChannelSeconds2Bytes($MusicHandle, 5), $BASS_POS_BYTE)
    endIf
    Case $FORWARD, $FORWARD2

    $pos = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)
    $length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
    if $pos+_BASS_ChannelSeconds2Bytes($MusicHandle, 5) >= $length then
    _BASS_ChannelSetPosition($MusicHandle, $length, $BASS_POS_BYTE)
    else
    _BASS_ChannelSetPosition($MusicHandle, $pos+_BASS_ChannelSeconds2Bytes($MusicHandle, 5), $BASS_POS_BYTE)
    endIf
    case $goto
    GUISetState(@sw_hide, $hGUI)
    Opt("GUICloseOnESC", 1)
    $sPosition = Round(_BASS_ChannelBytes2Seconds($MusicHandle, _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)))

    $goToDo = _goto($sPosition)

    if $goToDo = $sPosition then
    $GoToDo = false
    $sPosition = false

    else
    _BASS_ChannelSetPosition($MusicHandle, _BASS_ChannelSeconds2Bytes($MusicHandle, $GoToDo), $BASS_POS_BYTE)
    $GoToDo = false
    $sPosition = false

    endIf
    Opt("GUICloseOnESC", 0)
    GUISetState(@sw_show, $hGUI)
    case $my
    MSGBox(0, "about apps", "this app is an small tool which help you to play your audio files" & @crlf & "this app is devloped by nacer baaziz")
    case $next, $next2
    if $file then

    $filePos = $file
    $all = StringReplace(_GUICtrlListBox_GetCount($list), " ", "")
    $pushd = StringReplace(_GUICtrlListBox_GetCurSel($list), " ", "")

    if $pushd = $all-1 then
    $pushd = 0
    $text = _GUICtrlListBox_GetText($list, $pushd)
    _GUICtrlListBox_setCurSel($list, $pushd)
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $Dir & $text, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    else
    $file = $Dir & $text
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    autoEfect()
    else

    $text = _GUICtrlListBox_GetText($list, $pushd+1)
    _GUICtrlListBox_setCurSel($list, $pushd+1)
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $Dir & $text, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    else

    $file = $Dir & $text
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    autoEfect()
    endIf

    endIf
    case $Back, $back2
    if $file then
    $all = _GUICtrlListBox_GetCount($list)
    $pushd = _GUICtrlListBox_GetCurSel($list)
    if $pushd = 0 then
    $pushd = $all
    endIf
    $text = _GUICtrlListBox_GetText($list, $pushd-1)
    _GUICtrlListBox_setCurSel($list, $pushd-1)
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $Dir & $text, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    else

    $file = $Dir & $text
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    autoEfect()
    endIf
    case $rev
                If not $reverb then
                    _BASS_FXSetParameters($ReverbHandle, "0")
                    _BASS_ChannelRemoveFX($MusicHandle, $ReverbHandle)
                    $ReverbHandle = _BASS_ChannelSetFX($MusicHandle, $BASS_FX_DX8_REVERB, 7)

                    _BASS_FXSetParameters($ReverbHandle, "2|-8|3000|0.010")
    $reverb = true
    GUICtrlSetState($rev, $GUI_checked)
                Else
                    _BASS_FXSetParameters($ReverbHandle, "0")
                    _BASS_ChannelRemoveFX($MusicHandle, $ReverbHandle)


    $reverb = false
    GUICtrlSetState($rev, $GUI_unchecked)
                EndIf
    case $ech
                If not $echo Then
                    _BASS_FXSetParameters($EchoHandle, "0")
                    _BASS_ChannelRemoveFX($MusicHandle, $EchoHandle)
                    $EchoHandle = _BASS_ChannelSetFX($MusicHandle, $BASS_FX_BFX_ECHO2, 6)
                    _BASS_FXSetParameters($EchoHandle, "0")
                    _BASS_FXSetParameters($EchoHandle, "1|0.3|0.4|1|" & $BASS_BFX_CHANALL)
    $echo = true
    GUICtrlSetState($ech, $GUI_checked)
                Else
                    _BASS_FXSetParameters($EchoHandle, "0")
                    _BASS_ChannelRemoveFX($MusicHandle, $EchoHandle)
    $echo = false
    GUICtrlSetState($ech, $GUI_unchecked)
                EndIf
    case $Chor
                If not $Chorus then
                    _BASS_FXSetParameters($ChorusHandle, "0")
                    _BASS_ChannelRemoveFX($MusicHandle, $ChorusHandle)
                    $ChorusHandle = _BASS_ChannelSetFX($MusicHandle, $BASS_FX_BFX_CHORUS, 5)
                    $param = _BASS_FXGetParameters($ChorusHandle)

                    _BASS_FXSetParameters($ChorusHandle, "1|0.6|0.2|2|11|4|" & $BASS_BFX_CHANALL)
    $Chorus = true
    GUICtrlSetState($chor, $GUI_checked)
                Else
                    _BASS_FXSetParameters($ChorusHandle, "0")
                    _BASS_ChannelRemoveFX($MusicHandle, $ChorusHandle)
    $Chorus = false
    GUICtrlSetState($chor, $GUI_unchecked)
                EndIf
    case $fast
    local $t = 0



    local $t2 = _BASS_ChannelSetAttribute ($MusicHandle, $BASS_ATTRIB_TEMPO, $t+10)
    $t = $t2
    case $recorderMe
    GUISetState(@sw_hide, $hGUI)
    GUISetState(@sw_show, $HRecorder)
    case $options
    Opt("GUICloseOnESC", 1)
        GUISetState(@SW_hide, $hGUI)
    $return = options()
    if $return = 1 then
    $answer = MSGBox(4, "the settings has been changed", "to apply the new settings you must to restart your application, do you want to restart it now? press yes to restart it now or no to restart it later")
    switch $answer
    case 6
    _scriptRestart()
    case 7
    Opt("GUICloseOnESC", 0)
        GUISetState(@SW_show, $hGUI)
    endSwitch
    else
    Opt("GUICloseOnESC", 0)
        GUISetState(@SW_show, $hGUI)
    endIf

            EndSwitch
    if _BASS_ChannelIsActive($MusicHandle) = 1 and $file then
    GUICtrlSetData($label1, _Sec2Time(Round(_BASS_ChannelBytes2Seconds($MusicHandle, _BASS_ChannelGetPosition($MusicHandle, 0)))) & " / " & _sec2Time(Round(_BASS_ChannelBytes2Seconds($MusicHandle, _BASS_ChannelGetLength($MusicHandle, 0)))) & @crlf & Round((_BASS_ChannelGetPosition($MusicHandle, 0) / _BASS_ChannelGetLength($MusicHandle, 0)) * 100, 0) & "%")
    endIf
    if $file then
    if _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE) then
    Sleep(500)
    $all = StringReplace(_GUICtrlListBox_GetCount($list), " ", "")
    $pushd = StringReplace(_GUICtrlListBox_GetCurSel($list), " ", "")

    if $pushd = $all-1 then
    $pushd = 0
    $text = _GUICtrlListBox_GetText($list, $pushd)
    _GUICtrlListBox_setCurSel($list, $pushd)
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $Dir & $text, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 1)
    else

    $file = $Dir & $text
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    autoEfect()
    elseif $pushd = $all then
    _BASS_ChannelPlay($MusicHandle, 1)
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    else
    $text = _GUICtrlListBox_GetText($list, $pushd+1)
    _GUICtrlListBox_setCurSel($list, $pushd+1)
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $Dir & $text, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 1)
    else

    $file = $Dir & $text
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    autoEfect()
    endIf
    endIf
    endIf
    if $file then
    switch _BASS_ChannelIsActive($MusicHandle)
    case 1
    if $state = 1 then
    $state = 1
    else
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    $state = 1
    endIf
    case 0
    if $state = 0 then
    $state = 0
    else
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " stoped")
    $state = 0
    endIf
    case 3
    if $state = 3 then
    $state =3
    else
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " on pause")
    $state =3
    endIf
    endSwitch
    endIf
        WEnd

        ; Delete the previous GUI and all controls.
        GUIDelete($hGUI)
EndFunc; main

Func _FileGetDirPath($sPath)
    Local $sDrive = "", $sDir = "", $sFilename = "", $sExt = ""

    Local $aPath_split = _PathSplit($sPath, $sDrive, $sDir, $sFilename, $sExt)

    Return $sDrive & $sDir & "\"
EndFunc; _FileGetDirPath

Func _GetFileName($sPath)
    Local $sDrive = "", $sDir = "", $sFilename = "", $sExt = ""

    Local $aPath_split = _PathSplit($sPath, $sDrive, $sDir, $sFilename, $sExt)

    Return $sFilename & $sExt
EndFunc; _GetFileName

 

If anyone else tries these scripts.  Start with zip in post one, then if you're having problems replace the contents of easyPlayer.au3 with my revision of script.  

The first GUI that appeared for me was a Green options dialog.  The main dialog doesn't load until you press the 'Okay' button.  The script relaunches it'self too at that stage (before pressing 'Okay') I had to Kill Process Tree.  After pressing 'Okay' at the Green dialog it doesn't happen anymore (script does not relaunch).

Why does it relaunch @nacerbaaziz?

Edited by Xandy

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

#3 ·  Posted

Hello dear
Thank you for your nice post and for your modification of the file and to alerted me about the unintended mistake
My brother so far I have not finished working on the options page
It is Requiring a restart Because I will put some options for the screen readers and these options require restart
and about the  fileOptions.au3 file
I will amend the above publication and will add it to anyone who wants to benefit from it
With my best greetings and best wishesTHE

fileOptions.au3

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I am interested in writing the recorder.  I have a lot of work these weeks to come (day job) and I still have lots to learn about your script.  I have written a multi-track recorder already.  I will enjoy integrating our two scripts.

I'll start by saving a recording of stereo mix from computer output, then a microphone, then I'll see if I can output a file with both.

Edit: If that sounds like a reasonable plan.

Edited by Xandy

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

#5 ·  Posted

OK dear
Thank you very much

am waiting

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • nss
      By nss
      Hi all,
       
      I am making a program in which I use Bass audio library (with the wrapper for autoit that I found here on forums I think) because of its support for dx effects.
      My problem, though, is that when effects as reverb or echo/delay are added, the channel length is not extended as to fit the tail of the effect, so if the file was really short, you wouldn't even hear the reverb at all.
      I've tried setting the  buffer parameter even to 60k ms, updating the channel length to 60k ms, but nothing makes it so that the effects aren't being cut off.
      I've heard that I could add silence manually to wave files by adding the chr(0) characters, but haven't had any luck doing that, either.
      What I'm doing:
      initialize bass use streamCreateFile to load the wave file with the fx flag and length parameter set to 60000 set the config buffer to 60000 use channel set fx to add dx8 reverb use channel play to play the sound use bass update to update the length to 60000  
      I even tried having only silence in one wave file and tried joining two wave files together, but that didn't work either.
       
      Any help would be very much appreciated.
    • nacerbaaziz
      By nacerbaaziz
      Hello my friends
      I have an urgent problem and we hope you can help me
      I want to detect if the audio output of the device has changed
      Such as the headset is connected or disConnected.
      or change the default audio output
      Is this possible?
      I really searched a lot and found suggestions but unfortunately I did not understand them
      Please explain to me
      Greetings
    • nacerbaaziz
      By nacerbaaziz
      Hello my friends
      I am a totally blind young man
      for easier to read books and articles Among the blind
      i has programmed a tool
      This tool converts text to audio with the possibility to save it into a wav or mp3 file
      It is also compatible with all persons, whether blind or ordinary
      I have completed the work of this tool and want to take your opinion
      i Especially published here for anyone looking about how to convert text to speech, I will put this tool open source for you
      I want to know what your think about it
      and if it need any other additions?
      Note :
      This tool converts texts to audio using sapi 5 voices
      so i was also puted a hot keys to control the tool
      Now I put this project to you for public benefit and I am ready to answer any question.
      Apology :
      I am an Arab youth from Algeria
      I do not mastered English very well
      So I apologize to you if there are written mistakes
      With my greetings and best wishes
      My texts to audio converter.zip
    • nlta1992
      By nlta1992
      I want creat GUI, have button 1 to 10, but only use loop for ... to ... step ... next.
      Thanks.
    • wakillon
      By wakillon
      I love chiptune music, but BASS only support XM, IT, S3M, MOD, MTM, UMX and MO3 file format for MOD music.
       
      1 | Nintendo NES and SNES Sound File Players
      May be you already have some files with extension nsf, nsfe, spc or rsn (unzip rsn files for get spc collection files inside) but you can't play them in a AutoIt script ?
      So I searched around a bit, and found 2 DLL ( nsf_player.dll and spc_player.dll ) for play Nintendo NES and SNES Sound Files.
      Interest of those DLL is that they can play from file path or binary data, avoiding temp files.
      Dll and audio files are embedded in scripts for permit you to test them right away.
      Some info/download links are in front of each script.
       
      2 | ModPlug Player
      Another dll found : npmod32.dll who support mod, s3m, xm, med, it, s3z, mdz, itz, xmz and wav files.
      Interest : it can play some rares chiptune formats, you can also pause, set volume and set position.
      Inconvenient : do not load from binary datas.
      Dll and audio files are embedded in script and i have added a gui for permit you to try right away !
      Warning : Do not work on Win8.
       
      3 | ZXTune Player 2 (basszxtune.dll v2.4.5) UPDATE of 23 DEC 2016
      Using BASSZXTUNE chiptune support for BASS ( Support  as0, asc, ay, ftc, gtr, psc, psg, psm, pt1, pt2, pt3, sqt, st1, s, st3, stc, stp, ts, txt, vtx, ym, chi, dmm, dst, m, sqd, str, sid, cop, tf0, tfc, tfd, tfe, $b, $m, ahx, ayc, bin, cc3, d, dsq, esv, fdi, gam, gamplus, gbs, gym, hes, hrm, hrp, lzs, msp, mtc, nsf, nsfe, p, pcd, sap, scl, spc, szx, td0, tlz, tlzp, trd, trs, vgm )
      Interest : it can play lot of rares chiptune formats, while benefiting from all bass functions.
      Inconvenient : dll size.(5860ko)
      Dll and audio files are embedded in script.
       
      4 | TitchySID Player 
      Files and dll are loaded in memory.
      Interest : dll size (8ko), you can Play/Stop/Pause/Resume and choose which subsong to play.
      Inconvenient : only SID audio files supported ( PSID & RSID)
      Dll and audio files are embedded in script.
      Tested under Win7 and Win8.
      Edit : added a Sid header viewer : SidHeaderViewer.au3
       
      5 | MiniFmod Player
      Interest : dll size (20ko)
      Inconvenient : only xm audio files supported.
       
      6 | Npnez Player 
      Using npnez.dll (88ko) for play Gameboy Sound System audio files and some others ( kss, hes, nsf, ay, gbr, gbs, gb, nsd, sgc )
      Interest : Can be loaded in memory, subsong can be set and volume can be adjusted ( perfect for create a fade when exiting ) 
      Inconvenient : for an unknow reason, only 20% of my hes collection is playable...
       
      7 | µFMOD Player 
      Interest : dll size (10ko), can be loaded in memory, support Play/Stop/Pause/Resume actions and volume can be adjusted ( perfect for create a fade when exiting ) 
      Inconvenient : only xm audio files supported.
       
      8 | MagicV2m Player 
      Interest : dll size (20ko), Play/Stop/IsPlay/SetAutoRepeat/Progress
      Inconvenient : only v2m audio files supported, V2mPlayStream is not reliable, so prefer V2mPlayFile instead.
       
      9 | OSMEngine Player 
      OSMEngine.dll (80 ko)(Oldskool Musics Engine) permit to play snd, sndh, fc, fc4, fc14 and some rare jam audio files from Amiga/Atari ST(E)
      Interest : audio can be loaded in memory, and Pause/Resume/SetVolume/GetInfos are available
      Inconvenient : none at the moment. 
       
      10 | Ayfly Player
      Ayfly.dll (268 ko) is a AY-891x emulator and player who support
      the following tracker formats : aqt, asc, ay, fxm, gtr, psc, psg, pt1, pt2, pt3, sqt, stc, stp, vtx, ym and zxs (ZX Spectrum Emulator Snapshot) files.
      Interest : SetVolume/GetInfos are available
      Inconvenient : a function named "ay_initsongindirect" for load module in memory exists, but due to the poor documentation provided i do not succeed to get it to work...
       
      11 | GMGME Player
      GMGME.dll is a emulated music DLL that allows you to play ay, gbs, gym, hes, kss, nsf/nsfe, sap, spc and vgm files.
      Interest : Can play ATARI SAP files (only type B and C) , Set Volume and Set Tempo are available
      Inconvenient : Dll Size (and his imports) , and audio files can not be loaded in memory.
       
      12 | SC68 Player
      sc68replay.dll (166 ko) is a Freebasic DLL compiled from "sc68replay" src that allows you to play SC68  (Atari ST and Amiga audio formats)  files.
      Interest : Can play from file and memory
      Inconvenient : Unfortunatelly for an unknown reason not all sc68 files are supported.
       
      13 | Extended Module Player
      LibXmp.dll  (272 ko)  can "read" xm, mod, it, s3m, med, 669 but also some rares formats
      abk, amd, amf, dbm, digi, dtm, emod, far, flx, fnk, gdm, hsc, imf, j2b, liq, m15, mdl, mfp, mgt, mtm, mtn, okt, psm, ptm, rad, rtm, sfx, smp, stim, stm, stx, ult, umx, wow, ym3812
      Despite its name, it's not a "player" but a library that renders module files to RAW PCM data.
      So the interest in this script was to find a way to convert those raw datas into a "playable" sound.
      With Waveform Audio Interface i create a pseudo Wav header who permit to play datas as a Wav file.
      Interest : Can play from file and memory
      Inconvenient : Time to render datas (depends of file size)
       
      14 | LibModPlug Player
      LibModPlug.dll (102 ko)  can "read" xm, it, mod, s3m, med, 669 and also amf, ams, dbm, dmf, dsm, far, j2b, mdl, mt2, mtm, okt, psm, ptm, stm, ult, umx.
      As LibXmp.dll, it's a library that renders module files to RAW PCM data.
      For this one, i create a real binary wave header for be able to play it easily from memory with winmm.dll PlaySoundW function.
      Interests : Can play from file and memory, and have some nice sound effects : Surround, MegaBass and Reverb  (used in script example)
      It can also replace modplug player(2) for Win 8+ users
      Inconvenient : Time to render datas (depends of file size)
       
      15 | AdPlug Player
      AdPlug.dll ( 69ko ) is an AdLib sound player library who is able to play the following files type :  A2M, ADL, AMD, BAM, CFF, CMF, D00, DFM, DMO, DRO, DTM, HSC, HSP, IMF, KSM, LAA, LDS, M, MAD, MID, MKJ, MSC, MTK, RAD, RAW, RIX, ROL, S3M, SA2, SAT, SCI, SNG, XAD, XMS, XSM
      For this one, time to render datas is to long, so i needed to find an other way for play modules.
      Using Bass.dll and particulary the "BASS_StreamPutData" function i succeeded to play module in loop while rendering it.
      Both DLL are loaded in memory, and 16 different module types are available in the script. No includes/files needed. Just run it.
      Warning : for a unique file extension (example .sng), it's sometimes possible to have several filetypes from different trackers !
      AdPlug.dll Imports : msvcp71.dll, msvcr71.dll in C:\Windows\SysWOW64  ( VC Redist Installer )
      Interests : Can read some obscure rare formats.
      Inconvenient : Can not read from memory
       
      16 | LibMikmod Player
      LibMikmod.dll (85ko) will currently play the following common and not so common  formats : 669, AMF, DSM, FAR, GDM, IMF, IT, MED, MOD, MTM, S3M, STM, STX, ULT, UNI, XM  
      Interests : Can load from memory
      Inconvenient : only for full-screen applications, because if the application has not the focus sound is muted
       
       
      Downloads are available in the download section
      Dedicated to chiptune Lovers ! 
      Music Links : 
      asma.atari.org  woolyss.com  chipmusic.org  demozoo.org  modarchive.org  modules.pl  keygenmusic.net  zxtunes.com  mazemod.org  amigaremix.com  pouet.net  plopbox.eu  Modland