MixPerfect

Developed or developing a new product in PureBasic? Tell the world about it.
Martin Verlaan
Enthusiast
Enthusiast
Posts: 134
Joined: Sun Apr 01, 2018 11:26 am
Location: Netherlands
Contact:

Re: MixPerfect

Post by Martin Verlaan »

AZJIO wrote: Wed Mar 27, 2024 6:45 pm I tried it in Arch, it doesn't start for me. The "Htop" program does not show the process.
Thanks for letting me know. Perhaps in ARCH the bass-folder should be in the /usr/lib/ directory. If you want here's a version to test this. Copy the bass folder to /usr/lib/ and hopefully it works.

EDIT: posted wrong link, here is the correct one: https://drive.google.com/file/d/1gRew52 ... sp=sharing
AZJIO
Addict
Addict
Posts: 2183
Joined: Sun May 14, 2017 1:48 am

Re: MixPerfect

Post by AZJIO »

Martin Verlaan wrote: Wed Mar 27, 2024 8:23 pm /usr/lib/
I needed to upgrade other Linux and I tried on Fedora and Mint. Both failed to run, including copying files to the lib folder (on Fedora it was lib64). Absolutely nothing was happening.

Make an error output if the library is not loading

Code: Select all

If Not OpenLibrary(#L1, "libbass.so")
	MessageRequester("", "Couldn't open libbass.so")
EndIf
or

Code: Select all

CurPath$ = GetPathPart(ProgramFilename())
If FileSize(CurPath$ + "bass/linux/libbass.so")
	If Not OpenLibrary(#L1, CurPath$ + "bass/linux/libbass.so")
		MessageRequester("", "Couldn't open " + CurPath$ + "bass/linux/libbass.so")
	EndIf
Else
	If Not OpenLibrary(#L1, "libbass.so")
		MessageRequester("", "Couldn't open libbass.so")
	EndIf
EndIf
Martin Verlaan wrote: Wed Mar 27, 2024 9:23 am A big thanks to forum member Wilbert, who provided the code for drawing a waveform
Is there a link to this code?
Martin Verlaan
Enthusiast
Enthusiast
Posts: 134
Joined: Sun Apr 01, 2018 11:26 am
Location: Netherlands
Contact:

Re: MixPerfect

Post by Martin Verlaan »

Thank you, I will add that code. I use PopOS and assumed it should work at least in all Ubuntu based distro's. I'm going to test the program in some other distro's this weekend.

The waveform code can be found in this topic: https://www.purebasic.fr/english/viewto ... 3&start=15
Martin Verlaan
Enthusiast
Enthusiast
Posts: 134
Joined: Sun Apr 01, 2018 11:26 am
Location: Netherlands
Contact:

Re: MixPerfect

Post by Martin Verlaan »

The problem is that I used Import to load the BASS library in Linux. I just tried OpenLibrary() but I have no idea how to import all BASS-functions with that command. Any suggestions?
AZJIO
Addict
Addict
Posts: 2183
Joined: Sun May 14, 2017 1:48 am

Re: MixPerfect

Post by AZJIO »

I just found a few references to OpenLibrary(). I think it's better for you to do a search on your own to find a suitable way.
https://www.purebasic.fr/english/viewtopic.php?t=61956
https://www.purebasic.fr/english/viewtopic.php?t=31784
Martin Verlaan
Enthusiast
Enthusiast
Posts: 134
Joined: Sun Apr 01, 2018 11:26 am
Location: Netherlands
Contact:

Re: MixPerfect

Post by Martin Verlaan »

That's all code for windows DLL. I assume OpenLibrary() is for Windows only, and Import for Linux. The problem with import is that the compiler remembers the import-location of the machine where it's compiled on. So I think I need to instruct the users to copy the bass folder to /usr/lib/ and also I need to change the import folder to /usr/lib/bass in my program. I guess this is the best solution.
AZJIO
Addict
Addict
Posts: 2183
Joined: Sun May 14, 2017 1:48 am

Re: MixPerfect

Post by AZJIO »

OpenLibrary
Supported OS

All
Martin Verlaan
Enthusiast
Enthusiast
Posts: 134
Joined: Sun Apr 01, 2018 11:26 am
Location: Netherlands
Contact:

Re: MixPerfect

Post by Martin Verlaan »

Ah, that's clear! I need to study it more, and in the meantime I keep my suggested solution in mind.
Martin Verlaan
Enthusiast
Enthusiast
Posts: 134
Joined: Sun Apr 01, 2018 11:26 am
Location: Netherlands
Contact:

Re: MixPerfect

Post by Martin Verlaan »

Made some changes and successfully tested it in Fedora, Ubuntu, Mint, Arch, PopOS, Windows 7, 10, 11. You can find the newest zip-files on mixperfect.nl
infratec
Always Here
Always Here
Posts: 7613
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: MixPerfect

Post by infratec »

Have you tried something like:

Code: Select all

ImportC "-lbass"
...
EndImport
:?:

This should also work in macOS
Fred
Administrator
Administrator
Posts: 18199
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: MixPerfect

Post by Fred »

Martin Verlaan wrote: Sat Mar 30, 2024 7:12 pm Made some changes and successfully tested it in Fedora, Ubuntu, Mint, Arch, PopOS, Windows 7, 10, 11. You can find the newest zip-files on mixperfect.nl
When you find a solution, you should share it that's the whole point of this forums so if someone else have the same kind of issue it can solve it.
Martin Verlaan
Enthusiast
Enthusiast
Posts: 134
Joined: Sun Apr 01, 2018 11:26 am
Location: Netherlands
Contact:

Re: MixPerfect

Post by Martin Verlaan »

No problem. I solved it by using OpenLibrary() instead of Import. This way the BASS library can be loaded from a subfolder.
Example:

Code: Select all


PrototypeC BASS_SetConfig (option.l,value.l)
PrototypeC BASS_GetVersion()
PrototypeC BASS_ErrorGetCode()
PrototypeC BASS_Init(device.l,freq.l,flags.l,*win,*dsguid)
PrototypeC BASS_Free()
PrototypeC.f BASS_SetVolume(volume.f)
PrototypeC BASS_StreamCreateFile(mem.l,*file,offset.q,length.q,flags.l)
PrototypeC BASS_StreamFree(Handle.l)
PrototypeC.d BASS_ChannelBytes2Seconds(Handle.l,pos.q)
PrototypeC.q BASS_ChannelSeconds2Bytes(Handle.l,pos.d)
PrototypeC BASS_ChannelIsActive(Handle.l)
PrototypeC BASS_ChannelGetInfo(Handle.l,*info.BASS_CHANNELINFO)
PrototypeC BASS_ChannelGetTags(Handle.l,tags.l)
PrototypeC BASS_ChannelPlay(Handle.l,restart.l)
PrototypeC BASS_ChannelStop(Handle.l)
PrototypeC BASS_ChannelPause(Handle.l)
PrototypeC BASS_ChannelSetAttribute(Handle.l,attrib.l,value.f)
PrototypeC BASS_ChannelGetAttribute(Handle.l,attrib.l,*value)
PrototypeC.q BASS_ChannelGetLength(Handle.l,mode.l)
PrototypeC BASS_ChannelSetPosition(Handle.l,pos.q,mode.l)
PrototypeC.q BASS_ChannelGetPosition(Handle.l,mode.l)
PrototypeC BASS_ChannelGetData(Handle.l,*buffer,length.l)
PrototypeC BASS_ChannelSetSync(Handle.l,Type.l,param.q,*proc,*user)
PrototypeC BASS_ChannelRemoveSync(Handle.l,sync.l)
PrototypeC BASS_ChannelSetFX(Handle.l,type.l,priority.l)
PrototypeC BASS_ChannelRemoveFX(Handle.l,fx.l)
PrototypeC BASS_FXSetParameters(Handle.l,*params)
PrototypeC BASS_FXGetParameters(Handle.l,*params)
 
Global libBASS = OpenLibrary(#PB_Any, GetPathPart(ProgramFilename()) + "assets/bass/linux/libbass.so")

If Not libBASS 
  libBASS = OpenLibrary(#PB_Any, "/usr/lib/bass/linux/libbass.so")
  If Not libBASS
    MessageRequester("Library loading error", "Failed to load libbass.so" + Chr(13) + Chr(13) + 
                                            "To solve the problem, open the subfolder 'assets' in your terminal and enter this command:" + Chr(13)+ Chr(13) + 
                                            "sudo cp -avr bass /usr/lib/", #PB_MessageRequester_Error)
    End
  EndIf
EndIf  

Global BASS_SetConfig.BASS_SetConfig = GetFunction(libBASS, "BASS_SetConfig")
Global BASS_GetVersion.BASS_GetVersion = GetFunction(libBASS, "BASS_GetVersion")
Global BASS_ErrorGetCode.BASS_ErrorGetCode = GetFunction(libBASS, "BASS_ErrorGetCode")
Global BASS_Init.BASS_Init = GetFunction(libBASS, "BASS_Init")
Global BASS_Free.BASS_Free = GetFunction(libBASS, "BASS_Free")
Global BASS_SetVolume.BASS_SetVolume = GetFunction(libBASS, "BASS_SetVolume")
Global BASS_StreamCreateFile.BASS_StreamCreateFile = GetFunction(libBASS, "BASS_StreamCreateFile")
Global BASS_StreamFree.BASS_StreamFree = GetFunction(libBASS, "BASS_StreamFree") 
Global BASS_ChannelBytes2Seconds.BASS_ChannelBytes2Seconds = GetFunction(libBASS, "BASS_ChannelBytes2Seconds")
Global BASS_ChannelSeconds2Bytes.BASS_ChannelSeconds2Bytes = GetFunction(libBASS, "BASS_ChannelSeconds2Bytes")
Global BASS_ChannelIsActive.BASS_ChannelIsActive = GetFunction(libBASS, "BASS_ChannelIsActive")
Global BASS_ChannelGetInfo.BASS_ChannelGetInfo = GetFunction(libBASS, "BASS_ChannelGetInfo")
Global BASS_ChannelGetTags.BASS_ChannelGetTags = GetFunction(libBASS, "BASS_ChannelGetTags")
Global BASS_ChannelPlay.BASS_ChannelPlay = GetFunction(libBASS, "BASS_ChannelPlay")
Global BASS_ChannelStop.BASS_ChannelStop = GetFunction(libBASS, "BASS_ChannelStop")
Global BASS_ChannelPause.BASS_ChannelPause = GetFunction(libBASS, "BASS_ChannelPause")
Global BASS_ChannelSetAttribute.BASS_ChannelSetAttribute = GetFunction(libBASS, "BASS_ChannelSetAttribute")
Global BASS_ChannelGetAttribute.BASS_ChannelGetAttribute = GetFunction(libBASS, "BASS_ChannelGetAttribute")
Global BASS_ChannelGetLength.BASS_ChannelGetLength = GetFunction(libBASS, "BASS_ChannelGetLength")
Global BASS_ChannelSetPosition.BASS_ChannelSetPosition = GetFunction(libBASS, "BASS_ChannelSetPosition")
Global BASS_ChannelGetPosition.BASS_ChannelGetPosition = GetFunction(libBASS, "BASS_ChannelGetPosition")
Global BASS_ChannelGetData.BASS_ChannelGetData = GetFunction(libBASS, "BASS_ChannelGetData")
Global BASS_ChannelSetSync.BASS_ChannelSetSync = GetFunction(libBASS, "BASS_ChannelSetSync")
Global BASS_ChannelRemoveSync.BASS_ChannelRemoveSync = GetFunction(libBASS, "BASS_ChannelRemoveSync")
Global BASS_ChannelSetFX.BASS_ChannelSetFX = GetFunction(libBASS, "BASS_ChannelSetFX")
Global BASS_ChannelRemoveFX.BASS_ChannelRemoveFX = GetFunction(libBASS, "BASS_ChannelRemoveFX")
Global BASS_FXSetParameters.BASS_FXSetParameters = GetFunction(libBASS, "BASS_FXSetParameters")
Global BASS_FXGetParameters.BASS_FXGetParameters = GetFunction(libBASS, "BASS_FXGetParameters")
I didn't try ImportC "-lbass" yet. If that's a better or cleaner solution, I will use that in a next version. But I understood that BASS then should be already installed, to make it work.

Also, I removed a webgadget for showing documentation, because some Linux distro's (like Arch) does not have libwebkit2gtk installed by default. The "help" does now open directly in the installed browser, using this code:

Code: Select all

 CompilerIf #PB_Compiler_OS = #PB_OS_Linux
    RunProgram("xdg-open", "assets/doc/help.html", "")
 CompilerElse 
    RunProgram("file://" + GetPathPart(ProgramFilename()) + "assets/doc/help.html")
CompilerEndIf
In the above code I used a relative path for linux, the strange thing is that the absolute path didn't work on some distro's, but the relative path worked on all.

B.t.w. my program failed on OpenSuse, some short named library was missing. Can't remember the name, and also couldn't find how to install it.
AZJIO
Addict
Addict
Posts: 2183
Joined: Sun May 14, 2017 1:48 am

Re: MixPerfect

Post by AZJIO »

If I understand correctly, you need to add tracks to the database and fill in the media data. Let’s say I’m not ready to create a database, I don’t want to waste time on it, but I have music in a folder, and I haven’t found a way to listen to it using the program. For most people, it's interesting to simply throw a folder or files into the program window and listen to them.
Martin Verlaan
Enthusiast
Enthusiast
Posts: 134
Joined: Sun Apr 01, 2018 11:26 am
Location: Netherlands
Contact:

Re: MixPerfect

Post by Martin Verlaan »

AZJIO wrote: Mon Apr 01, 2024 5:07 am If I understand correctly, you need to add tracks to the database and fill in the media data. Let’s say I’m not ready to create a database, I don’t want to waste time on it, but I have music in a folder, and I haven’t found a way to listen to it using the program. For most people, it's interesting to simply throw a folder or files into the program window and listen to them.
Thanks for trying and your feedback. I understand your point, but that's why the website say: "Because MixPerfect need some preparation to set the right mix points, the software is not for everybody." If you want just to play songs without mixing (or with mixing but fully automatically), you should look for another player.

B.t.w.: I tried to make it 100% automatic before and worked a year on it, using Spleeter for beat detection. I was so close to find the right mix points automatically using this tool in combination with BASS audio library, but gave up because every song is different and it's impossible to make it work with every song. I'm sure it will be possible soon with AI and machine learning, but until now I never found AI DJ software that does the job right.
AZJIO
Addict
Addict
Posts: 2183
Joined: Sun May 14, 2017 1:48 am

Re: MixPerfect

Post by AZJIO »

Martin Verlaan
Now works, checked on Fedora
Post Reply