BrettF Posted May 31, 2010 Author Share Posted May 31, 2010 Wasn't directed at you in particular, just as a reminder for me (to finish), and so others know that it is being worked on (as to not have two people do the same thing.) Are your issues fixed now? Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BrettF Posted May 31, 2010 Author Share Posted May 31, 2010 (edited) Introducing Bass_WASAPI RC1. Here is a new BASSWASAPI add-on, making it possible to use WASAPI output and input (available on Windows Vista and beyond) with BASS. Both exclusive and shared modes are supported, as are both output and input devices, as well as "loopback" devices (which capture the sound from output devices). Unlike BASSASIO, BASSWASAPI does require BASS, and the BASSmix add-on is recommended too. WASAPI doesn't support arbitrary sample formats (like DirectSound does), and BASSWASAPI doesn't include built-in resampling capability; BASSmix can be used to handle resampling instead (as well as playing multiple sounds), as in the examples. A BASSmix update is also included in the package above, which adds a new feature (the BASS_Mixer_ChannelGetPositionEx function) to account for output latency when getting the position of a source channel; see the CONTEST example for a demonstration of using that. The DLL itself is not a final release, so things may change. Once a stable version is released, this will be added into the full library. This wrapper is currently untested... Any examples, suggestions, fixes are appreciated Download the RC1_1 here: BASS_WASAPI_RC1_1.zip Cheers, Brett EDIT: Forgot to add updated BassMix with the extra function.,, Edited May 31, 2010 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
nico18n Posted May 31, 2010 Share Posted May 31, 2010 (edited) i refer to ...convert sampling rate of a wav file using bass.dll I missed bassmix.dll. Now it works. To get a better quality of audio output what should be done? I tried to do the same thing with sox and saw that its quality is better with the same parameters. Edited May 31, 2010 by nico18n Link to comment Share on other sites More sharing options...
BrettF Posted June 1, 2010 Author Share Posted June 1, 2010 What is happening with output for it to be bad? I've never had a problem with the quality of it. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
a440hz Posted June 1, 2010 Share Posted June 1, 2010 (edited) Moitah, the author of CenterCutGUI, was kind enough to add a stdin and stdout switch at my request and it works fine via dos. Per Eucalyptus's suggestion I tried to incorporate it with BASSEnc but I can't get it to work. I'm also unable to use any of the BassEncConstants without undefined function errors. The only way to get them to recognized is to include BassEncConstants.The lone example in the zip file is not enough for me figure this out.Link to CenterCutGui 1.6.0 (also includes CenterCutCL)Please help! Thanks,Joe#include <Bass.au3> #include <BassMix.au3> #include <BassEnc.au3> _BASS_STARTUP() _BASS_Encode_STARTUP() $basscb_dll = DllOpen("BASSCB.dll") ;DO I NEED THIS? Global $ChHandle,$EncHandle,$Channel1,$dur,$pos _BASS_Init($BASS_DEVICE_SPEAKERS, -1, 44100, 0,"") $ChHandle= _BASS_StreamCreate(44100,2,0,0,0) $EncHandle = _BASS_Encode_Start($ChHandle, 'CenterCutCl Stereo.wav -c stdout ', 0) $Channel1 = _BASS_Encode_GetChannel($EncHandle) $dur = _BASS_ChannelGetLength($Channel1, $BASS_POS_BYTE) _BASS_ChannelPlay($Channel1, False) Do Sleep(50) $pos = _BASS_ChannelGetPosition($Channel1, $BASS_POS_BYTE) Until $pos >= $dur Exit Func ExitFunctions () _BASS_Stop() _BASS_Free() EndFunc Edited June 1, 2010 by a440hz Are you experienced? Link to comment Share on other sites More sharing options...
a440hz Posted June 1, 2010 Share Posted June 1, 2010 (edited) Brett, I was wondering why my channel assignments weren't working correctly in Windows 7. So this should help or should I just try to figure out BASSASIO? I DL the file but no examples. Can you tell me what I would modify to use your MultiChannelViewer.au3? All the best, Joe Introducing Bass_WASAPI RC1. The DLL itself is not a final release, so things may change. Once a stable version is released, this will be added into the full library. This wrapper is currently untested... Any examples, suggestions, fixes are appreciated Download the RC1_1 here: BASS_WASAPI_RC1_1.zip Cheers, Brett EDIT: Forgot to add updated BassMix with the extra function.,, Edited June 1, 2010 by a440hz Are you experienced? Link to comment Share on other sites More sharing options...
BrettF Posted June 1, 2010 Author Share Posted June 1, 2010 Moitah, the author of CenterCutGUI, was kind enough to add a stdin and stdout switch at my request and it works fine via dos. Per Eucalyptus's suggestion I tried to incorporate it with BASSEnc but I can't get it to work. I'm also unable to use any of the BassEncConstants without undefined function errors. The only way to get them to recognized is to include BassEncConstants. The lone example in the zip file is not enough for me figure this out. Link to CenterCutGui 1.6.0 (also includes CenterCutCL) Please help! Thanks, Joe #include <Bass.au3> #include <BassMix.au3> #include <BassEnc.au3> _BASS_STARTUP() _BASS_Encode_STARTUP() $basscb_dll = DllOpen("BASSCB.dll") ;DO I NEED THIS? Global $ChHandle,$EncHandle,$Channel1,$dur,$pos _BASS_Init($BASS_DEVICE_SPEAKERS, -1, 44100, 0,"") $ChHandle= _BASS_StreamCreate(44100,2,0,0,0) $EncHandle = _BASS_Encode_Start($ChHandle, 'CenterCutCl Stereo.wav -c stdout ', 0) $Channel1 = _BASS_Encode_GetChannel($EncHandle) $dur = _BASS_ChannelGetLength($Channel1, $BASS_POS_BYTE) _BASS_ChannelPlay($Channel1, False) Do Sleep(50) $pos = _BASS_ChannelGetPosition($Channel1, $BASS_POS_BYTE) Until $pos >= $dur Exit Func ExitFunctions () _BASS_Stop() _BASS_Free() EndFunc Can you make it work with the GUI interface? Brett, I was wondering why my channel assignments weren't working correctly in Windows 7. So this should help or should I just try to figure out BASSASIO? I DL the file but no examples. Can you tell me what I would modify to use your MultiChannelViewer.au3? All the best, Joe No idea. I haven't even looked at examples yet... Can you post your code? At least that way I might be able to figure something out Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
a440hz Posted June 2, 2010 Share Posted June 2, 2010 Can you make it work with the GUI interface? No idea. I haven't even looked at examples yet... Can you post your code? At least that way I might be able to figure something out Oh sure, I was using it with the GUI from the get go. I don't want anything popping up though - I need to stream everything without saving any files. Are you experienced? Link to comment Share on other sites More sharing options...
eukalyptus Posted June 2, 2010 Share Posted June 2, 2010 What you want to do is realy, realy complicated.maybe it works like this:First create a stream from the stereofile with _BASS_StreamCreateFileThen set CenterCutCL as encoder on this stream: _BASS_Encode_Start($stream, 'CenterCutCl stdin -c stdout -o', 0, "_EncCallBack")(You will receive the processed data in the callback-function _EncCallBack)Create another stream by using _BASS_StreamCreateFileUserInside _EncCallBack you have to push the data to the FileUserStream: _BASS_StreamPutFileDataBUT:there is an unfixed error in _BASS_Encode_Start DllCallBackRegister: "dword;dword;ptr;dword;ptr"_BASS_StreamCreateFileUser is not implemented yetAutoIt is to slow to handle big amount of sampledata in a callback function.(but this could be done by using an external dll...)To use _BASS_StreamCreateFileUser you have to set up some more callback functions(here you can take a look how to use _BASS_StreamCreateFileUser: #710665) DirectSound UDF Direct2D UDF Link to comment Share on other sites More sharing options...
a440hz Posted June 7, 2010 Share Posted June 7, 2010 Can you make it work with the GUI interface? No idea. I haven't even looked at examples yet... Can you post your code? At least that way I might be able to figure something out My Bad. Once I updated HDAudio drivers all channels are assigned correctly!! Are you experienced? Link to comment Share on other sites More sharing options...
a440hz Posted June 7, 2010 Share Posted June 7, 2010 What you want to do is realy, realy complicated. maybe it works like this: First create a stream from the stereofile with _BASS_StreamCreateFile Then set CenterCutCL as encoder on this stream: _BASS_Encode_Start($stream, 'CenterCutCl stdin -c stdout -o', 0, "_EncCallBack") (You will receive the processed data in the callback-function _EncCallBack) Create another stream by using _BASS_StreamCreateFileUser Inside _EncCallBack you have to push the data to the FileUserStream: _BASS_StreamPutFileData BUT: there is an unfixed error in _BASS_Encode_Start DllCallBackRegister: "dword;dword;ptr;dword;ptr" _BASS_StreamCreateFileUser is not implemented yet AutoIt is to slow to handle big amount of sampledata in a callback function. (but this could be done by using an external dll...) To use _BASS_StreamCreateFileUser you have to set up some more callback functions (here you can take a look how to use _BASS_StreamCreateFileUser: #710665) Wow, it's complex! Monoceres writes amazing code but I'm not sure how to begin to decipher his example, which streams audio in little chunks, into what I need to do. If I type the following into dos prompt, centercutcl stereo.wav -c stdout > mono.wav, the result saves the file. Is there any possible way just to pipe the stdout to RAM and stream that into a bass channel buffer instead of a file? I found this but dont know C char bigOutBuf[8192]; char savBuf[8192]; fflush(stdout); setvbuf(stdout,bigOutBuf,IOFBF,8192);//stdout uses your buffer //after each operation strncpy(savBuf,bigOutBuf,8192);//won't flush until full or fflush called //... //at long last finished setbuf(stdout,NULL);//reset to unnamed buffer Sorry to be so dense! Are you experienced? Link to comment Share on other sites More sharing options...
nico18n Posted June 8, 2010 Share Posted June 8, 2010 (edited) What is happening with output for it to be bad? I've never had a problem with the quality of it.Hello brettf. Sorry for the delay. my mistake was because I wanted a mono audio. But putting one I took only one channel (left or right). How do I get an audio mixing left and right way?$hMixer = _BASS_Mixer_StreamCreate($rate,1, BitOR($BASS_MIXER_END, $BASS_STREAM_DECODE)) Edited June 8, 2010 by nico18n Link to comment Share on other sites More sharing options...
ProgAndy Posted June 8, 2010 Share Posted June 8, 2010 i think, you have to create a mixer with 1 channel, the input is a stereo stream. Then use BASS_Mixer_ChannelSetMatrix to set a mixing matrix of this format: (psuedocode) float[1][2] = [ [ 0.5, 0.5 ] ] Or use the flag $BASS_MIXER_DOWNMIX $hMixer = _BASS_Mixer_StreamCreate($rate,1, BitOR($BASS_MIXER_END, $BASS_STREAM_DECODE)) $hChannel = _BASS_Mixer_StreamAddChannel($hMixer, $hStream, $BASS_MIXER_DOWNMIX) The matric would be creted this way (_BASS_Mixer_StreamAddChannel with flag $BASS_MIXER_MATRIX) $tMatrix = DLLStructCreate("float[2]") DLLStructSetData($tMatrix, 1, 0.5, 1) DLLStructSetData($tMatrix, 1, 0.5, 2) _BASS_Mixer_ChannelSetMatrix($hChannel, DLLStructGetPtr($tMatrix)) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
eukalyptus Posted June 8, 2010 Share Posted June 8, 2010 @nico18n:SetMatrix($hMixer, 1, 1) Func SetMatrix($handle, $left, $right) Local $tStruct = DllStructCreate("float;float") DllStructSetData($tStruct, 1, $left) DllStructSetData($tStruct, 2, $right) _BASS_Mixer_ChannelSetMatrix($handle, DllStructGetPtr($tStruct)) EndFunc ;==>SetMatrixbtw.: BassMix resamples a lot of channels in realtime, so the algorithm is not as good as ffmpeg or sox etc... --------------------------------------@a440hz:great idea, this should work:expandcollapse popup#include "Bass.au3" #include <Memory.au3> #include <Constants.au3> HotKeySet("{ESC}", "_Exit") Global $hPid, $sStdout = "", $bStdout, $iSize Global $hStream, $tStruct, $pStruct, $iPos $hPid = Run("CenterCutCl stereo.wav -c stdout", @ScriptDir, @SW_SHOW, $STDOUT_CHILD) While 1 $sStdout &= StdoutRead($hPid) If @error Then ExitLoop WEnd $bStdout = StringToBinary($sStdout) $iSize = BinaryLen($bStdout) ___DeBug(@error, "binarylen of stdout: " & $iSize) _BASS_STARTUP() ___Debug(@error, "load bass.dll") _BASS_Init($BASS_DEVICE_SPEAKERS, -1, 44100, 0, "") ___Debug(@error, "bass init") $tStruct = DllStructCreate("byte[" & $iSize & "]") DllStructSetData($tStruct, 1, $bStdout) $pStruct = DllStructGetPtr($tStruct) $hStream = _BASS_StreamCreateFile(True, $pStruct, 0, $iSize, 0) ___Debug(@error, "create stream from memory") _BASS_ChannelPlay($hStream, 1) ___Debug(@error, "play stream from memory") While _BASS_ChannelIsActive($hStream) $iPos = _BASS_ChannelGetPosition($hStream, $BASS_POS_BYTE) ___Debug(@error, "play from memory: " & Round($iPos * 100 / $iSize) & "% done") Sleep(20) WEnd _Exit() Func _Exit() _BASS_StreamFree($hStream) ___Debug(@error, "free stream") _BASS_Free() ___Debug(@error, "free bass") Exit EndFunc ;==>_EXIT 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 ;==>___DeBugE DirectSound UDF Direct2D UDF Link to comment Share on other sites More sharing options...
ProgAndy Posted June 8, 2010 Share Posted June 8, 2010 @eukalyptus: StdOutRead can directly read binary, so stringtobinary is not needed (StdOutRead($hPid, 0, 1)) Additionally it ould be better if you use a push-stream, so you don't have to wait for the completion of centercutcl $hStream = _BASS_StreamCreate(44100, 2, 0, $STREAMPROC_PUSH, 0) _BASS_StreamPutData($hStream, ... *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
eukalyptus Posted June 8, 2010 Share Posted June 8, 2010 (edited) But you have to use _BASS_StreamCreateFileUser in this case and _BASS_StreamPutFileData to fill the streambuffer, isn´t it?!And you will need some callback functions:typedef struct { FILECLOSEPROC *close; FILELENPROC *length; FILEREADPROC *read; FILESEEKPROC *seek; } BASS_FILEPROCS;EDITTHX, thx, thx Prog@ndy!!!expandcollapse popup#include "Bass.au3" #include <Memory.au3> #include <Constants.au3> HotKeySet("{ESC}", "_Exit") Global $hPid, $bStdout, $iSize Global $hStream, $tStruct, $pStruct, $iPos, $iLength = 0 _BASS_STARTUP() ___Debug(@error, "load bass.dll") _BASS_Init($BASS_DEVICE_SPEAKERS, -1, 44100, 0, "") ___Debug(@error, "bass init") $hStream = _BASS_StreamCreate(44100, 1, 0, $STREAMPROC_PUSH, 0) ___Debug(@error, "create push stream") _BASS_ChannelPlay($hStream, 1) ___Debug(@error, "start stream") $hPid = Run("CenterCutCl stereo.wav -c stdout", @ScriptDir, @SW_HIDE, $STDOUT_CHILD) While 1 $bStdout = StdoutRead($hPid, 0, 1) If @error Then ExitLoop $iSize = BinaryLen($bStdout) If Not $iSize Then ContinueLoop ___DeBug(@error, "binarylen of stdout: " & $iSize) $iLength += $iSize $tStruct = DllStructCreate("byte[" & $iSize & "]") DllStructSetData($tStruct, 1, $bStdout) _BASS_StreamPutData($hStream, DllStructGetPtr($tStruct), DllStructGetSize($tStruct)) ___DeBug(@error, "streamputdata") $tStruct = 0 WEnd While _BASS_ChannelIsActive($hStream) $iPos = _BASS_ChannelGetPosition($hStream, $BASS_POS_BYTE) If $iPos >= $iLength Then ExitLoop Sleep(20) WEnd _Exit() Func _Exit() _BASS_StreamFree($hStream) ___Debug(@error, "free stream") _BASS_Free() ___Debug(@error, "free bass") Exit EndFunc ;==>_Exit 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 Edited June 8, 2010 by eukalyptus DirectSound UDF Direct2D UDF Link to comment Share on other sites More sharing options...
nico18n Posted June 8, 2010 Share Posted June 8, 2010 (edited) Thanks ProgAndy. ...Or use the flag $BASS_MIXER_DOWNMIX $hMixer = _BASS_Mixer_StreamCreate($rate,1, BitOR($BASS_MIXER_END, $BASS_STREAM_DECODE)) $hChannel = _BASS_Mixer_StreamAddChannel($hMixer, $hStream, $BASS_MIXER_DOWNMIX) ... Using this method, the result seems satisfactory. Should I try another set. thanks Edited June 8, 2010 by nico18n Link to comment Share on other sites More sharing options...
eukalyptus Posted June 8, 2010 Share Posted June 8, 2010 @a440hzI have created a testscript that uses CenterCut as encoder and plays the centercutted stream in (nearly) realtime.http://rapidshare.com/files/396702597/CenterCut.zip.htmlyou can feed now every bass stream to centercut;a stream from a file, or from the record-in, or a stream from an Url...And you can use any other cmdline prog with stdin/out...E DirectSound UDF Direct2D UDF Link to comment Share on other sites More sharing options...
a440hz Posted June 8, 2010 Share Posted June 8, 2010 Thanks E, I can't wait to get home from work to test your script out. This is fantastic!! So you are telling me that I can use SoX to create the LFE (it does stdout)?. Man, that would be awesome!! This is more than I could hope for. I've got some real fun ahead. You are a genius and a really super guy for putting up with a dumb, old dude like me. Thanks, Joe Are you experienced? Link to comment Share on other sites More sharing options...
eukalyptus Posted June 8, 2010 Share Posted June 8, 2010 To use sox for lfe, just insert: @ScriptDir & '\sox -s -b 16 -c 2 -r 44100 -t raw - -c 1 -t wav - Lowpass 120' you are now official beta tester of the brand-new BassExt.dll DirectSound UDF Direct2D UDF 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