Difference between revisions of "uos"

From Lazarus wiki
Jump to navigationJump to search
Line 1: Line 1:
'''uos''' (United OpenLib of Sound).
+
[[File:uoslogo.png|right]]
 +
'''uos''' (United OpenLib of Sound) is a multi-platform package of audio handling routines that unifies the best open-source audio libraries.
  
----
+
== Features ==
[[File:uoslogo.png]]
+
* play .mp3, .ogg, .wav, .flac, .m4a and cdrom audio files.
 +
* 16, 32 or float 32 bit resolution
 +
* record all types of input into file, in 16 or 32 bit resolution, mono or stereo.
 +
* add DSP effects and filters, however many you want and record it.
 +
* play multiple inputs and outputs simultaneously
 +
* internet audio streaming
  
'''uos''' unifies the best open-source audio libraries.
+
Uos can use the [[SoundTouch]], [[PortAudio]], [[SndFile]], [[Mpg123]], [[Faad]] and [[Mp4ff]] audio libraries.  
 
 
----
 
 
 
 
 
With '''uos''' you can:
 
 
 
. Listen to mp3, ogg, wav, flac, m4a or cdrom audio... audio files.
 
 
 
. Deal with 16, 32 or float 32 bit resolution.
 
 
 
. Record all types of input into file, in 16 or 32 bit resolution, mono or stereo.
 
 
 
. Add DSP effects and filters, however many you want and record it.
 
 
 
. Listen to multiple inputs and outputs.
 
 
 
. Do internet audio streaming.
 
 
 
 
 
----
 
 
 
'''uos''' can use the SoundTouch, PortAudio, SndFile, Mpg123, Faad, Mp4ff audio libraries. For Pascal developers.
 
  
 
Included in the package:  Examples and binary libraries for Linux 32/64, Windows 32/64, Mac OSX 32 and FreeBSD 32/64.  
 
Included in the package:  Examples and binary libraries for Linux 32/64, Windows 32/64, Mac OSX 32 and FreeBSD 32/64.  
  
http://fredvs.github.io/uos/
+
== Download ==
 
+
* http://fredvs.github.io/uos/
http://github.com/fredvs/uos/
+
* http://github.com/fredvs/uos/
 
 
----
 
  
'''uoslib''' is the Universal Library version of '''uos''' unit.
+
== uoslib ==
That library is accessible for Pascal and all other languages (C, Java, ...)
+
'''uoslib''' is the Universal Library version of '''uos''' unit and is accessible from Pascal and all other languages (C, Java, ...)
  
 
Included in the package:  Examples and binary libraries for Linux 32/64, Windows 32/64, Mac OSX 32 and FreeBSD 32/64.  
 
Included in the package:  Examples and binary libraries for Linux 32/64, Windows 32/64, Mac OSX 32 and FreeBSD 32/64.  
 +
* http://fredvs.github.io/uoslib/
 +
* http://github.com/fredvs/uoslib/
  
http://fredvs.github.io/uoslib/
+
== Install ==
 
 
http://github.com/fredvs/uoslib/
 
 
 
----
 
 
 
 
The best way to show how uos works is to look at the examples in uos/uoslib packages.
 
The best way to show how uos works is to look at the examples in uos/uoslib packages.
 
All is included, you only have to compile the demos and run it...
 
All is included, you only have to compile the demos and run it...
  
 
Here some examples how to use uos :
 
Here some examples how to use uos :
 +
* Copy all the files in /uos/src/ into the directory of your project.
 +
* add ''uos_flat'' or ''uos'' in your uses section. (for uoslib add ''uoslib_h'')
 +
** ''uos_flat'' => All is done by the unit. The procedures are more "universal", same syntax as uoslib.
 +
** ''uos''  => The application must declare uos class and variables. The procedures can be used as oop way.
 +
* All the examples in uos packages uses ''uos_flat''. There is a example using ''uos'' => SimplePlayer_noflat
 +
* load libraries:
 +
** uos:
 +
**:  uos_LoadLib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName); /// full path of libraries
 +
** uoslib:
 +
**: uos_LoadLibs(uoslibFilename, PortAudioFileName, SndFileFileName, Mpg123FileName,  Mp4ffFileName, FaadFileName); /// full path of libraries
  
----
+
Play a file 'MySong.mp3'
Copy all the files in /uos/src/ into the directory of your project.
+
<syntaxhighlight>
Then : add ''uos_flat'' or ''uos'' in your uses section. (for uoslib add ''uoslib_h'')
+
    // Create the player with uos
 
+
   uos_CreatePlayer( 0 );             // you may create how many players you want, from 0 to to what you computer can do...
=> ''uos_flat'' => All is done by the unit. The procedures are more "universal", same syntax as uoslib.
+
   uos_AddIntoDevOut( 0 );             // Add Output with default parameters     
 
+
   uos_AddFromFile( 0, 'MySong.mp3' ); // Input from audio file  
=> ''uos''  => The application must declare uos class and variables. The procedures can be used as oop way.
+
    // And let's play it...
 
+
  uos_Play(0);                       // Play the song...
All the examples in uos packages uses ''uos_flat''. There is a example using ''uos'' => SimplePlayer_noflat
+
</syntaxhighlight>
 
 
 
 
 
 
Then load libraries:
 
 
 
For uos:
 
  uos_LoadLib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName); /// full path of libraries
 
       
 
For uoslib:
 
  uos_LoadLibs(uoslibFilename, PortAudioFileName, SndFileFileName, Mpg123FileName,  Mp4ffFileName, FaadFileName); /// full path of libraries
 
             
 
=> Let's play a sound file...
 
 
 
Create the player :
 
    uos_CreatePlayer(0); /// you may create how many players you want, from 0 to to what you computer can do...
 
    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 (only for uos, in future for uoslib too):
 
 
 
First create the player:
 
   uos_CreatePlayer(0); /// you may create how many players you want, from 0 to to what you computer can do...
 
   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 (for uoslib too) :
 
 
 
Create the player:
 
    uos_CreatePlayer(0); /// you may create how many players you want, from 0 to what you computer can do...
 
    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 arguments for custom parameters...
 
 
 
  
    Init Procedures :
+
Play a sound file with some dsp effects (only for uos, in future for uoslib too):
     uos_LoadLib; (uos_LoadLibs for uoslib)       //// Load dynamic libraries
+
<syntaxhighlight>
    uos_UnLoadLib;
+
  uos_CreatePlayer( 0 );              // First create the player:
 +
  uos_AddIntoDevOut( 0 );            // Add Output with default parameters      
 +
  uos_AddFromFile( 0, 'MySong.mp3' ); // Input from audio file
 +
  uos_AddDSPIn( 0, 1 );              // Add as many dsp effects you want
 +
  uos_AddDSPIn( 0, 2 );
 +
  uos_Play( 0 );                      // Play the song with DSP effect...
 +
</syntaxhighlight>
  
    Output Procedures:
+
Listen to your mic into your loudspeakers (for uoslib too) :
     uos_AddIntoDevOut();         //// Output into OUT Device
+
<syntaxhighlight>
    uos_AddIntoFile();          //// Output into Wav File
+
  uos_CreatePlayer( 0 );      
 +
  uos_AddIntoDevOut( 0 ); 
 +
  uos_AddFromDevIn( 0 );   // Input from IN Device
 +
  uos_Play( 0 );          // Listen to your mic in your loudspeakers...
 +
</syntaxhighlight>
  
    Input Procedures:
+
Now, ear your mic, listen to a mp3, apply some effects and record the mic into wav file at same time:
    uos_AddFromDevIn();         //// Input from IN device
+
</syntaxhighlight>
    uos_AddFromFile();           //// Input from Audio File
+
  uos_CreatePlayer( 0 );
    uos_InputLength();           //// Lenght of Input in samples
+
  uos_AddIntoDevOut( 0 ) ;             // Output into OUT Device
    uos_InputPosition();         //// Get position
+
  uos_AddIntoFile( 0, 'Myrecord.wav' ); // Output into OUT Device
    uos_Seek();                 //// Change position
+
  uos_AddFromDevIn( 0 );               // Input from IN Device
 +
  uos_AddDSPIn( 0, 1 );                 // Add as many dsp's you want
 +
  uos_AddDSPIn( 0, 2 );
 +
  uos_CreatePlayer( 1 );
 +
  uos_AddFromFile( 1, 'MySong.mp3' ); // the background audio file
 +
  uos_AddIntoDevOut( 1 ) ;             // Output into OUT1 Device;
  
    Player Procedures:    
+
   uos_Play(0);                        // Listen your mic with DSP effects and record it ...
    uos_Play;                    //// Start playing
+
  uos_Play(1);                        // Listen to mp3 while recording
    uos_RePlay;                  //// Resume playing after pause
+
</syntaxhighlight>
    uos_Stop;                    //// Stop playing and free thread
 
    uos_Pause;                  //// Pause playing
 
   
 
    DSP Procedures :               
 
    uos_AddDSPIn()               //// DSP procedure for input
 
    uos_AddDSPOut()             //// DSP procedure for output
 
    uos_SetDSPin()              //// Set DSP In
 
    uos_SetDSPout()              //// Set DSP out
 
    uos_SetDSPVolumeIn          //// Set Volume
 
    uos_AddFilterIn              //// Add filer
 
    uos_AddPlugin              //// Add pluggin
 
  
    And much more other procedures/functions (see in uos.pas...)
+
== Syntax ==
 +
Here are the basic uos procedures. Each procedure has its equivalent with arguments for custom parameters.
  
 +
Initialization Procedures:
 +
uos_LoadLib; (uos_LoadLibs for uoslib)        //// Load dynamic libraries
 +
uos_UnLoadLib;
 +
Output
 +
uos_AddIntoDevOut();        // Output into OUT Device
 +
uos_AddIntoFile();          // Output into Wav File
 +
Input
 +
uos_AddFromDevIn();          // Input from IN device
 +
uos_AddFromFile();          // Input from Audio File
 +
uos_InputLength();          // Lenght of Input in samples
 +
uos_InputPosition();        // Get position
 +
uos_Seek();                  // Change position
 +
Player
 +
uos_Play();                // Start playing
 +
uos_RePlay();              // Resume playing after pause
 +
uos_Stop();                // Stop playing and free thread
 +
uos_Pause();                // Pause playing
 +
DSP
 +
uos_AddDSPIn()              // DSP procedure for input
 +
uos_AddDSPOut()              // DSP procedure for output
 +
uos_SetDSPin()              // Set DSP In
 +
uos_SetDSPout()              // Set DSP out
 +
uos_SetDSPVolumeIn(...)      // Set Volume
 +
uos_AddFilterIn(...)        // Add filer
 +
uos_AddPlugin(...)          // Add pluggin
 +
And much more other procedures/functions (see in uos.pas...)
  
 
[[Category:Libraries]]   
 
[[Category:Libraries]]   
 
[[Category:Audio]]
 
[[Category:Audio]]

Revision as of 00:29, 20 July 2016

uoslogo.png

uos (United OpenLib of Sound) is a multi-platform package of audio handling routines that unifies the best open-source audio libraries.

Features

  • play .mp3, .ogg, .wav, .flac, .m4a and cdrom audio files.
  • 16, 32 or float 32 bit resolution
  • record all types of input into file, in 16 or 32 bit resolution, mono or stereo.
  • add DSP effects and filters, however many you want and record it.
  • play multiple inputs and outputs simultaneously
  • internet audio streaming

Uos can use the SoundTouch, PortAudio, SndFile, Mpg123, Faad and Mp4ff audio libraries.

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

Download

uoslib

uoslib is the Universal Library version of uos unit and is accessible from Pascal and all other languages (C, Java, ...)

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

Install

The best way to show how uos works is to look at the examples in uos/uoslib packages. All is included, you only have to compile the demos and run it...

Here some examples how to use uos :

  • Copy all the files in /uos/src/ into the directory of your project.
  • add uos_flat or uos in your uses section. (for uoslib add uoslib_h)
    • uos_flat => All is done by the unit. The procedures are more "universal", same syntax as uoslib.
    • uos => The application must declare uos class and variables. The procedures can be used as oop way.
  • All the examples in uos packages uses uos_flat. There is a example using uos => SimplePlayer_noflat
  • load libraries:
    • uos:
      uos_LoadLib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName); /// full path of libraries
    • uoslib:
      uos_LoadLibs(uoslibFilename, PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName); /// full path of libraries

Play a file 'MySong.mp3'

    // Create the player with uos
  uos_CreatePlayer( 0 );              // you may create how many players you want, from 0 to to what you computer can do...
  uos_AddIntoDevOut( 0 );             // Add Output with default parameters     
  uos_AddFromFile( 0, 'MySong.mp3' ); // Input from audio file 
    // And let's play it...
  uos_Play(0);                        // Play the song...

Play a sound file with some dsp effects (only for uos, in future for uoslib too):

  uos_CreatePlayer( 0 );              // First create the player:
  uos_AddIntoDevOut( 0 );             // Add Output with default parameters     
  uos_AddFromFile( 0, 'MySong.mp3' ); // Input from audio file 
  uos_AddDSPIn( 0, 1 );               // Add as many dsp effects you want
  uos_AddDSPIn( 0, 2 );
  uos_Play( 0 );                      // Play the song with DSP effect...

Listen to your mic into your loudspeakers (for uoslib too) :

  uos_CreatePlayer( 0 );     
  uos_AddIntoDevOut( 0 );   
  uos_AddFromDevIn( 0 );   // Input from IN Device
  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: </syntaxhighlight>

 uos_CreatePlayer( 0 );
 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 as many dsp's you want
 uos_AddDSPIn( 0, 2 );
 uos_CreatePlayer( 1 );
 uos_AddFromFile( 1, 'MySong.mp3' );  // the background audio file
 uos_AddIntoDevOut( 1 ) ;             // Output into OUT1 Device;
 uos_Play(0);                         // Listen your mic with DSP effects and record it ...
 uos_Play(1);                         // Listen to mp3 while recording

</syntaxhighlight>

Syntax

Here are the basic uos procedures. Each procedure has its equivalent with arguments for custom parameters.

Initialization Procedures:

uos_LoadLib; (uos_LoadLibs for uoslib)        //// Load dynamic libraries
uos_UnLoadLib;

Output

uos_AddIntoDevOut();         // Output into OUT Device
uos_AddIntoFile();           // Output into Wav File

Input

uos_AddFromDevIn();          // Input from IN device
uos_AddFromFile();           // Input from Audio File
uos_InputLength();           // Lenght of Input in samples
uos_InputPosition();         // Get position
uos_Seek();                  // Change position

Player

uos_Play();                 // Start playing
uos_RePlay();               // Resume playing after pause
uos_Stop();                 // Stop playing and free thread
uos_Pause();                // Pause playing

DSP

uos_AddDSPIn()               // DSP procedure for input
uos_AddDSPOut()              // DSP procedure for output
uos_SetDSPin()               // Set DSP In
uos_SetDSPout()              // Set DSP out
uos_SetDSPVolumeIn(...)      // Set Volume
uos_AddFilterIn(...)         // Add filer
uos_AddPlugin(...)           // Add pluggin

And much more other procedures/functions (see in uos.pas...)