Jump to content

BASS Function Library (Sound and Music Functions)


BrettF
 Share

Recommended Posts

I do not know how to do it but when I know which bass.dll function does what I want I can try to redo it in Autoit!

Link to comment
Share on other sites

On 18/10/2017 at 2:58 PM, nend said:

@Belini, maybe you can ask you question on the bass.dll/un4seen forum.
If you know how to do that you can convert it to autoit.

What is the bass.dll forum?

Link to comment
Share on other sites

Belini

You not it having luck?

Want a tip!

The answer is here in the topic.

Just read whit atention.

*/

https://www.autoitscript.com/forum/topic/83481-bass-function-library-sound-and-music-functions/

BassFX (By eukalyptus/BrettF)

An extension providing several effects, including tempo & pitch control.

/* 

Always has a lot of reference here, just use it.  ;)

That’s one job for you.

See you later ... Bye. :D

Edited by Fabio_iGames
Link to comment
Share on other sites

On 18/10/2017 at 11:40 AM, Belini said:

Does anyone know how to use bass.dll to raise and lower semi-tones (karaok efffect) in music?

 

I'm not sure if this is exactly what you're looking for but here's another example from the older UDF

 

#AutoIt3Wrapper_UseX64=n
#include "Bass.au3"
#include "BassFX.au3"

HotKeySet("{UP}", "_Pitch")
HotKeySet("{DOWN}", "_Pitch")
HotKeySet("{LEFT}", "_Pitch")
HotKeySet("{RIGHT}", "_Pitch")

HotKeySet("{ESC}", "_Exit")

Global $sFile = FileOpenDialog("Open...", "..\audiofiles", "playable formats (*.MP3;*.MP2;*.MP1;*.OGG;*.WAV;*.AIFF;*.AIF)")
Global $hStream, $hTempo
Global $iPitch = 0
Global $iTempo = 0

_BASS_STARTUP()
_BASS_FX_Startup()

_BASS_Init(0, -1, 44100, 0, "")

$hStream = _BASS_StreamCreateFile(False, $sFile, 0, 0, $BASS_STREAM_DECODE)
$hTempo = _BASS_FX_TempoCreate($hStream, $BASS_SAMPLE_LOOP)

_BASS_ChannelPlay($hTempo, 1)


While _BASS_ChannelIsActive($hTempo)
    ToolTip("Pitch: " & $iPitch & " semitones" & @CRLF & "Tempo: " & $iTempo & " percent")
    Sleep(100)
WEnd

_Exit()


Func _Exit()
    _BASS_StreamFree($hStream)
    _BASS_Free()
    Exit
EndFunc   ;==>_Exit

Func _Pitch()
    Switch @HotKeyPressed
        Case "{UP}"
            $iPitch += 1
            _BASS_ChannelSetAttribute($hTempo, $BASS_ATTRIB_TEMPO_PITCH, $iPitch)
        Case "{DOWN}"
            $iPitch -= 1
            _BASS_ChannelSetAttribute($hTempo, $BASS_ATTRIB_TEMPO_PITCH, $iPitch)
        Case "{LEFT}"
            $iTempo -= 1
            _BASS_ChannelSetAttribute($hTempo, $BASS_ATTRIB_TEMPO, $iTempo)
        Case "{RIGHT}"
            $iTempo += 1
            _BASS_ChannelSetAttribute($hTempo, $BASS_ATTRIB_TEMPO, $iTempo)
    EndSwitch
EndFunc   ;==>_Pitch

 

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 11 months later...

I used the example that was posted but sometimes the file opens without sound and I can only make it sound again by restarting everything, I created a _Back_sound () function but it also did not work, someone knows how to say why sometimes it starts without sound or how to do it without having to restart the script?

#AutoIt3Wrapper_UseX64=n
#include "Bass.au3"
#include "BassFX.au3"

HotKeySet("{UP}", "_Pitch")
HotKeySet("{DOWN}", "_Pitch")
HotKeySet("{LEFT}", "_Pitch")
HotKeySet("{RIGHT}", "_Pitch")

HotKeySet("{ENTER}", "_Back_sound"); Try to turn the sound back on when you start in silence

HotKeySet("{ESC}", "_Exit")

Global $sFile = FileOpenDialog("Open...", "..\audiofiles", "playable formats (*.MP3;*.MP2;*.MP1;*.OGG;*.WAV;*.AIFF;*.AIF)")
Global $hStream, $hTempo
Global $iPitch = 0
Global $iTempo = 0

_BASS_STARTUP()
_BASS_FX_Startup()

_BASS_Init(0, -1, 44100, 0, "")

$hStream = _BASS_StreamCreateFile(False, $sFile, 0, 0, $BASS_STREAM_DECODE)
$hTempo = _BASS_FX_TempoCreate($hStream, $BASS_SAMPLE_LOOP)

_BASS_ChannelPlay($hTempo, 1)


While _BASS_ChannelIsActive($hTempo)
    ToolTip("Pitch: " & $iPitch & " semitones" & @CRLF & "Tempo: " & $iTempo & " percent")
    Sleep(100)
WEnd

_Exit()

Func _Back_sound()
    _BASS_ChannelPlay($hTempo, 0)
    _BASS_ChannelSetVolume($hTempo, 100)
    _BASS_SetVolume(1)
EndFunc   ;==>_Back_sound

Func _Exit()
    _BASS_StreamFree($hStream)
    _BASS_Free()
    Exit
EndFunc   ;==>_Exit

Func _Pitch()
    Switch @HotKeyPressed
        Case "{UP}"
            $iPitch += 1
            _BASS_ChannelSetAttribute($hTempo, $BASS_ATTRIB_TEMPO_PITCH, $iPitch)
        Case "{DOWN}"
            $iPitch -= 1
            _BASS_ChannelSetAttribute($hTempo, $BASS_ATTRIB_TEMPO_PITCH, $iPitch)
        Case "{LEFT}"
            $iTempo -= 1
            _BASS_ChannelSetAttribute($hTempo, $BASS_ATTRIB_TEMPO, $iTempo)
        Case "{RIGHT}"
            $iTempo += 1
            _BASS_ChannelSetAttribute($hTempo, $BASS_ATTRIB_TEMPO, $iTempo)
    EndSwitch
EndFunc   ;==>_Pitch

EDIT: If I could find out if there is sound on the audio output (green) of the motherboard it also solves my problem.

Edited by Belini
Link to comment
Share on other sites

  • 5 months later...

hello

can any one help me to recorde from the microphone and output

using the bassMix

i found in the page 13  an rap for bassMix.dll

but i haven't an expereonce about how to do it

can any one show me the way, please.

when i tried to search in the net i found this

https://mathewsachin.github.io/blog/2017/07/28/mixing-audio.html

but i couldn't know the way exactly

please help me.

thx in advanced

Link to comment
Share on other sites

  • 1 month later...

Updated BASS VST UDF

 DLL Version: 2.4.1.0  http://www.un4seen.com/download.php?z/5/bass_vst24

Changes:

_BASS_VST_GetInfo() - Fixed May 03, 2020 (thanks to TheXman for dll structure)
_BASS_VST_GetParamInfo() - Fixed May 03, 2020 (thanks to TheXman for dll structure)
_BASS_VST_ChannelRemoveDSP() - Fixed May 14, 2020 (added channel handle parameter)


Added Functions (May 14, 2020)

_BASS_VST_GetProgram()
_BASS_VST_SetProgram()
_BASS_VST_GetProgramCount()
_BASS_VST_HasEditor()

 

Download:

BASS_VST.au3

 

Edited by ripdad

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

This goes with the above post.

Here's two helper functions for the ones that return structs - and - a friendly error function:

; #FUNCTION# =======================================================================================================
; .......Name.: _VSTGetParamInfo($vstHandle)
; Description.: Helper for _BASS_VST_GetParamInfo()
; ............:
; ....Returns.: Success - Returns an array
; ............: Failure - sets @error
; ............:
; .....Values.: 1. Name         - Time, Gain, RoomType
; ............: 2. Unit         - sec, dB, type
; ............: 3. Display      - the current value in a readable format, examples: 0.5, -3, PLATE
; ............: 4. DefaultValue - the default value - this is the value used by the VST plugin just after creation
;===================================================================================================================
Func _VSTGetParamInfo($vstHandle)
    Local $nCount = _BASS_VST_GetParamCount($vstHandle)
    _GetBassErrorString('_BASS_VST_GetParamCount', @ScriptLineNumber, _BASS_ErrorGetCode())
    If Not $nCount Then Return SetError(-1)
    Local $aArray[$nCount + 1][5] = [[$nCount, 'Name', 'Unit', 'Display', 'DefaultValue']]
    Local $tStruct
    ;
    For $i = 0 To $nCount - 1
        $tStruct = _BASS_VST_GetParamInfo($vstHandle, $i)
        _GetBassErrorString('_BASS_VST_GetParamInfo', @ScriptLineNumber, _BASS_ErrorGetCode())
        If Not IsDllStruct($tStruct) Then Return SetError(-2)
        For $j = 1 To 4
            $aArray[$i + 1][0] = $i + 1
            $aArray[$i + 1][$j] = DllStructGetData($tStruct, $j)
        Next
    Next
    Return $aArray
EndFunc
;
; #FUNCTION# =======================================================================================================
; .......Name.: _VSTGetInfo($vstHandle)
; Description.: Helper for _BASS_VST_GetInfo()
; ............:
; ....Returns.: Success - Returns an array
; ............: Failure - sets @error
; ............:
; .....Values.:  1. channelHandle    - the channelHandle as given to BASS_VST_ChannelSetDSP()
; ............:  2. uniqueID         - a unique ID for the effect (the IDs are registered at Steinberg)
; ............:  3. effectName       - the effect name
; ............:  4. effectVersion    - the effect version
; ............:  5. effectVstVersion - the VST version, the effect was written for
; ............:  6. hostVstVersion   - the VST version supported by BASS_VST, currently 2.4
; ............:  7. productName      - the product name, may be empty
; ............:  8. vendorName       - the vendor name, may be empty
; ............:  9. vendorVersion    - vendor-specific version number
; ............: 10. chansIn          - max. number of possible input channels
; ............: 11. chansOut         - max. number of possible output channels
; ............: 12. initialDelay     - for algorithms which need input in the first place, in milliseconds
; ............: 13. hasEditor        - can the BASS_VST_EmbedEditor() function be called?
; ............: 14. editorWidth      - initial/current width of the editor, also note BASS_VST_EDITOR_RESIZED
; ............: 15. editorHeight     - initial/current height of the editor, also note BASS_VST_EDITOR_RESIZED
; ............: 16. aeffect          - the underlying AEffect object (see the VST SDK)
; ............: 17. isInstrument     - 1 = the VST plugin is an instrument, 0 = the VST plugin is an effect
; ............: 18. dspHandle        - the internal DSP handle
;===================================================================================================================
Func _VSTGetInfo($vstHandle)
    Local $tStruct = _BASS_VST_GetInfo($vstHandle)
    _GetBassErrorString('_BASS_VST_GetInfo', @ScriptLineNumber, _BASS_ErrorGetCode())
    If Not IsDllStruct($tStruct) Then Return SetError(-1)
    Local $aArray[19] = [18]
    ;
    For $i = 1 To $aArray[0]
        $aArray[$i] = DLLStructGetData($tStruct, $i)
    Next
    Return $aArray
EndFunc
;
Func _GetBassErrorString($sBASSFunction, $nScriptLine, $nBASSError)
    ;
    Local $strError = ''
    ;
    Switch $nBASSError
        Case 0
            ; $strError = '0 = BASS_OK';  <-- here as reference -- LEAVE AS IS
        Case 1
            $strError = '1 = BASS_ERROR_MEM'
        Case 2
            $strError = '2 = BASS_ERROR_FILEOPEN'
        Case 3
            $strError = '3 = BASS_ERROR_DRIVER'
        Case 4
            $strError = '4 = BASS_ERROR_BUFLOST'
        Case 5
            $strError = '5 = BASS_ERROR_HANDLE'
        Case 6
            $strError = '6 = BASS_ERROR_FORMAT'
        Case 7
            $strError = '7 = BASS_ERROR_POSITION'
        Case 8
            $strError = '8 = BASS_ERROR_INIT'
        Case 9
            $strError = '9 = BASS_ERROR_START'
        Case 10
            $strError = '10 = BASS_ERROR_SSL'
        Case 14
            $strError = '14 = BASS_ERROR_ALREADY '
        Case 17
            $strError = '17 = BASS_ERROR_NOTAUDIO'
        Case 18
            $strError = '18 = BASS_ERROR_NOCHAN'
        Case 19
            $strError = '19 = BASS_ERROR_ILLTYPE'
        Case 20
            $strError = '20 = BASS_ERROR_ILLPARAM'
        Case 21
            $strError = '21 = BASS_ERROR_NO3D'
        Case 22
            $strError = '22 = BASS_ERROR_NOEAX'
        Case 23
            $strError = '23 = BASS_ERROR_DEVICE'
        Case 24
            $strError = '24 = BASS_ERROR_NOPLAY'
        Case 25
            $strError = '25 = BASS_ERROR_FREQ'
        Case 27
            $strError = '27 = BASS_ERROR_NOTFILE'
        Case 29
            $strError = '29 = BASS_ERROR_NOHW'
        Case 31
            $strError = '31 = BASS_ERROR_EMPTY'
        Case 32
            $strError = '32 = BASS_ERROR_NONET'
        Case 33
            $strError = '33 = BASS_ERROR_CREATE'
        Case 34
            $strError = '34 = BASS_ERROR_NOFX'
        Case 37
            $strError = '37 = BASS_ERROR_NOTAVAIL'
        Case 38
            $strError = '38 = BASS_ERROR_DECODE'
        Case 39
            $strError = '39 = BASS_ERROR_DX'
        Case 40
            $strError = '40 = BASS_ERROR_TIMEOUT'
        Case 41
            $strError = '41 = BASS_ERROR_FILEFORM'
        Case 42
            $strError = '42 = BASS_ERROR_SPEAKER'
        Case 43
            $strError = '43 = BASS_ERROR_VERSION'
        Case 44
            $strError = '44 = BASS_ERROR_CODEC'
        Case 45
            $strError = '45 = BASS_ERROR_ENDED'
        Case 46
            $strError = '46 = BASS_ERROR_BUSY'
        Case 47
            $strError = '47 = BASS_ERROR_UNSTREAMABLE'
        Case 3000
            $strError = '3000 = BASS_VST_ERROR_NOINPUTS'
        Case 3001
            $strError = '3001 = BASS_VST_ERROR_NOOUTPUTS'
        Case 3002
            $strError = '3002 = BASS_VST_ERROR_NOREALTIME'
        Case -1
            $strError = '-1 = BASS_ERROR_UNKNOWN'
        Case Else
    EndSwitch
    ;
    If $strError <> '' Then
        MsgBox(8208, $sBASSFunction & ' Error', '@ScriptLineNumber: ' & $nScriptLine - 1 & @CRLF & @CRLF & $strError & @TAB & @CRLF)
        Exit; <-- exit until error is fixed
    EndIf
    Return SetError($nBASSError, 0, 0)
    ;
EndFunc

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

  • 9 months later...

Hi.

Is there a way to loop a bassmix channel?

I currently have this:

#include "bass.au3"
#include "bassmix.au3"
_bass_startup()
_bass_mix_startup()
 _BASS_Init(0, -1, 44100, 0, "")
_bass_pluginload("bassflac.dll", 0)
$mix=_bass_mixer_streamcreate(44100, 2, $BASS_MIXER_END)
$plade=_bass_streamcreatefile(False, "D:\dropbox\blandede lyde\plade.flac", 0, 0, $bass_stream_decode)

_bass_mixer_streamaddchannel($mix, $plade, 0)
_bass_channelflags($mix, $bass_sample_loop, $bass_sample_loop)
_bass_channelplay($mix, 0)
sleep(10000)
_bass_free()

 

But the channel does not loop, even if I check the get active state it says it is stopped when it is finished playing, so why doesn't it loop?

Is there a way to maybe copy the data to another channel which can then loop?

Regards,

Marc

Edited by MarcroSoft
Link to comment
Share on other sites

  • 11 months later...

Dear advanced developers,
I Am new on Autoit forum. I would like to kindly ask you, if is there any chance to record live INternet radio stream by using Autoit, or if is it impossible? I have found out that Bass library wrapper contain very useful Radio example. It really play live stream. And source file contain The following two lines of code.

 

Global Const $DownloadProc = __BASS_GetProcAddress($hLibBassCB,"DownloadProc@12")
Global Const $StreamProc = __BASS_GetProcAddress($hLibBassCB,"StreamProc@16")
Is it possible to record live stream which is being plaied by using The downloadproc?

Or it would had to be necessary to use some API function to rrecord?

Thank you very much for your answer.

 

Link to comment
Share on other sites

With the function "_BASS_Encode_Start" and "lame.exe" it's possible.

If the radio station is a MP3 stream (the most are that) you can also you use inetget or inetread AutoIt Functions

Edited by nend
Link to comment
Share on other sites

@januszchmiel 

If you are new to Autoit, and don't want to spend a lot of developing efforts, I would rather recommend you to use this semi professional sofware called MIXXX.

This has the recording and live broadcasting function included https://mixxx.org/features/

On top of this it is FREE and compete with any professional audio / djing software on the market.

Extra bonus is that it is available as cross platform ( I run this on a Raspberry PI with very little resources)

If you combine this with this multichannel EQ https://sourceforge.net/projects/pc-equalizer/

You have all the tools a semi Pro can wish for ...

 

Enjoy !

Link to comment
Share on other sites

  • 2 months later...

Hi all,

Is this a something wothwhile looking into to get Music Visualizations running in autoIt ?

The library is written in C++ that is where it stops for me though 😞

 

I downloaded the app from the music store and it is impressive 😊

https://github.com/projectM-visualizer/frontend-uwp

But the there are no option for configuration... 

 

Here are some examples what it can do...

https://store.steampowered.com/app/1358800/projectM_Music_Visualizer/

Here is where it starts...

https://github.com/projectM-visualizer/projectm

Also found this library

https://github.com/projectM-visualizer/frontend-libvisual-plug-in

 

Have fun !

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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