JohnOne Posted January 17, 2014 Share Posted January 17, 2014 Sounds interesting, do you plan to share it? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
FlashpointBlack Posted January 17, 2014 Share Posted January 17, 2014 Absolutely. A day of polishing will do it well, though. It's far from being pretty and at the moment is merely functional. JohnOne 1 Link to comment Share on other sites More sharing options...
FlashpointBlack Posted January 17, 2014 Share Posted January 17, 2014 As promised: This suits my needs at the moment, but I plan to add some other things to it as well, but it's at least usable now. The slider at the bottom sets the level the microphone must detect in order to detect it as a "clap". By default, I have the setting set to nearly deafening... I have twin three year old girls who enjoy screaming and running around while I'm trying to cook, so I have it set to where I need to clap very loudly to activate the next step. That's also the reason for requiring 3 sequential claps (to cut down on false positives). While they were napping, 2 worked just fine. I've included a few of our family's favorite recipes just as an example, but they're just glorified text files. If you dive into the AU3 instead of just using the exe, some basic configuration settings are near the top since I haven't gotten around to making a GUI settings window yet. I'm open to suggestions on how to improve it, as well as any constructive criticism anyone has to offer about the code itself. I'm always eager to grow! FlashCook.rar Gianni, JohnOne, Xandy and 1 other 4 Link to comment Share on other sites More sharing options...
FlashpointBlack Posted January 24, 2014 Share Posted January 24, 2014 I've been working on developing this a bit more in the past few days (again, for personal use) and I have a function that I'd really like to be able to put in that I just can't figure out... Basically, I like to listen to music while I cook, and I listen to it from various mediums (ie: pandora, winamp, itunes, etc...) so what I'd like to do is set the volume for each program to 0 while leaving the audio output for the script at it's default level while the instructions play, and then return the volumes to their previous levels. I've looked around, but I just can't figure out how to make it work. I'd really appreciate any suggestions you may have! Link to comment Share on other sites More sharing options...
nullschritt Posted February 1, 2014 Share Posted February 1, 2014 Does anyone have an example of how to stream microphone audio over TCP using this library? There used to be a script that showed how to do it included with the library, but I can't seem to locate it. Link to comment Share on other sites More sharing options...
Apzo Posted February 1, 2014 Share Posted February 1, 2014 Looks realy promising to me ! I'd like to play a sound on a given channel, not the default sound device. I've seen some tries in this topic to play on a specific speaker (left, right, ...) but what about virtual channels ? Can they be listed and used ? Apzo. All the pop3 functions.Rsync your files on your USB key (or anywhere else) Link to comment Share on other sites More sharing options...
Apzo Posted February 2, 2014 Share Posted February 2, 2014 So I tried... I first made a func to get available devices. I use Virtual Audio Cable to fake a sound device. Works like a charm using Audacity, I can read sounds from "Line 1" when VLC sends sound to it. Here is the func : expandcollapse popupFunc _DeviceListToArray($source="in") ; or "out" Local $iCnt = 0, $aInfo, $sCurrent, $aRet[1][4], $iNbDev = 0 ;aRet[][0] : Device ID ;aRet[][1] : Name ;aRet[][2] : Driver ;aRet[][3] : Status ;1st line : basic infos. $aRet[0][0] contains the number of found devices $aRet[0][0] = 0 ; Here : number of drivers found $aRet[0][1] = "Name" $aRet[0][2] = "Driver" $aRet[0][3] = "Status" While 1 ConsoleWrite(@LF & "Source " & $source & @LF) ConsoleWrite("Device " & $iCnt & @LF) if $source == "in" Then $aInfo = _BASS_RecordGetDeviceInfo($iCnt) ; Get input device infos ElseIf $source == "out" Then $aInfo = _BASS_GetDeviceInfo($iCnt) ; Get output device infos Else SetError(1) ; Don't want anything else Return EndIf If @error Or Not IsArray($aInfo) Then ExitLoop ConsoleWrite("NB Device " & $iNbDev & @LF) $iNbDev += 1 ; Found a device $aRet[0][0] = $iNbDev ; Add it to the device number ReDim $aRet[$iNbDev+1][4] ; A a device slot $sCurrent = "#" & $iCnt & " - " If Not BitAND($aInfo[2], $BASS_DEVICE_ENABLED) Then $sCurrent = "DISABLED " $sCurrent &= $aInfo[0] If $aInfo[2] > 1 Then $sCurrent &= " (Current) " $aRet[$iNbDev][0] = $iCnt ; Device number $aRet[$iNbDev][1] = $sCurrent ; Device Name $aRet[$iNbDev][2] = $aInfo[1] ; Driver $aRet[$iNbDev][3] = $aInfo[2] ; Status $iCnt += 1 WEnd Return $aRet EndFunc I just have to _Array-display for _DeviceListToArray("in") or _DeviceListToArray("out"). Here is what I get or "out" : [0]|3|Name|Driver|Status [1]|0|#0 - No sound||1 [2]|1|#1 - Speakers (Realtek High Definition Audio) (Current) |{0.0.0.00000000}.{410f2e54-1fbf-44f0-892c-80aaf24a77a7}|7 [3]|2|#2 - Line 1 (Virtual Audio Cable)|{0.0.0.00000000}.{ba6c96db-6355-4da9-90f1-b0eb8b38a241}|1 I'd like to output to device #2, but I have an error code 8 : "$BASS_Init has not been successfully called". It works with #1, using _BASS_SetDevice(1) When I set "Line 1" to the default output device, it becomes the #1 entry and it works. So my question : how can I force BASS to play on "Line 1" having a default output to my real soundcard ?? Regards. Apzo. All the pop3 functions.Rsync your files on your USB key (or anywhere else) Link to comment Share on other sites More sharing options...
BrewManNH Posted February 3, 2014 Share Posted February 3, 2014 What are you using in your _Bass_Init line for the device to use? 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...
Apzo Posted February 3, 2014 Share Posted February 3, 2014 (edited) EDIT : Owwwww, I didn't read all the manual. _BASS_Init(0, -1, 44100, 0, "") is for default device So if I guess well, 1) _BASS_STARTUP() 2) Get output device list 3) _BASS_Init($choosen_device) Thanks BrewManNH for pointing that !! _____________________________________________________________________________________________ This is what I use : #AutoIt3Wrapper_UseX64=n Opt("MustDeclareVars", 1) #include <Bass.au3> #include <BassConstants.au3> #include <Array.au3> Global $iDevice, $info ;Open Bass.DLL. Required for all function calls. _BASS_STARTUP() ;Initalize bass. Required for most functions. _BASS_Init(0, -1, 44100, 0, "") If @error Then MsgBox(0, "Error", "Could not initialize audio") Exit 1 EndIf _BASS_SetDevice(2) If @error Then MsgBox(0, "Sound Mapper", "Error, could not initialise sound system.", 10) Exit 1 EndIf Then I do some sound stuff that works when using the default out device with _BASS_SetDevice(1) _BASS_SetDevice(2) gives me error code 8. You can test using Virtual Audio Cable, looks very interesting when working with BASS. On the paper Edited February 3, 2014 by Apzo All the pop3 functions.Rsync your files on your USB key (or anywhere else) Link to comment Share on other sites More sharing options...
Virgus Posted March 2, 2014 Share Posted March 2, 2014 Hello everybody, amazing UDF! I just tried some of the examples and have a question about _BASS_EXT_Freq2Note.au3 Besides of the fact that it is the same of Note2Freq.au3, I tried to set the waveform to square (as pointed out in the BASSEXT.au3) and the output volume is too low. Any other waveform is fine, only the square is low. Is it a dll's bug? Cheers, V. Link to comment Share on other sites More sharing options...
BrewManNH Posted March 2, 2014 Share Posted March 2, 2014 Virgus Wouldn't it be better to ask this question on the forums of the site that the DLL comes from rather than here? 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...
RupDon Posted April 28, 2014 Share Posted April 28, 2014 Hi all. Help me please,can't understand how to record voice with a microphone in wav file using only bass.dll. Link to comment Share on other sites More sharing options...
eukalyptus Posted May 4, 2014 Share Posted May 4, 2014 There is an example in the helpfile: $BASS_EXT_RecordProc expandcollapse popup#AutoIt3Wrapper_UseX64=n #include "Bass.au3" #include "BassEnc.au3" #include "BassExt.au3" Global $hRecord, $hEncoder, $bEncoderActive, $iTimer, $iSent _BASS_Startup() ___Debug(@error, "load bass.dll") _BASS_ENCODE_Startup() ___Debug(@error, "load bassenc.dll") _BASS_EXT_Startup() ___Debug(@error, "load bassext.dll") _BASS_RecordInit(-1) ___Debug(@error, "initialize recording device") $hRecord = _BASS_RecordStart(44100, 2, 0, $BASS_EXT_RecordProc) ___Debug(@error, "start recording (using callback function from bassext.dll)") $hEncoder = _BASS_Encode_Start($hRecord, @MyDocumentsDir & "\BASS_EXAMPLE.wav", $BASS_ENCODE_PCM) ___Debug(@error, "set up encoder on $hRecord stream (encoding to PCM)") $iTimer = TimerInit() While 1 $bEncoderActive = _BASS_Encode_IsActive($hEncoder) If $bEncoderActive = $BASS_ACTIVE_PLAYING Then ___Debug(0, "encoder is running") If $bEncoderActive = $BASS_ACTIVE_PAUSED Then ___Debug(0, "encoder is paused") $iSent = _BASS_Encode_GetCount($hEncoder, $BASS_ENCODE_COUNT_IN) ___Debug(-1, "data sent to encoder : " & $iSent) If TimerDiff($iTimer) > 5000 Then ExitLoop Sleep(1000) WEnd _BASS_Encode_SetPaused($hEncoder, True) ___Debug(@error, "encoder paused") $iTimer = TimerInit() While 1 $bEncoderActive = _BASS_Encode_IsActive($hEncoder) If $bEncoderActive = $BASS_ACTIVE_PLAYING Then ___Debug(0, "encoder is running") If $bEncoderActive = $BASS_ACTIVE_PAUSED Then ___Debug(0, "encoder is paused") $iSent = _BASS_Encode_GetCount($hEncoder, $BASS_ENCODE_COUNT_IN) ___Debug(-1, "data sent to encoder : " & $iSent) If TimerDiff($iTimer) > 5000 Then ExitLoop Sleep(1000) WEnd _BASS_Encode_Stop($hEncoder) ___Debug(@error, "stop encoder") _BASS_RecordFree() ___Debug(@error, "free recording device") Func ___DeBug($iError, $sAction) Switch $iError Case -1 ConsoleWrite(@CRLF & "-" & $sAction & @CRLF) Case 0 ConsoleWrite(@CRLF & "+" & $sAction & " - OK" & @CRLF) Case Else ConsoleWrite(@CRLF & "!" & $sAction & " - FAILED" & @CRLF) Exit EndSwitch EndFunc ;==>___DeBug DirectSound UDF Direct2D UDF Link to comment Share on other sites More sharing options...
RupDon Posted May 5, 2014 Share Posted May 5, 2014 Thanks for the reply eukalyptus , I know about this example it is used for 3 dll file Bass.dll , BassENC.dll , BassEXT.dll . As in the original examples of http://www.un4seen.com is used only Bass.dll. Link to comment Share on other sites More sharing options...
eukalyptus Posted May 7, 2014 Share Posted May 7, 2014 Try this script: expandcollapse popup#AutoIt3Wrapper_UseX64=n #include "Bass.au3" HotKeySet("{ESC}", "_EXIT") _BASS_Startup() _BASS_RecordInit(-1) Global $hRecord = _BASS_RecordStart(44100, 2, 0, Null) Global $iBufferSize = 20000 Global $tBuffer = DllStructCreate("byte Samples[" & $iBufferSize & "];") Global $bHeader = _CreateWavHeader($hRecord) Global $hFile = FileOpen(@ScriptDir & "\Test.wav", 18) FileWrite($hFile, $bHeader) ProgressOn("Recording", "buffer usage") Global $iBytes, $iSize = 0 While 1 $iBytes = DllCall($_ghBassDll, "uint", "BASS_ChannelGetData", "hwnd", $hRecord, "struct*", $tBuffer, "uint", $iBufferSize)[0] $iSize += $iBytes ProgressSet($iBytes * 100 / $iBufferSize, StringFormat("%.1f% bufferusage %.1f KB recorded", $iBytes * 100 / $iBufferSize, $iSize / 1024)) #cs uncomment to update the wavheader every time FileSetPos($hFile, 4, 0) FileWrite($hFile, BinaryMid(Binary($iSize + 36), 1, 4)) ;write WavHeader.FileSize FileSetPos($hFile, 40, 0) FileWrite($hFile, BinaryMid(Binary($iSize), 1, 4)) ;write WavHeader.DataLength FileSetPos($hFile, 0, 2) #ce FileWrite($hFile, BinaryMid($tBuffer.Samples, 1, $iBytes)) ;write Samples Sleep(80) WEnd Func _CreateWavHeader($hRecord) Local $tInfo = DllStructCreate("uint Freq; uint Chans; uint Flags; uint cType; uint OrigRes; uint Plugin; uint Sample; ptr Filename;") DllCall($_ghBassDll, "int", "BASS_ChannelGetInfo", "hwnd", $hRecord, "struct*", $tInfo) Local $iBits = BitAND($tInfo.Flags, $BASS_SAMPLE_8BITS) ? 8 : 16 Local $iBlock = Floor($tInfo.Chans * ($iBits / 8)) Local $tWave = DllStructCreate("char RIFF [4]; uint FileSize; char WAVE[4]; char fmt[4]; uint fmt_len; word Format; word Channels; uint Samplerate; uint Bytes; word Block; word BitsPerSample; char DATA[4]; uint Len;") $tWave.RIFF = "RIFF" $tWave.WAVE = "WAVE" $tWave.fmt = "fmt " $tWave.fmt_len = 16 $tWave.Format = 1 $tWave.Channels = $tInfo.Chans $tWave.Samplerate = $tInfo.Freq $tWave.Bytes = $tInfo.Freq * $iBlock $tWave.Block = $iBlock $tWave.BitsPerSample = $iBits $tWave.DATA = "data" Local $tByte = DllStructCreate("byte Data[" & DllStructGetSize($tWave) & "]", DllStructGetPtr($tWave)) Return $tByte.Data EndFunc ;==>_CreateWavHeader Func _EXIT() FileSetPos($hFile, 4, 0) FileWrite($hFile, BinaryMid(Binary($iSize + 36), 1, 4)) ;write WavHeader.FileSize FileSetPos($hFile, 40, 0) FileWrite($hFile, BinaryMid(Binary($iSize), 1, 4)) ;write WavHeader.DataLength FileClose($hFile) _BASS_RecordFree() Exit EndFunc ;==>_EXIT DirectSound UDF Direct2D UDF Link to comment Share on other sites More sharing options...
RupDon Posted May 7, 2014 Share Posted May 7, 2014 Thank you very much Link to comment Share on other sites More sharing options...
Fenzik Posted June 27, 2014 Share Posted June 27, 2014 Hi, i'm beginner with bass and i have that question. Is possible to record downloaded radio stream directly to file? Can someone help me with some example? Thank you so much! Link to comment Share on other sites More sharing options...
nend Posted June 30, 2014 Share Posted June 30, 2014 Hi, i'm beginner with bass and i have that question. Is possible to record downloaded radio stream directly to file? Can someone help me with some example? Thank you so much! You can use bassenc and lame Start radio stream and then start this below. To start: _BASS_Encode_Start($handle, '"' & @ScriptDir & 'lame" -r -x -b' & $bitrate & ' -h - "' & $file & '"', 0) To stop: _BASS_Encode_Stop($handle) coffeeturtle 1 Link to comment Share on other sites More sharing options...
Fenzik Posted July 1, 2014 Share Posted July 1, 2014 Thank you for tip. But i am downloading stream in ogg format and dont want to reencode it. I am using inetget but it is unstable if downloading more streams together. I hope that i can use callback function from bass.dll but i dont know what.. Link to comment Share on other sites More sharing options...
bolthead Posted July 22, 2014 Share Posted July 22, 2014 (edited) OK I’m not a scripter, merely a rare part time hobbyist because of the hours I work, but as I’m off work at the moment with a broken leg I was asked by one of my sons if it was possible to create an equalizer and/or audio effects with Autoit. So being a little familiar with the bass udf I came up the example below. Some of the effects are copied from the examples provided by eucalyptus so many thanks to him because it pointed me in the right direction to create more. Obviously you need at least bass.dll, bass and bass_FX.dll Please give it a try and offer suggestions for improvement. Edit: Thanks wakillon for your comments EqualizerTest.au3 Edited August 26, 2014 by bolthead coffeeturtle and wakillon 2 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