SFBReplayGainAnalyzer
@interface SFBReplayGainAnalyzer : NSObject
A class that calculates replay gain
-
The reference loudness in dB SPL, defined as 89.0 dB
Declaration
Objective-C
@property (class, nonatomic, readonly) float referenceLoudness;
-
Analyze the given album’s replay gain
The returned dictionary will contain the entries returned by \c -albumGainAndPeakSample and the results of \c -trackGainAndPeakSample keyed by URL
Declaration
Objective-C
+ (nullable NSDictionary *)analyzeAlbum:(nonnull NSArray<NSURL *> *)urls error:(NSError *_Nullable *_Nullable)error;
Parameters
urls
The URLs to analyze
error
An optional pointer to an \c NSError object to receive error information
Return Value
A dictionary of gain and peak information, or \c nil on error
-
Analyze the given URL’s replay gain
If the URL’s sample rate is not natively supported, the replay gain adjustment will be calculated using audio resampled to an even multiple sample rate
Declaration
Objective-C
- (nullable NSDictionary<SFBReplayGainAnalyzerKey, NSNumber *> *) analyzeTrack:(nonnull NSURL *)url error:(NSError *_Nullable *_Nullable)error;
Parameters
url
The URL to analyze
error
An optional pointer to an \c NSError object to receive error information
Return Value
A dictionary containing the track gain in dB (\c SFBReplayGainAnalyzerGainKey) and peak sample value normalized to [-1, 1) (\c SFBReplayGainAnalyzerPeakKey), or \c nil on error
-
Returns the album gain in dB (\c SFBReplayGainAnalyzerGainKey) and peak sample value normalized to [-1, 1) (\c SFBReplayGainAnalyzerPeakKey), or \c nil on error
Declaration
Objective-C
- (nullable NSDictionary<SFBReplayGainAnalyzerKey, NSNumber *> *) albumGainAndPeakSampleReturningError:(NSError *_Nullable *_Nullable)error;
-
Analyzes the given album’s replay gain
Throws
AnNSError
object if an error occursDeclaration
Swift
public class func analyzeAlbum(_ urls: [URL]) throws -> (ReplayGain, [URL : ReplayGain])
Parameters
urls
The URLs to analyze
Return Value
The album’s gain and peak information keyed by URL
-
Returns replay gain gain and normalized peak information for
url
Declaration
Swift
public func analyzeTrack(_ url: URL) throws -> ReplayGain
-
Returns replay gain gain and normalized peak information for the album
Declaration
Swift
public func albumReplayGain() throws -> ReplayGain