uos: what changed
Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | - | ||
| 1 | + | [](</File:uoslogo.png>) | |
| 2 | 2 | ||
| 3 | - | ||
| 3 | + | **uos** (United OpenLib of Sound) is a multi-platform package of audio handling routines that unifies the best open-source audio libraries. | |
| 4 | 4 | ||
| 5 | 5 | # Features | |
| 6 | 6 | ||
| 7 | - | ||
| 8 | - | ||
| 9 | - | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 7 | + | * Play .mp3, .ogg, .wav, .flac, .m4a, .opus, .mod, .it, .s3m, .xm and cdrom audio files. | |
| 8 | + | * Deal with 16, 32 integer or float 32 bit resolution. | |
| 9 | + | * Record all types of input into wav or ogg file with 16 or 32 bit resolution. | |
| 10 | + | * Add DSP effects and filters, however many you want and record it. | |
| 11 | + | * Play multiple inputs and outputs simultaneously. | |
| 12 | + | * Internet audio streaming of mp3, aac and opus files. | |
| 13 | + | * Produce sound by the build-in synthesizer. | |
| 14 | 14 | ||
| 15 | - | ||
| 15 | + | Uus can use the [[SoundTouch]], [[PortAudio]], [[SndFile]], [[Mpg123]], [[Faad]], [[OpusFile]], [[Libxmp]] and [[Mp4ff]] audio libraries. | |
| 16 | 16 | ||
| 17 | - | ||
| 17 | + | Included in the package: Examples and binary libraries for Linux 32/64, arm aarch64 Raspberry Pi, Windows 32/64, macOS 32/64 and FreeBSD 32/64. | |
| 18 | 18 | ||
| 19 | 19 | # Download | |
| 20 | 20 | ||
| 21 | - | ||
| 22 | - | ||
| 21 | + | * <http://fredvs.github.io/uos/> | |
| 22 | + | * <https://github.com/fredvs/uos/tree/main> | |
| 23 | 23 | ||
| 24 | 24 | # Forum | |
| 25 | 25 | ||
| 26 | - | ||
| 26 | + | * <http://uos-forum.108.s1.nabble.com> | |
| 27 | 27 | ||
| 28 | 28 | # uoslib | |
| 29 | 29 | ||
| 30 | - | ||
| 30 | + | Pascal users should use uos instead. | |
| 31 | 31 | ||
| 32 | - | ||
| 32 | + | **uoslib** is the Universal Library version of **uos** unit and is accessible from Pascal and all other languages (C, Java, ...). | |
| 33 | 33 | ||
| 34 | - | ||
| 34 | + | Some methods of uos are not accessible. | |
| 35 | 35 | ||
| 36 | - | ||
| 36 | + | Included in the package: Examples and binary libraries for Linux 32/64, Windows 32/64, macOS 32/64 and FreeBSD 32/64. | |
| 37 | 37 | ||
| 38 | - | ||
| 39 | - | ||
| 38 | + | * <http://fredvs.github.io/uoslib/> | |
| 39 | + | * <http://github.com/fredvs/uoslib/> | |
| 40 | 40 | ||
| 41 | 41 | # Install | |
| 42 | 42 | ||
| 43 | - | ||
| 44 | - | ||
| 45 | - | ||
| 43 | + | The best way to show how uos works is to look at the examples in /uos/examples package. All is included, you only have to compile the demos and run it... | |
| 46 | 44 | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - | ||
| 50 | - | ||
| 51 | - | ||
| 45 | + | Here some examples how to use uos : | |
| 52 | 46 | ||
| 53 | - | ||
| 47 | + | * Copy all the files in /uos/src/ into the directory of your project. | |
| 48 | + | * add _uos_flat_ or _uos_ in your uses section. (for uoslib add _uoslib_h_) | |
| 49 | + | * _uos_flat_ => All is done by the unit. The procedures are more "universal", same syntax as uoslib. | |
| 50 | + | * _uos_ => The application must declare uos class and variables. The procedures can be used as oop way. | |
| 51 | + | * All the examples in uos packages use _uos_flat_. There is a example using only _uos_ => SimplePlayer_noflat | |
| 54 | 52 | ||
| 55 | - | ||
| 56 | - | ||
| 57 | - | ||
| 58 | - | ||
| 59 | - | ||
| 60 | - | ||
| 61 | - | ||
| 53 | + | Those libraries can be used by uos: | |
| 62 | 54 | ||
| 63 | - | ||
| 55 | + | * PortAudio for dealing with audio devices of sound card, | |
| 56 | + | * SndFile for decoding wav, flac, org audio files, | |
| 57 | + | * Mpg123 for decoding mp3 audio files, | |
| 58 | + | * Faad and Mp4ff for decoding m4a audio files, | |
| 59 | + | * OpusFile for decoding opus audio files, | |
| 60 | + | * Libxmp for decoding mod, it, s3m, xm audio files, | |
| 61 | + | * fdkaac for decoding aac web-stream audio files. | |
| 62 | + | * SoundTouch plugin for changing tempo of any type of audio files, | |
| 63 | + | * bs2b plugin to apply stereo to binaural effect. | |
| 64 | 64 | ||
| 65 | - | ||
| 66 | - | ||
| 65 | + | You may load those libraries with: | |
| 67 | 66 | ``` | |
| 68 | - | ||
| 69 | - | ||
| 67 | + | uos_LoadLib( pchar(PortAudioFileName), pchar(SndFileFileName), pchar(Mpg123FileName), pchar(Mp4ffFileName), pchar(FaadFileName), pchar(OpusFileFileName), pchar(LibxmpFileFileName),pchar(fdkaacFilename) ); | |
| 68 | + | ``` | |
| 70 | 69 | ||
| 71 | - | ||
| 70 | + | If some libraries are not needed, just replace the filename with "nil". | |
| 72 | 71 | ||
| 73 | - | ||
| 72 | + | If you replace the filename with pchar('system'), the library of the system will be used (if exists). | |
| 74 | 73 | ||
| 75 | - | ||
| 74 | + | WARNING: Do not forget to call **uos_free()** when application terminates. | |
| 76 | 75 | ||
| 77 | - | ||
| 76 | + | Play a file 'MySong.mp3': | |
| 77 | + | ``` | |
| 78 | 78 | begin | |
| 79 | - | ||
| 80 | - | ||
| 81 | - | ||
| 82 | - | ||
| 83 | - | ||
| 84 | - | ||
| 85 | - | ||
| 86 | - | ||
| 87 | - | ||
| 79 | + | uos_LoadLib( PortAudioFileName, nil, Mpg123FileName, nil, nil, nil, nil, nil); // only PortAudio and Mpg123 are needed. | |
| 80 | + | uos_CreatePlayer( 0 ); // you may create how many players you want, from 0 to to what you computer can do... | |
| 81 | + | uos_AddIntoDevOut( 0 ); // Add Output with default parameters | |
| 82 | + | uos_AddFromFile( 0, 'MySong.mp3' ); // Input from audio file | |
| 83 | + | // And let's play it... | |
| 84 | + | uos_Play(0); // Play the song... | |
| 85 | + | end; | |
| 86 | + | ... | |
| 87 | + | uos_free; // Call this at end of application. | |
| 88 | 88 | ``` | |
| 89 | 89 | ||
| 90 | - | ||
| 91 | - | ||
| 92 | - | ||
| 90 | + | Play a sound file with some dsp effects (only for uos, in future for uoslib too): | |
| 91 | + | ``` | |
| 93 | 92 | begin | |
| 94 | - | ||
| 95 | - | ||
| 96 | - | ||
| 97 | - | ||
| 98 | - | ||
| 99 | - | ||
| 100 | - | ||
| 101 | - | ||
| 102 | - | ||
| 103 | - | ||
| 93 | + | uos_LoadLib( pchar(PortAudioFileName), nil, pchar(Mpg123FileName), nil, nil, nil, nil, nil); // only PortAudio and Mpg123 are needed. | |
| 94 | + | uos_CreatePlayer( 0 ); // First create the player: | |
| 95 | + | uos_AddIntoDevOut( 0 ); // Add Output with default parameters | |
| 96 | + | uos_AddFromFile( 0, 'MySong.mp3' ); // Input from audio file | |
| 97 | + | uos_InputAddDSP( 0, 1 ); // Add as many dsp effects you want | |
| 98 | + | uos_InputAddDSP( 0, 2 ); | |
| 99 | + | uos_Play( 0 ); // Play the song with DSP effect... | |
| 100 | + | end; | |
| 101 | + | ... | |
| 102 | + | uos_free; // Call this at end of application. | |
| 104 | 103 | ``` | |
| 105 | 104 | ||
| 106 | - | ||
| 107 | - | ||
| 108 | - | ||
| 105 | + | Listen to your mic into your loudspeakers (for uoslib too) : | |
| 106 | + | ``` | |
| 109 | 107 | begin | |
| 110 | - | ||
| 111 | - | ||
| 112 | - | ||
| 113 | - | ||
| 114 | - | ||
| 115 | - | ||
| 116 | - | ||
| 117 | - | ||
| 108 | + | uos_LoadLib( pchar(PortAudioFileName), nil, nil, nil, nil, nil, nil, nil); // only PortAudio is needed. | |
| 109 | + | uos_CreatePlayer( 0 ); | |
| 110 | + | uos_AddIntoDevOut( 0 ); | |
| 111 | + | uos_AddFromDevIn( 0 ); // Input from IN Device | |
| 112 | + | uos_Play( 0 ); // Listen to your mic in your loudspeakers... | |
| 113 | + | end; | |
| 114 | + | ... | |
| 115 | + | uos_free; // Call this at end of application. | |
| 118 | 116 | ``` | |
| 119 | 117 | ||
| 120 | - | ||
| 121 | - | ||
| 122 | - | ||
| 118 | + | Now, listen to your mic, listen to a mp3, apply some effects and record the mic into wav file at same time: | |
| 119 | + | ``` | |
| 123 | 120 | begin | |
| 124 | - | ||
| 125 | - | ||
| 126 | - | ||
| 127 | - | ||
| 128 | - | ||
| 129 | - | ||
| 130 | - | ||
| 131 | - | ||
| 132 | - | ||
| 133 | - | ||
| 134 | - | ||
| 135 | - | ||
| 136 | - | ||
| 137 | - | ||
| 138 | - | ||
| 139 | - | ||
| 121 | + | uos_LoadLib( pchar(PortAudioFileName), pchar(SndFileFileName), pchar(Mpg123FileName), nil, nil, nil, nil, nil); | |
| 122 | + | uos_CreatePlayer( 0 ); | |
| 123 | + | uos_AddIntoDevOut( 0 ) ; // Output into OUT Device | |
| 124 | + | uos_AddIntoFile( 0, 'Myrecord.wav' ); // Output into wav file | |
| 125 | + | uos_AddFromDevIn( 0 ); // Input from IN Device | |
| 126 | + | uos_InputAddDSP( 0, 1 ); // Add as many dsp's you want | |
| 127 | + | uos_InputAddDSP( 0, 2 ); | |
| 128 | + | uos_CreatePlayer( 1 ); | |
| 129 | + | uos_AddFromFile( 1, 'MySong.mp3' ); // the background audio file | |
| 130 | + | uos_AddIntoDevOut( 1 ) ; // Output into OUT1 Device; | |
| 131 | + | ||
| 132 | + | uos_Play(0); // Listen your mic with DSP effects and record it ... | |
| 133 | + | uos_Play(1); // Listen to mp3 while recording | |
| 134 | + | end; | |
| 135 | + | ... | |
| 136 | + | uos_free; // Call this at end of application. | |
| 140 | 137 | ``` | |
| 141 | 138 | ||
| 142 | 139 | # Syntax | |
| 143 | 140 | ||
| 144 | - | ||
| 145 | - | ||
| 146 | - | ||
| 141 | + | Here are the basic uos methods. Each method has its equivalent with arguments for custom parameters. | |
| 147 | 142 | ||
| 148 | - | ||
| 149 | - | ||
| 150 | - | ||
| 151 | - | ||
| 152 | - | ||
| 143 | + | Initialization methods: | |
| 153 | 144 | ``` | |
| 154 | - | ||
| 155 | - | ||
| 145 | + | uos_LoadLib(); // Load dynamic libraries for uos | |
| 146 | + | uos_LoadLibs(); // Load dynamic libraries for uoslibs | |
| 147 | + | uos_UnLoadLib(); // To unload libraries. | |
| 148 | + | uos_Free; // To use when application terminate. | |
| 149 | + | ``` | |
| 156 | 150 | ||
| 157 | - | ||
| 151 | + | Output | |
| 152 | + | ``` | |
| 158 | 153 | uos_AddIntoDevOut(); // Output into OUT Device | |
| 159 | - | ||
| 160 | - | ||
| 161 | - | ||
| 162 | - | ||
| 163 | - | ||
| 154 | + | uos_AddIntoFile(); // Output into Wav File | |
| 155 | + | uos_AddIntoMemoryBuffer() // Add a Output into memory buffer | |
| 156 | + | uos_AddIntoMemoryStream() // Add a Output into memory stream | |
| 157 | + | uos_AddIntoIceServer() // Add a Output into a IceCast server | |
| 158 | + | uos_AddIntoFileFromMem() // Add a Output into audio wav file from TMemoryStream | |
| 164 | 159 | ``` | |
| 165 | 160 | ||
| 166 | - | ||
| 167 | - | ||
| 168 | - | ||
| 161 | + | Input | |
| 162 | + | ``` | |
| 169 | 163 | uos_AddFromDevIn(); // Input from IN device | |
| 170 | - | ||
| 171 | - | ||
| 172 | - | ||
| 173 | - | ||
| 174 | - | ||
| 175 | - | ||
| 176 | - | ||
| 177 | - | ||
| 178 | - | ||
| 179 | - | ||
| 180 | - | ||
| 164 | + | uos_AddFromFile(); // Input from Audio File | |
| 165 | + | uos_AddFromMemoryBuffer(); // Input from decoded pcm buffer | |
| 166 | + | uos_AddFromMemoryStream(); // Input from a TMemoryStream of Audio File | |
| 167 | + | uos_AddFromFileIntoMemory(); // Input from audio file and stored into memory buffer | |
| 168 | + | uos_AddFromURL(); // Input from internet URL mp3/opus/aac files | |
| 169 | + | uos_AddFromSynth(; // Input form built-in Synthesizer | |
| 170 | + | uos_InputLength(); // Length of Input in samples | |
| 171 | + | uos_InputPosition(); // Get position | |
| 172 | + | uos_InputSeek(); // Change position in byte | |
| 173 | + | uos_InputSeekTime(); // Change position in time | |
| 174 | + | uos_InputSeekSeconds(); // Change position in second | |
| 181 | 175 | ``` | |
| 182 | 176 | ||
| 183 | - | ||
| 184 | - | ||
| 185 | - | ||
| 177 | + | Player | |
| 178 | + | ``` | |
| 186 | 179 | uos_Play(); // Start playing | |
| 187 | - | ||
| 188 | - | ||
| 189 | - | ||
| 190 | - | ||
| 191 | - | ||
| 192 | - | ||
| 193 | - | ||
| 180 | + | uos_PlayPaused(); // Start playing paused. | |
| 181 | + | uos_PlayNoFree(); // Start playing but do not free the player after stop. | |
| 182 | + | uos_PlayPausedNoFree(); // Start playing paused but do not free the player after stop. | |
| 183 | + | uos_RePlay(); // Resume playing after pause | |
| 184 | + | uos_Stop(); // Stop playing and free thread | |
| 185 | + | uos_Pause(); // Pause playing | |
| 186 | + | uos_FreePlayer(); // Free the player. Works only when PlayNoFree() was used. | |
| 194 | 187 | ``` | |
| 195 | 188 | ||
| 196 | - | ||
| 197 | - | ||
| 198 | - | ||
| 189 | + | DSP | |
| 190 | + | ``` | |
| 199 | 191 | uos_InputAddDSP() // DSP procedure for input | |
| 200 | - | ||
| 201 | - | ||
| 202 | - | ||
| 203 | - | ||
| 204 | - | ||
| 205 | - | ||
| 192 | + | uos_OutputAddDSP() // DSP procedure for output | |
| 193 | + | uos_InputSetDSP() // Set DSP In | |
| 194 | + | uos_OutputSetDSP() // Set DSP out | |
| 195 | + | uos_InputSetDSPVolume(...) // Set Volume | |
| 196 | + | uos_InputAddFilter(...) // Add filer | |
| 197 | + | uos_AddPlugin(...) // Add pluggin | |
| 206 | 198 | ``` | |
| 207 | 199 | ||
| 208 | 200 | And much more other procedures/functions (see in uos.pas...) | |
| 209 | 201 | ||
| 210 | 202 | --- | |
| 211 | - | ||
| 212 | - | ||
| 213 | - | ||
| 214 | - | ||
| 203 | + | *From the Free Pascal wiki, page "uos", as the Internet Archive kept it on 2025-03-12, last changed on 2024-10-08. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
