Difference between revisions of "uos"

From Lazarus wiki
Jump to navigationJump to search
Line 43: Line 43:
 
Then load libraries with:
 
Then load libraries with:
  
  LoadLib;          
+
uos_LoadLib(PortAudioFileName, SndFileFileName, Mpg123FileName, SoundTouchFileName);
 +
       
 
                
 
                
 
-Let's play a sound file...
 
-Let's play a sound file...
Line 49: Line 50:
 
Create the player :
 
Create the player :
  
  Player1 := TUOS_Player.Create(True,self);     
+
    uos_CreatePlayer(0); /// you may create how many players you want, from 0 to ...
  Player1.AddIntoDevOut ;               //// Output into OUT Device
+
     uos_AddIntoDevOut(0);   //// Add Output with default parameters   
  Player1.AddFromFile('MySong.mp3');    //// Input from audio file  
+
    uos_AddFromFile(0,'MySong.mp3');    //// Input from audio file  
  
 
And lets play it...
 
And lets play it...
  
   Player1.Play;                        //// Play the song...
+
   uos_Play(0);                        //// Play the song...
  
 
-Let's play a sound file with some dsp effect:
 
-Let's play a sound file with some dsp effect:
Line 61: Line 62:
 
First create the player :
 
First create the player :
  
  Player1 := TUOS_Player.Create(True,self);    
+
  uos_CreatePlayer(0); /// you may create how many players you want, from 0 to ...
  Player1.AddIntoDevOut ;               //// Output into OUT Device
+
  uos_AddIntoDevOut(0);   //// Add Output with default parameters   
  Player1.AddFromFile('MySong.ogg');    //// Input from audio file  
+
  uos_AddFromFile(0,'MySong.mp3');    //// Input from audio file  
  Player1.AddDSPIn(1);                  //// Add how many dsp you want
+
  uos_AddDSPIn(0,1);                  //// Add how many dsp you want
  Player1.AddDSPIn(2);
+
  uos_AddDSPIn(0,2);
  
 
And lets play it...
 
And lets play it...
  
  Player1.Play;                         //// Play the song with DSP effect...
+
    uos_Play(0);     //// Play the song with DSP effect...
  
  
Line 76: Line 77:
 
Create the player:
 
Create the player:
  
  Player1 := TUOS_Player.Create(True,self);     
+
    uos_CreatePlayer(0); /// you may create how many players you want, from 0 to ...
  Player1.AddIntoDevOut ;               //// Output into OUT Device
+
     uos_AddIntoDevOut(0);   //// Add Output with default parameters   
  Player1.AddFromDevIn ;              //// Input from IN Device
+
    uos_AddFromDevIn(0) ;              //// Input from IN Device
  
 
And lets play it...
 
And lets play it...
  
  Player1.Play;                         //// Listen to your mic in your loudspeakers...
+
    uos_Play(0);             //// Listen to your mic in your loudspeakers...
  
  
Line 89: Line 90:
 
Create the player :
 
Create the player :
  
   Player1 := TUOS_Player.Create(True);
+
   uos_CreatePlayer(0); /// you may create how many players you want, from 0 to ...
   Player1.AddIntoDevOut ;              //// Output into OUT Device
+
   uos_AddIntoDevOut(0) ;              //// Output into OUT Device
   Player1.AddIntoFile('Myrecord.wav') ;              //// Output into OUT Device
+
   uos_AddIntoFile(0,'Myrecord.wav') ;              //// Output into OUT Device
   Player1.AddFromDevIn ; ;            //// Input from IN Device
+
   uos_AddFromDevIn(0) ; ;            //// Input from IN Device
   Player1.AddDSPIn(1);                //// Add how many dsp you want
+
   uos_AddDSPIn(0,1);                //// Add how many dsp you want
   Player1.AddDSPIn(2)
+
   uos_AddDSPIn(0,2)
   Player2 := TUOS_Player.Create(True);
+
   uos_CreatePlayer(1);
   Player2.AddFromFile('MySong.mp3')    //// the background audio file
+
   uos_AddFromFile(1,'MySong.mp3')    //// the background audio file
   Player2.AddIntoDevOut ;              //// Output into OUT Device;
+
   uos_AddIntoDevOut(1) ;              //// Output into OUT Device;
  
 
And lets play it...
 
And lets play it...
  
   Player1.Play;                        //// Listen your mic with DSP effects and record it ...
+
   uos_Play(0);                        //// Listen your mic with DSP effects and record it ...
   Player2.Play;        //// Listen to mp3 together with recording
+
   uos_Play(1);        //// Listen to mp3 together with recording
  
  

Revision as of 17:00, 25 February 2014

UOS (United OpenLib of Sound).


uoslogo.png

UOS unifies the best open-source audio libraries.



With UOS you can:

. Listen to mp3, ogg, wav, flac,... audio files.

. With 16, 32 or float 32 bit resolution.

. Record all types of input into file.

. Add DSP effects and filters, however many you want and record it.

. Listen to multiple inputs and outputs.




UOS uses the PortAudio, SndFile and Mpg123 audio libraries.

Included in the package: Examples and binary libraries for Linux 32/64, Windows 32/64, Mac OSX 32.

http://fredvs.github.io/uos/

http://github.com/fredvs/uos/




Here some examples how to use UOS :

First : add uos.pas in your uses section.

Then load libraries with:

uos_LoadLib(PortAudioFileName, SndFileFileName, Mpg123FileName, SoundTouchFileName);


-Let's play a sound file...

Create the player :

   uos_CreatePlayer(0); /// you may create how many players you want, from 0 to ...
   uos_AddIntoDevOut(0);   //// Add Output with default parameters     
   uos_AddFromFile(0,'MySong.mp3');    //// Input from audio file 

And lets play it...

  uos_Play(0);                         //// Play the song...

-Let's play a sound file with some dsp effect:

First create the player :

 uos_CreatePlayer(0); /// you may create how many players you want, from 0 to ...
 uos_AddIntoDevOut(0);   //// Add Output with default parameters     
 uos_AddFromFile(0,'MySong.mp3');    //// Input from audio file 
 uos_AddDSPIn(0,1);                  //// Add how many dsp you want
 uos_AddDSPIn(0,2);

And lets play it...

   uos_Play(0);      //// Play the song with DSP effect...


-Listen to your mic into your loudspeakers :

Create the player:

   uos_CreatePlayer(0); /// you may create how many players you want, from 0 to ...
   uos_AddIntoDevOut(0);   //// Add Output with default parameters     
   uos_AddFromDevIn(0) ;               //// Input from IN Device

And lets play it...

   uos_Play(0);              //// 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 :

  uos_CreatePlayer(0); /// you may create how many players you want, from 0 to ...
  uos_AddIntoDevOut(0) ;               //// Output into OUT Device
  uos_AddIntoFile(0,'Myrecord.wav') ;               //// Output into OUT Device
  uos_AddFromDevIn(0) ; ;             //// Input from IN Device
  uos_AddDSPIn(0,1);                 //// Add how many dsp you want
  uos_AddDSPIn(0,2)
  uos_CreatePlayer(1);
  uos_AddFromFile(1,'MySong.mp3')    //// the background audio file
  uos_AddIntoDevOut(1) ;               //// Output into OUT Device;

And lets play it...

  uos_Play(0);                         //// Listen your mic with DSP effects and record it ...
  uos_Play(1);        //// Listen to mp3 together with recording


Here are the basic UOS procedures : 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