Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

BASS Function Library (Sound and Music Functions)


  • Please log in to reply
494 replies to this topic

#1 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 29 October 2008 - 10:38 AM

*
POPULAR

BASS Function Library

This library is a wrapper for the powerful Bass.DLL and add-ons (which increase the functionality of Bass.DLL). Bass.DLL is ideal for use in your applications and scripts if you want an easy way to play a vast range of music and sound files formats while keeping dependency on just Bass.dll and it's add-ons (which in turn maximizes compatibility and minimizes extra requirements for your software to run.), while retaining a small file size.

The UDFs included with the release are:

Bass
The basic Bass library. Required with all (most) add-on libraries. Provides playback of many sound files (and streams).

BassASIO (By eukalyptus)
BASSASIO is basically a wrapper for ASIO drivers, with the addition of channel joining, format conversion and resampling.

BassCD
Allows for digital streaming and ripping of audio CDs along with analog playback support.

BassFX (By eukalyptus/BrettF)
An extension providing several effects, including tempo & pitch control.

BassEnc (By eukalyptus)
An extension that allows BASS channels to be encoded using any command-line encoder with STDIN support (LAME/OGGENC/etc), or any ACM codec. Also features Shoutcast and Icecast stream sourcing, and PCM/WAV file writing.

BassSFX

Provides a complete set of functions to include support for winamp, sonique, bassbox, and Windows Media Player visualization plugins.

BassTags
Provides a simple way to retrieve ID3 tags from stream handles.

BassCB/Bass_EXT (ProgAndy)
This is for advanced users. BassCB allows the playback of streams in AutoIt.

BassVST
Allows use of VST effect plugins.

Download
The download includes all of the wrapper and constants,
the original download, examples for all of the previously mentioned add-ons, sample audio files (6 channel audio files also included), sample visualization plugins for BassSFx and more.

Current Version: 9
Size: 7360KB
AutoIt Version Required: 3.3.2.0
Changelog:
/> Fixed _BassRecordGetInputName (updated production versions) +> Added Memory Examples of Bass (Thanks ProgAndy and UEZ) +> Added BassVST (Not 100% complete) +> Added BassFX Examples showing use of most functions:     Pitch.au3     Reverse.au3     Tempo.au3 /> Fixed error with calling _BASS_ErrorGetCode in BASSCD.au3 /> Fixed startup functions return the wrong value (Thanks ProgAndy!) +> Added helper functions _BASS_ChannelSetVolume, _BASS_ChannelGetVolume (Thanks ProgAndy)


Download Link: Attached File  DOWNLOAD_BASS.txt   137bytes   4488 downloads

Previous versions are not supported, but can be found here.

Patches:
Patch 1 "BASS_ASIO"
Fixes issues with BASS ASIO and examples.
Attached File  BASS_PATCH_9_1.zip   6.1KB   1809 downloads
Patch 2 "BASS_FX/BASS"
Fixes issues with BASS FX and BASS.
Attached File  BASS_PATCH_9_2.zip   39.23KB   2662 downloads

Edited by BrettF, 18 May 2010 - 10:08 PM.

  • this-is-me, jaberwacky, careca and 4 others like this







#2 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 29 October 2008 - 10:39 AM

Great example of visualisations using bass.dll:
Thanks to monoceres.
http://www.autoitscript.com/forum/index.ph...st&p=596104

Edited by BrettF, 10 November 2008 - 09:13 AM.


#3 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 29 October 2008 - 10:54 AM

Great! I recommend to rename _PtrStringRead to __BASS_PtrStringRead :P So there are no errorrs, if another UDF incudes those function, too :(
*GERMAN* Posted Image [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

#4 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 29 October 2008 - 11:05 AM

Great! I recommend to rename _PtrStringRead to __BASS_PtrStringRead :P So there are no errorrs, if another UDF incudes those function, too :(

Was the header info for those functions correct? I basically made it up from what I understood about it... :idea:

#5 ronriel

ronriel

    Seeker

  • Active Members
  • 45 posts

Posted 29 October 2008 - 11:06 AM

This is very interesting!

Thank you.

#6 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 29 October 2008 - 11:14 AM

Was the header info for those functions correct? I basically made it up from what I understood about it... :(

Well, most ist correct :P Here the corrected headers:
AutoIt         
; #INTERNAL# ==================================================================================================================== ; Name...........: _PtrStringLen ; Description ...: Retrieves the lenth of a string in a PTR. ; Syntax.........: _PtrStringLen($ptr, $IsUniCode = False) ; Parameters ....:  -   $ptr                   -  Pointer to the string ;                   -   [Optional] $IsUniCode  -  True = Unicode, False (Default) = ANSI ; Return values .: Success   -   Returns length of string ( can be 0 as well ) ;                  Failure   -   Returns -1 and sets @ERROR ;                                   @error will be set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== ; #INTERNAL# ==================================================================================================================== ; Name...........: _PtrStringRead ; Description ...: Reads a string from a pointer ; Syntax.........: _PtrStringRead($ptr, $IsUniCode = False, $StringLen = -1) ; Parameters ....:  -   $ptr        -  Pointer to the string ;                   -   $IsUniCode  -  [Optional] True = Unicode, False (Default) = ANSI ;                   -   $StringLen  -  [Optional] Length of the String ; Return values .: Success  -  Returns the read string (can be empty) ;                  Failure  -  Returns "" (empty String) and sets @ERROR ;                                   @error will be set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; ===============================================================================================================================

Edited by ProgAndy, 29 October 2008 - 11:14 AM.

*GERMAN* Posted Image [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

#7 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 29 October 2008 - 11:24 AM

Thanks mate. Edited on my copy. Not too much difference so will upload when someone does the inevitable and finds where I've missed something... :P

#8 eukalyptus

eukalyptus

    Adventurer

  • Active Members
  • PipPip
  • 125 posts

Posted 29 October 2008 - 11:40 AM

YEAHHH!!! You are my Hero!

Thx for this great stuff!

#9 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 6,246 posts

Posted 29 October 2008 - 02:35 PM

Thanks mate. Edited on my copy. Not too much difference so will upload when someone does the inevitable and finds where I've missed something... :P

_BASS_ChannelBytes2Seconds()... "uint65" ???
_BASS_ChannelGetPosition()... change return type from "uint64" to "udword"
...... ......
.:oOOOOo:. .:oOOOOo:.
.:oOO:'':Oo:. .:oO:'':OOo:.
.:oO: 'Oo:oO' :Oo:.
:oO: 'o'
:Oo:
:oO: :Oo:
':oO: OT9AO0IEDrk :Oo:'
':oO: :Oo:'
':oO. .Oo:'
':oO
. .Oo:'
':oO. .Oo:'
':oO. .Oo:'
'oO:Oo'
'o' :kiss:





.
eMyvnE


#10 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 29 October 2008 - 08:35 PM

_BASS_ChannelBytes2Seconds()... "uint65" ???
_BASS_ChannelGetPosition()... change return type from "uint64" to "udword"

ty :P

#11 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 30 October 2008 - 02:33 AM

_BASS_ChannelBytes2Seconds()... "uint65" ???
_BASS_ChannelGetPosition()... change return type from "uint64" to "udword"

This is confusing me, cause it never works for me (setting position.) I have something working, but its not updating the position?

EDIT: Worked it out! Will update bass.au3 soon, and add another example of getting and setting the position!

Edited by BrettF, 30 October 2008 - 08:15 AM.


#12 eukalyptus

eukalyptus

    Adventurer

  • Active Members
  • PipPip
  • 125 posts

Posted 02 November 2008 - 12:00 PM

Hi

How do I get the name of a recordingdevice?

_BASS_RecordGetDeviceInfo returns only: 0x00144328

thx
E

#13 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 02 November 2008 - 08:59 PM

Made a mistake. How does this go for you?
Example
;Get Recording Device Information. #include <Bass.au3> #include <BassConstants.au3> #include <Array.au3> $bass_dll = DllOpen("BASS.dll") $return = _BASS_RecordGetDeviceInfo($bass_dll, 0) _ArrayDisplay ($return)


Function
Plain Text         
; #FUNCTION# ==================================================================================================== ================ ; Name...........: _BASS_RecordGetDeviceInfo ; Description ...: Retrieves information on a recording device. ; Syntax.........: _BASS_RecordGetDeviceInfo($bass_dll, $device) ; Parameters ....:  -   $bass_dll   -   Handle to opened Bass.dll ;                   -   $device     -   The device to get the information of... 0 = first. ; Return values .: Success    - Returns an array containg the device info. ;                                   - [0] = Name ;                                       - Description of the device. ;                                   - [1] = Driver ;                                       - driver The filename of the driver... ;                                          NULL = no driver ("no sound" device). On systems that can use both VxD and WDM ;                                          drivers (Windows Me/98SE), this will reveal which type of driver is being used. ;                                          Further information can be obtained from the file using the GetFileVersionInfo ;                                          Win32 API function. ;                                   - [2] = Flags ;                                       - The device's current status... a combination of these flags. ;                                           - BASS_DEVICE_ENABLED ;                                               - The device is enabled. It will not be possible to initialize the ;                                                 device if this flag is not present. ;                                           - $BASS_DEVICE_DEFAULT ;                                               - The device is the system default. ;                                           - $BASS_DEVICE_INIT ;                                               - The device is initialized, ie. BASS_Init or BASS_RecordInit has been called. ;                 Failure     - Returns 0 and sets @ERROR to error returned by _BASS_ErrorGetCode() ;                                   @error will be set to- ;                                       - $BASS_ERROR_DX ;                                           - A sufficient version of DirectX is not installed. ;                                       - $BASS_ERROR_DEVICE ;                                           - device is invalid. ; Author ........: Brett Francis (BrettF) ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; ==================================================================================================== =========================== Func _BASS_RecordGetDeviceInfo($bass_dll, $device)     Local $aRet[3]     $sRet = DllStructCreate($BASS_DEVICEINFO)     $BASS_ret_ = DllCall($bass_dll, "int", "BASS_RecordGetDeviceInfo", "dword", $device, "ptr", DllStructGetPtr($sRet))     $error = _BASS_ErrorGetCode($bass_dll)     If $error <> 0 Then         Return SetError($error, "", 0)     Else         $rest = DllStructCreate ("char[255]", DllStructGetData($sRet, 1))         $aRet[0] = DllStructGetData ($rest, 1)         $rest = DllStructCreate ("char[255]", DllStructGetData($sRet, 2))         $aRet[1] = DllStructGetData ($rest, 1)         $aRet[2] = DllStructGetData($sRet, 3)         Return SetError(0, "", $aRet)     EndIf EndFunc  ;==>_BASS_RecordGetDeviceInfo


Cheers,

Brett

#14 eukalyptus

eukalyptus

    Adventurer

  • Active Members
  • PipPip
  • 125 posts

Posted 02 November 2008 - 09:42 PM

works fine :mellow:

big thx!

#15 rasim

rasim

    Gray Scripter

  • Active Members
  • PipPipPipPipPipPip
  • 1,708 posts

Posted 03 November 2008 - 03:18 AM

BrettF
Great job! Thank you for sharing! :mellow:
OS: Windows XP SP3, AutoIt version: 3.3.0.0Posted Image My Projects: Free_Resources | Splitter | wgetGUI | UnRARIt | USBMon | CDROM-Control | Volume Serial Changer | WinTrayPosted Image My UDFs: _ScreenSetting | ListView_Progress | ContextHelp | ToolTip_UDF | UnRAR | Zip32 | BassMod | ShellTreeView | GuiHotKey | 7ZipPosted Image My Examples: TrayIcon_Click | SystemTray_Refresh | _ListView_Sort | CPUmonLike above scripts? Please rate the topic Posted Image

#16 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 03 November 2008 - 06:33 AM

Thanks!

First post will be updated soon when I get round to it... I might make a new example based around Monoceres' work on visualisations. They really do rock!

Cheers,

Brett

#17 eukalyptus

eukalyptus

    Adventurer

  • Active Members
  • PipPip
  • 125 posts

Posted 03 November 2008 - 12:55 PM

Hi

I´ve tried to write an UDF for bassenc.dll
bassenc.dll is used to write audiodata to disk, send to an encoder (lame.exe...) or stream to an icecast or shoutcast-server.

Attached File  bassenc.rar   362.58KB   1302 downloads

there are 2 examples (simple wav/mp3 recording scripts) included:
example_callback.au3
example_no_callback.au3

why?

because there are problems...

if you use _BASS_RecordStart without a CallBack then you´ve to call _BASS_ChannelGetLevel at least once in the specified $BASS_CONFIG_REC_BUFFER-time otherwise no data is sent to the encoder!?!
This example is stable, but if you are moving the GUI during encoding, no _BASS_ChannelGetLevel is called and the recordingfile has dropouts.

_BASS_RecordStart with a CallBack sends all recorded data to the encoder, but the callback procedure crashes the script after a while!
can this be fixed?

I hope you understand my bad english :mellow:

Eukalyptus


by the way:
I found 3 bugs:
line 218: "_BASS_SetConfig"
________^ underscore
line 1092: " BASS_Get3DFactors"
_________^ space
_BASS_RecordStart: if you don´t use a callback ("") then error @ DllCallBackRegister

#18 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 04 November 2008 - 08:47 AM

Hi

I´ve tried to write an UDF for bassenc.dll
bassenc.dll is used to write audiodata to disk, send to an encoder (lame.exe...) or stream to an icecast or shoutcast-server.

Attached File  bassenc.rar   362.58KB   1302 downloads

there are 2 examples (simple wav/mp3 recording scripts) included:
example_callback.au3
example_no_callback.au3

why?

because there are problems...

if you use _BASS_RecordStart without a CallBack then you´ve to call _BASS_ChannelGetLevel at least once in the specified $BASS_CONFIG_REC_BUFFER-time otherwise no data is sent to the encoder!?!
This example is stable, but if you are moving the GUI during encoding, no _BASS_ChannelGetLevel is called and the recordingfile has dropouts.

_BASS_RecordStart with a CallBack sends all recorded data to the encoder, but the callback procedure crashes the script after a while!
can this be fixed?

I hope you understand my bad english :(

Eukalyptus


by the way:
I found 3 bugs:
line 218: "_BASS_SetConfig"
________^ underscore
line 1092: " BASS_Get3DFactors"
_________^ space
_BASS_RecordStart: if you don´t use a callback ("") then error @ DllCallBackRegister

I will take a look at the BASSENC, but I'm confused about the first 2 bugs... Number 3 makes sense :)

EDIT
Nice work on BASSENC! It looks nice and works very well. I've started to get BASS_Video in the works as well. I'd say it might be easier to use an ADLIB loop? See how that goes. Its nice to see people expanding on the original UDF to start to utilise the many other BASS_*.dll's. Nice work! :mellow:

Cheers,

Brett

Edited by BrettF, 04 November 2008 - 08:57 AM.


#19 eukalyptus

eukalyptus

    Adventurer

  • Active Members
  • PipPip
  • 125 posts

Posted 04 November 2008 - 09:53 AM

...but I'm confused about the first 2 bugs... Number 3 makes sense :mellow:


wrong dll-function names:
DllCall($bass_dll, "int", "_BASS_SetConfig"...
the functionname in bass.dll is "BASS_SetConfig" without the first underscore. (copy & paste *g*)

---

Because of the crashing callback, I wrote a dll in freepascal some time ago, including the basic functions I need to record audio.
Do you think that it´s possible to write a dll with the function _Bass_RecordStart incl. callback and do all the other things in AutoIt?
The problem is, that the dll and AutoIt have to use the same instance/handle of bass.dll !?

c.u.
E

#20 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 04 November 2008 - 10:18 AM

Ah I see now. I've fixed them, will update some time soon.

Can't write DLLs in AutoIt. :mellow:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users