Recent

Author Topic: Cross Platform Audio Recommendation anyone?  (Read 11608 times)

Josh

  • Hero Member
  • *****
  • Posts: 1454
Cross Platform Audio Recommendation anyone?
« on: September 12, 2015, 11:45:51 am »
Hi
I have been looking through some of the Audio Librarues for lazarus, and have limited success.

The Library I had most success with was UOS (Git download sept 10 2015) , but I was getting random crashes with these even when using the examples provided, ie some mp3's would play other not, as well of some just Access Violation Crashes when using the filter example again with certain MP3 files (note all these mnp3 files play in every other audio player). Need to use the LCL version as not using FPGUI

So I am wondering if anyone has experience of other Audio Libraries that are cross-platform (PC and MAC) that have the ability to add filters, dsp effects and above all, easy to use with some nice examples:). Of course if it's something I am doing wrong with UOS I would be pleased to know. (LAZ settings in signature)

Hope someone has some experience and willing to share their thoughts

Thanks Josh
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Zittergie

  • Full Member
  • ***
  • Posts: 114
    • XiX Music Player
Re: Cross Platform Audio Recommendation anyone?
« Reply #1 on: September 12, 2015, 12:51:29 pm »
Hi,

I am using the BASS libraries you can find on http://www.un4seen.com. These are cross-platform and free for non professional use, but closed.
Be the difference that makes a difference

Josh

  • Hero Member
  • *****
  • Posts: 1454
Re: Cross Platform Audio Recommendation anyone?
« Reply #2 on: September 12, 2015, 01:38:07 pm »
Hi
I had a quick look at BASS, but not too sure of the licensing of these and also could not find much if any lazarus examples to evaluate. But the Library does look very interesting and I appreciate your response.
Josh

update I tried converting some of the sample projects in the BASS Library using Lazarus Convert Delphi Project, but so far all the ones I have tried will not compile after the conversion.
« Last Edit: September 12, 2015, 02:43:11 pm by josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Josh

  • Hero Member
  • *****
  • Posts: 1454
Re: Cross Platform Audio Recommendation anyone?
« Reply #3 on: September 12, 2015, 09:49:00 pm »
Hi
I have download BASS library and have tried to convert the delphi sample projects but I cannot get any to work, some I have to add in windows unit and these still give further errors.
Are there any complete examples of using the BASS libraries with lazarus, or maybe can someone point me in the direction to get some working code, as reading through the documentation this library should be ideal for my project.

Josh
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

derek.john.evans

  • Guest
Re: Cross Platform Audio Recommendation anyone?
« Reply #4 on: September 12, 2015, 10:20:10 pm »
You are better off only using those demos as reference. I never had a problem just adding the unit Bass and reading the API manual.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1290
Re: Cross Platform Audio Recommendation anyone?
« Reply #5 on: September 13, 2015, 12:43:46 am »
hello josh,
Quote
The Library I had most success with was UOS (Git download sept 10 2015) , but I was getting random crashes with these even when using the examples provided, ie some mp3's would play other not, as well of some just Access Violation Crashes when using the filter example again with certain MP3 files

With what kind of mp3 have you crashes ? have you crashes with "clean" mp3 (ie : from legal music download center) ?

If your crashes are occured by bad mp3, you can try to fix bad mp3 with a mp3 utility, for example mp3_validator
« Last Edit: September 13, 2015, 12:56:47 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Josh

  • Hero Member
  • *****
  • Posts: 1454
Re: Cross Platform Audio Recommendation anyone?
« Reply #6 on: September 13, 2015, 11:17:03 am »
Hi
Yes all legal mp3's. The odd behavior was you could play the same file 2 or 3 times with out problem, but then play another file, then go back and load the file that was playing alright previously now would not work, or in some situations would only part play.
Again it maybe something in my laz version etc, I was just using the filter sample as is, unaltered from the UOS library.
Josh
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Cross Platform Audio Recommendation anyone?
« Reply #7 on: September 13, 2015, 04:57:22 pm »
I am mainly using BASS with nxPascal. I wrote a class wrapper to it some year back, so you don't need to deal with direct dll function calls:
https://github.com/Zaflis/nxpascal/blob/master/src/nxBass.pas

I was testing the doppler effect of 3D sounds with this demo (and with some mousepicking on free polygon models ;) ):
https://www.youtube.com/watch?v=IKoE-JL7OXg&index=8&list=PLraemX84dJwUgp9IcXUS0U4lvdwLFumA7
« Last Edit: September 13, 2015, 05:01:15 pm by User137 »

Josh

  • Hero Member
  • *****
  • Posts: 1454
Re: Cross Platform Audio Recommendation anyone?
« Reply #8 on: September 14, 2015, 07:14:04 pm »
Hi
So far I am getting along with the BASS library, a bit slow I must admit due to trying to find workable sample code.
So far I can load and mp3 file, play it. I have managed to get the left and right output levels displaying as led indicators.
My next task is to create a 30 parametric graphic equalizer, if anyone has some sample of how to implement such an EQ would be really cool.
then the next task would be an Audio graph of the whole audio wave in stereo, I have lots of ideas of hings to add which apparently the BASS engine does support.
It's a big learning curve for a beginner to audio, so any nice snippets would be very handy.
Thanks for all the replies so far.
Josh
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

derek.john.evans

  • Guest
Re: Cross Platform Audio Recommendation anyone?
« Reply #9 on: September 14, 2015, 08:21:04 pm »
I grab all my DSP stuff from Jesusonic effects (Included with REAPER). IMO, jsfx's are a goldmine of really cool algorithms. Most of the eq's Ive seen refer to RBJ's cookbook which is here:

http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

Ive attached a 12 band eq (written in Jesusonic) which was extended from a 7 band eq. It shouldn't be too hard to convert to Pascal. Ive also attached my implementation of RBJ's stuff, (again in JS), which should be easy to convert to Pascal.

There are various implementations of RBJ's Cookbook in Pascal and C++. Here is one:
https://github.com/TaylorHanayik/StimSync/blob/master/osciLaz/source/filter_rbj.pas

Once you have a working RBJ library. Its easy to apply peak EQ's for each frequency band.

Another idea is to support VST effects, which can be done via the ASIOVST library. Problem is, the only FreePascal version Ive found is in the CodeTyphon libraries. So you need the typhon src (which contains more that you need)

http://www.pilotlogic.com/codetyphon/current/src/typhon_src.7z
http://www.pilotlogic.com/sitejoom/index.php/forums/installation-setup/2963-sourcefilemanager-pas

ASIOVST has a _lot_ of filters.

** EDIT **

Just a quick implementation guide. I recently finished a guitar distortion effect, which included a 5 band EQ. With a RBJ library, the code came down to:

Initilization. For each band, I have the frequency, gain and bandwidth. (For a graphical EQ, frequency & bandwidth would be constant)
Code: [Select]
p0.RBJ.SetFG2BW1(slider20, slider10, slider30); p0.RBJ.PeakEq();
p1.RBJ.SetFG2BW1(slider21, slider11, slider31); p1.RBJ.PeakEq();
p2.RBJ.SetFG2BW1(slider22, slider12, slider32); p2.RBJ.PeakEq();
p3.RBJ.SetFG2BW1(slider23, slider13, slider33); p3.RBJ.PeakEq();
p4.RBJ.SetFG2BW1(slider24, slider14, slider34); p4.RBJ.PeakEq();   

And, then for each sample (spl0), I have this.
Code: [Select]
slider10 ? spl0 = p0.RBJ.Sample(spl0);
slider11 ? spl0 = p1.RBJ.Sample(spl0);
slider12 ? spl0 = p2.RBJ.Sample(spl0);
slider13 ? spl0 = p3.RBJ.Sample(spl0);
slider14 ? spl0 = p4.RBJ.Sample(spl0); 

The (slider1x ?) code is just to check for zero gain bands, so it skips code that doesn't need to be called.

So, in Pascal, you would have an array of 50 x 2 filters. (ie 100 filters), which are initialized to frequencies/bandwidth and gain. Then a for/loop to apply each filter to the 2 channels. You need separate filters for left and right because filters store history data.

Actually, on second thought. I think you need to update the 12 band eq. I dont think 50 peak eq's is what you are after.

« Last Edit: September 14, 2015, 08:41:58 pm by Geepster »

derek.john.evans

  • Guest
Re: Cross Platform Audio Recommendation anyone?
« Reply #10 on: September 14, 2015, 08:58:04 pm »
Sorry, double post. I forgot about this one. LADSPA is a simple interface to DSP effects. A quick google brought up this:

http://forum.lazarus.freepascal.org/index.php?topic=19749.0

I haven't tried the code, but if it works, it would give you a lot of options. My project "Geep Jeez", converts JS effects to VST or LADSPA. Which basically would give you hundreds of effects. Delays, compressors, chorus, reverbs, eq's, etc. Trust me, there are bucket loads out there.

There are a bunch of effects here for LADSPA:
http://quitte.de/dsp/caps.html

It might be complete overkill, but its food for thought.

Josh

  • Hero Member
  • *****
  • Posts: 1454
Re: Cross Platform Audio Recommendation anyone?
« Reply #11 on: September 14, 2015, 09:11:40 pm »
Hi Geepster,

Thank you for all that information, I think I will have a lot of reading to do  :) I am sure I will grasp some ideas and how to get what I need from the above code snippets and links. I will probably have to re-read a few times for it to sink in as it is all new to me.

I thank you for taking the time and effort to help me in this 'new' area to me, I suspect progress may be slow to start with, but  perseverance will prevail.

Josh

The best way to get accurate information on the forum is to post something wrong and wait for corrections.

derek.john.evans

  • Guest
Re: Cross Platform Audio Recommendation anyone?
« Reply #12 on: September 14, 2015, 09:34:37 pm »
Thank you for all that information, I think I will have a lot of reading to do  :)

That's cool. I'm not a DSP expert. But, I understand the concept of passing samples to a function and getting something back. Thats about it  :-[

RBJ works if you don't try to change it. I don't understand it, but its clear enough to implement.

I just downloaded LMMS, which was referred to by the LADSPA for FreePascal author. Yep, it has 117 LADSPA plugins.
https://lmms.io/

Coooool stuff. Windows, Linux and Mac. Avaliable from FreePascal, ummmm,

I like it, I like it a lot.
« Last Edit: September 14, 2015, 09:36:53 pm by Geepster »

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1290
Re: Cross Platform Audio Recommendation anyone?
« Reply #13 on: September 14, 2015, 11:48:37 pm »
hello,
josh, regarding your uos crashes :  Do they  take place In all O.S ?
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Josh

  • Hero Member
  • *****
  • Posts: 1454
Re: Cross Platform Audio Recommendation anyone?
« Reply #14 on: September 15, 2015, 11:58:46 am »
Hi
I have only tested with main machine win 7-64 using laz 32 bit. It was odd as I managed to get on very quickly understanding the implementation and use of the UOS library
So far I have not had similar result with BASS library.

From what I have learned  from reading most of the information provided by all esp Geepster; some of the libraries seem incredibly powerful and have all kinds of differing advantages over other, implementation and sample code seems to be a major hurdle.

To be honest BASS offers some feature that I would like to use, like midi in/out and has additional things to use later on..

I still am open to suggestions, I have played with BASS for a few days and like it, as this is a project in early stages this can be changed, obviously once a decision is made then which ever library is used will most likely be stuck with.

I have tried to find samples of using LADSPA in Lazarus; but I cannot find any, probably me just googling for the wrong keywords.

Josh
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

 

TinyPortal © 2005-2018