Recent

Author Topic: United OpenLib of Sound (UOS)  (Read 77800 times)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12110
  • FPC developer.
Re: United OpenLib of Sound (U_OS)
« Reply #30 on: January 07, 2013, 07:26:53 pm »

Code: [Select]
UOSSTREAM[x].Thread.Start;

tthread.start is a method introduced with 2.4.4 or 2.6.0. If you use an outdated version on Windows either upgrade or use thread.resume

 

Fred vS

  • Hero Member
  • *****
  • Posts: 3500
    • StrumPract is the musicians best friend
Re: United OpenLib of Sound (UOS)
« Reply #31 on: January 07, 2013, 07:39:18 pm »
@ Marcov : Many thanks to take care with UOS.

Quote
use thread.resume

At init i use that code but i change it because the compiler was complaining with thread.resume, Obsolete bla... bla...  :-X
But if you think it is better to use thread.resume for down compatibility of course it gonna be changed.



« Last Edit: January 07, 2013, 07:42:04 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

parcel

  • Full Member
  • ***
  • Posts: 143
Re: United OpenLib of Sound (UOS)
« Reply #32 on: January 10, 2013, 10:20:41 am »
I got SIGFPE exception at TUOS_Player.Execute in windows xp 32bit.

temporary set 8087 register to $133f, no error is occured.

Code: [Select]
           for x2 := 0 to  high(StreamIn) do  if (StreamIn[x2].HandleSt <> nil) and (StreamIn[x2].Enabled = True)
          and (pos(StreamOut[x].Name,StreamIn[x2].Output) > 0)   then                 
                              //////// copy buffer-in into buffer-out
          Set8087CW($133f); // temporary setup fpu flag resgister, default = $1332
          for x3 :=  0 to high(StreamIn[x2].InBuffer)  do
                    StreamOut[x].OutBuffer[x3] := StreamOut[x].OutBuffer[x3] + StreamIn[x2].InBuffer[x3]; // got SIGFPE


Setup and restore in 8087 control register at LoadLib/UnloadLib, it works fine  :)
« Last Edit: January 10, 2013, 10:32:23 am by parcel »

Fred vS

  • Hero Member
  • *****
  • Posts: 3500
    • StrumPract is the musicians best friend
Re: United OpenLib of Sound (UOS)
« Reply #33 on: January 10, 2013, 11:18:24 am »
@ parcel :Oooops, many thanks for your solution, i gonna change it in next release  :-[

Quote
Set8087CW($133f); // temporary setup fpu flag resgister, default = $1332

I absolutely did not know about that set, is it valid only for xp 32 ?
What are the sets for other systems ?
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

parcel

  • Full Member
  • ***
  • Posts: 143
Re: United OpenLib of Sound (UOS)
« Reply #34 on: January 10, 2013, 12:28:38 pm »
@ parcel :Oooops, many thanks for your solution, i gonna change it in next release  :-[

Quote
Set8087CW($133f); // temporary setup fpu flag resgister, default = $1332

I absolutely did not know about that set, is it valid only for xp 32 ?
What are the sets for other systems ?

I guess it work on other systems for non-masking exceptions fpu with overflow and underflow  :)


Fred vS

  • Hero Member
  • *****
  • Posts: 3500
    • StrumPract is the musicians best friend
Re: United OpenLib of Sound (UOS)
« Reply #35 on: January 12, 2013, 03:57:33 pm »
Hello everybody.  :D

Im happy to announce the new release of UOS.
Now, format resolution Int 16, Int 32 and Float 32 for each library. (float 32 bit resolution also for MP3 files).
Auto-conversion of format.
New design of DSP procedure.
And much more...  8-)

Download the new release here :
http://fredvs.github.io/uos/
@ marcov and parcel : your "patch" are added, many thanks.

PS: Everybody is welcome to give his own new DSP procedure...
(for example, filters to change bass-medium and treble, equalizer, flanger, etc, are welcome  :-[)
« Last Edit: May 16, 2013, 03:25:18 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3500
    • StrumPract is the musicians best friend
Re: United OpenLib of Sound (UOS)
« Reply #36 on: January 21, 2013, 01:33:38 pm »
Hello Lazarus fans  :)
Im very happy to announce the new release of UOS.
You can record, direct wire and much more now.
Download the new release here :
http://fredvs.github.io/uos/
Here some examples how to use UOS :

First : add uos.pas in your use section and load libraries :
Code: [Select]
   LoadLib;           
   InitLib;
           
Let's play a sound file...

Create the player :
Code: [Select]
Player1 := TUOS_Player.Create(True);     
    Player1.AddIntoDevOut ;               //// Output into OUT Device
    Player1.AddFromFile('MySong.mp3');    //// Input from audio file
And lets play it...
Code: [Select]
Player1.Play;                         //// Play the song...
Let's play a sound file with some dsp effect:

First create the player :
Code: [Select]
  Player1 := TUOS_Player.Create(True);     
    Player1.AddIntoDevOut ;               //// Output into OUT Device
    Player1.AddFromFile('MySong.ogg');    //// Input from audio file
    Player1.AddDSPIn(1);                  //// Add how many dsp you want
    Player1.AddDSPIn(2);
And lets play it...
Code: [Select]
Player1.Play;                         //// Play the song with DSP effect...
Listen to your mic into your loudspeakers :

Create the player:
Code: [Select]
   Player1 := TUOS_Player.Create(True);     
    Player1.AddIntoDevOut ;               //// Output into OUT Device
    Player1.AddFromDevIn ;               //// Input from IN Device
And lets play it...
Code: [Select]
    Player1.Play;                         //// Listen to your mic in your loudspeakers...
Now, ear your mic, listen to a mp3, apply some effects and record the mic into wav file at same time:

Create the player :
Code: [Select]
Player1 := TUOS_Player.Create(True); 
     Player1.AddIntoDevOut ;               //// Output into OUT Device
    Player1.AddIntoFile('Myrecord.wav') ;               //// Output into OUT Device
    Player1.AddFromDevIn ; ;             //// Input from IN Device
    Player1.AddDSPIn(1);                 //// Add how many dsp you want
    Player1.AddDSPIn(2)
    Player2 := TUOS_Player.Create(True);
    Player2.AddFromFile('MySong.mp3')    //// the background audio file
    Player2.AddIntoDevOut ;               //// Output into OUT Device;
And lets play it...
Code: [Select]
    Player1.Play;                         //// Listen your mic with DSP effects and record it ...
Player2.Play;        //// Listen to mp3 together with recording

Here are  the basic UOS procedure :
Each procedure has his equivalent with argument for custom parameters...

Quote
Init Procedures :
LoadLib;                 //// Load dynamic libraries
InitLib();               //// Init those libraries

Output Procedures:
AddIntoDevOut();         //// Output into OUT Device
AddIntoFile();           //// Output into Wav File

Input Procedures:
AddFromDevIn();          //// Input from IN device
AddFromFile();           //// Input from Audio File
InputLength();           //// Lenght of Input in samples
InputPosition();         //// Get position
Seek();                  //// Change position

Player Procedures:   
Play;                    //// Start playing
RePlay;                  //// Resume playing after pause
Stop;                    //// Stop playing and free thread
Pause;                   //// Pause playing

DSP Procedures :                 
AddDSPIn()               //// DSP procedure for input
AddDSPOut()              //// DSP procedure for output
SetDSPin()               //// Set DSP In
SetDSPout()              //// Set DSP out

Have fun  ;)

PS: Your remarks are very welcome...
PS2 : The code of UOS.pas is in attachment (and in package of course).
« Last Edit: May 16, 2013, 03:25:40 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Leledumbo

  • Hero Member
  • *****
  • Posts: 8790
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: United OpenLib of Sound (UOS)
« Reply #37 on: January 21, 2013, 02:55:01 pm »
I think you should create a wiki article for your library...
Anyway, any reason for the separation of LoadLib and InitLib and why the programmer must call them manually instead of the unit initializes itself?

Fred vS

  • Hero Member
  • *****
  • Posts: 3500
    • StrumPract is the musicians best friend
Re: United OpenLib of Sound (UOS)
« Reply #38 on: January 21, 2013, 07:55:02 pm »
@ Leledumbo : many thanks to take care about UOS.  ;)

Quote
Anyway, any reason for the separation of LoadLib and InitLib and why the programmer must call them manually instead of the unit initializes itself?

Not really  :-[ , but with those procedures you can load dynamically the lib at run time and only if you need it...

Quote
I think you should create a wiki article for your library...

Yep, with pleasure  ;)


I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12110
  • FPC developer.
Re: United OpenLib of Sound (UOS)
« Reply #39 on: January 21, 2013, 08:51:54 pm »
@ Marcov : Many thanks to take care with UOS.

Quote
use thread.resume

At init i use that code but i change it because the compiler was complaining with thread.resume, Obsolete bla... bla...  :-X

Which is correct.

Quote
But if you think it is better to use thread.resume for down compatibility of course it gonna be changed.

Only if you must support pre 2.6.0 versions for some crazy reason. The correct solution however is to throw those version into your nearest dumpster and just use .start  >:D

Fred vS

  • Hero Member
  • *****
  • Posts: 3500
    • StrumPract is the musicians best friend
Re: United OpenLib of Sound (UOS)
« Reply #40 on: January 28, 2013, 12:56:05 pm »
Hello everybody  :)
Here is the new release of UOS. Now FFT is implemented and you can apply filters and create equalizer (and spectrum). Added example how to do it (Filters BandSelect, BandPass, HighPass, LowPass, etc...).

Download the new release here :
http://fredvs.github.io/uos/

In attachment, code of UOS.pas.

I think that UOS can do now all what needed for Audio ( and all of that for free and open-source  :-X ).

Comments are welcome.  :)

« Last Edit: May 16, 2013, 03:26:21 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: United OpenLib of Sound (UOS)
« Reply #41 on: January 28, 2013, 01:42:24 pm »
Thanks for your work!

Unfortunately still no mention of UOS on
http://wiki.lazarus.freepascal.org/Multimedia_Programming
or
http://wiki.lazarus.freepascal.org/Audio_libraries

Might be nice from a PR perspective ;)

Regards,
BigChimp
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Fred vS

  • Hero Member
  • *****
  • Posts: 3500
    • StrumPract is the musicians best friend
Re: United OpenLib of Sound (UOS)
« Reply #42 on: January 28, 2013, 01:59:36 pm »
Quote
Unfortunately still no mention of UOS on
http://wiki.lazarus.freepascal.org/Multimedia_Programming
or
http://wiki.lazarus.freepascal.org/Audio_libraries

I know and gonna do it (the implementation of FFT was a nightmare. Not because of Monsieur Fourier and his revolutionary invention but because of... tuning that function with sound. I have to test it with headphones and listening more than thousand times at horrible sounds before to finally find the right formula and... it breaks my head. Im happy to have finished that section and gonna rest a few now. And i promise, gonna write a nice wiki after that...

And i apologize for some of my aggressive last topics, but working on (not perfect) audio makes you crazy.  :-[
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: United OpenLib of Sound (UOS)
« Reply #43 on: January 28, 2013, 02:09:20 pm »
Heh - I can visualize you now. Yes, give your ears and mind a good rest and thanks for the work!
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Dibo

  • Hero Member
  • *****
  • Posts: 1055
Re: United OpenLib of Sound (UOS)
« Reply #44 on: January 28, 2013, 04:15:48 pm »
I have basic question about UOS: Why it is using mpg123, portaudio and sndfile? I mean, each of this package is separated audio library for playing mp3 / ogg, so why UOS is using all libs instead of e.g portaudio only?

 

TinyPortal © 2005-2018