Jump to content

BASS Function Library (Sound and Music Functions)


BrettF
 Share

Recommended Posts

UPDATED

Bass library has been updated to Version 9.

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)

Please see the first post for download link.

Link to comment
Share on other sites

Hey..

I really like you're bass udf!

I'm now trying to integrate it into my media player.

There's one question.

If you use _BASS_GetChannelPos($song, $BASS_POS_BYTE) (or Length) you get some big number for what the position is.

It's easy to use although I can't figure out how to convert the POS_BYTE's to (mili)seconds..

It would be really helpful if someone could show me how.

Thanks in advance..

Link to comment
Share on other sites

If you use _BASS_GetChannelPos($song, $BASS_POS_BYTE) (or Length) you get some big number for what the position is.

It's easy to use although I can't figure out how to convert the POS_BYTE's to (mili)seconds..

Try to use _BASS_ChannelBytes2Seconds :D

*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

"this page 9" , somewhere in the middle is my complete source for the player sample

http://www.autoitscript.com/forum/index.php?showtopic=83481&st=160

@Brettf: maybe you could integrate it in your Code sample archive of the Bass module?

Edited by nobbe
Link to comment
Share on other sites

  • 3 weeks later...

Hmm.. I don't realy like the sound of 'tempo'.

When I looked in the: _BASS_ChannelSetAtribute Function I saw the variable $BASS_..._SPEED, something with speed.

It sais: speed 1 to 255. So I tried it. But I can't get it to work.. Could somebody help me out?

Thnx!

Link to comment
Share on other sites

Tempo is generally measured in BPM. The faster the temp is, the more beats per minute- basically the faster the song goes.

I will try work up an example for you.

Cheers,

Brett

Link to comment
Share on other sites

BASS_ATTRIB_MUSIC_SPEED does only work for .MOD-files.

For anything else you have to use BassFX (BASS_FX_TempoCreate)

*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

Hi, I am using your Bass UDF to on some line-in measurement project. I would like to read the channel level value in form of "dB".

So far I have write up the script to use _Bass_ChannelGetLevel(). How may I do the conversion on the return value to read as "db" instead? Thanks

#include "Bass.au3"
#include "BassConstants.au3"
#Include <WinAPI.au3>

;Configure Bass Audio Library
;----------------------------
Global Const $bass_dll = _BASS_Startup(@ScriptDir & "\bass.dll")
If @error = -1 Then
MsgBox(16, "ERROR!", "Could not load BASS.dll" & @CR & "Terminating... ")
Exit
EndIf
_BASS_SetConfig($BASS_CONFIG_REC_BUFFER, 1000)
_BASS_RecordInit(-1)

$Cnt = 0
$Name = _BASS_RecordGetInputName(0)
While $Name <> ""
$Input = _BASS_RecordGetInput($Cnt)
If BitAND($Input[0], $BASS_INPUT_TYPE_WAVE) Then _BASS_RecordSetInput($Cnt, $BASS_INPUT_TYPE_WAVE, 1)
$Cnt += 1
$Name = _BASS_RecordGetInputName($Cnt)
WEnd

If @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_2008" Then _BASS_RecordSetInput(0, $BASS_INPUT_TYPE_WAVE, 1)

$RecHandle = _BASS_RecordStart(44100, 2, _WinAPI_MakeLong(0, 10))

While 1
;Read Audio Level
$levels = _BASS_ChannelGetLevel($RecHandle)
$LevelLeftCh = _WinAPI_LoWord($levels)
$LevelRightCh = _WinAPI_HiWord($levels)
ToolTip("Left Ch = " & $LevelLeftCh & " Right Ch = " & $LevelRightCh, 100, 100)
Sleep(50)
WEnd
Link to comment
Share on other sites

I'm just going to say impossible due to lots of inaccuracy... I'd say there would be no way to measure it unless you had a way to calibrate the level of input compared to the actual and so on. Way too complicated IMO.

Link to comment
Share on other sites

I'm just going to say impossible due to lots of inaccuracy... I'd say there would be no way to measure it unless you had a way to calibrate the level of input compared to the actual and so on. Way too complicated IMO.

Thanks for the advise. I came across some code from UEZ some time back, he did some calculation on your UDF to return the values smaller:http://www.4shared.com/file/91735747/7afe6e92/Visualizer_Analog_Meter.html

$levels = _BASS_ChannelGetLevel($bass_dll, $RecHandle)
$LevelLeftCh = _WinAPI_LoWord($levels)
$LevelRightCh = _WinAPI_HiWord($levels)
$LeftChLvl = $LevelLeftCh * 135 / 0x1500
$RightChLvl = $LevelRightCh * 135 / 0x1500

So if let say I have equipment like AP to do the input calibration, what's your advise on the reduction of values? My goal may not be absolute accuracy but some form of representation on the readings.

Link to comment
Share on other sites

You'd probably have to do some of your own testing. Such as generating a XdB tone and then see what value bass "see's".

Personally I wouldn't bother. For what its worth its too complicated and too inaccurate.

Link to comment
Share on other sites

  • 4 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...