1 // Copyright (c) 2011 Jan Kokemüller 2 // Copyright (c) 2020 Sebastian Dröge <sebastian@centricular.com> 3 // 4 // Permission is hereby granted, free of charge, to any person obtaining a copy 5 // of this software and associated documentation files (the "Software"), to deal 6 // in the Software without restriction, including without limitation the rights 7 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 // copies of the Software, and to permit persons to whom the Software is 9 // furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be included in 12 // all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 // THE SOFTWARE. 21 22 //! Implementation of the [EBU R128 loudness standard](https://tech.ebu.ch/docs/r/r128.pdf). 23 //! 24 //! The European Broadcasting Union Loudness Recommendation (EBU R128) informs broadcasters how 25 //! they can analyze and normalize audio so that each piece of audio sounds roughly the same 26 //! volume to the human ear. 27 //! 28 //! This crate provides an API which analyzes audio and outputs perceived loudness. The results 29 //! can then be used to normalize volume during playback. 30 //! 31 //! Features: 32 //! * Implements M, S and I modes ([EBU - TECH 3341](https://tech.ebu.ch/docs/tech/tech3341.pdf)) 33 //! * Implements loudness range measurement ([EBU - TECH 3342](https://tech.ebu.ch/docs/tech/tech3342.pdf)) 34 //! * True peak scanning 35 //! * Supports all samplerates by recalculation of the filter coefficients 36 37 mod ebur128; 38 pub use self::ebur128::*; 39 40 #[cfg(feature = "internal-tests")] 41 pub mod interp; 42 #[cfg(not(feature = "internal-tests"))] 43 pub(crate) mod interp; 44 45 #[cfg(feature = "internal-tests")] 46 pub mod true_peak; 47 #[cfg(not(feature = "internal-tests"))] 48 pub(crate) mod true_peak; 49 50 #[cfg(feature = "internal-tests")] 51 pub mod history; 52 #[cfg(not(feature = "internal-tests"))] 53 pub(crate) mod history; 54 55 #[allow(clippy::excessive_precision)] 56 mod histogram_bins; 57 58 #[cfg(feature = "internal-tests")] 59 pub mod filter; 60 #[cfg(not(feature = "internal-tests"))] 61 pub(crate) mod filter; 62 63 #[cfg(feature = "internal-tests")] 64 pub mod utils; 65 #[cfg(not(feature = "internal-tests"))] 66 pub(crate) mod utils; 67 68 #[cfg(feature = "internal-tests")] 69 pub use utils::{energy_to_loudness, Interleaved, Planar, Samples}; 70 #[cfg(not(feature = "internal-tests"))] 71 pub(crate) use utils::{energy_to_loudness, Interleaved, Planar, Samples}; 72 73 #[cfg(test)] 74 pub mod tests { 75 pub use super::utils::tests::Signal; 76 } 77 78 #[cfg(feature = "capi")] 79 #[allow(clippy::missing_safety_doc)] 80 pub mod capi; 81