AudioUtils class

Utility class for audio-related operations.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

applyFade({required double currentVolume, required Duration position, required Duration duration, Duration? fadeInDuration, Duration? fadeOutDuration}) double
Applies fade in/out effect to volume.
areTracksEqual(AudioTrack track1, AudioTrack track2) bool
Compares two audio tracks for equality.
calculateBitrate({required int fileSize, required Duration duration}) int
Calculates the bitrate from file size and duration.
calculateQuality({required int bitrate, required AudioFormat format}) AudioQuality
Calculates audio quality based on bitrate and format.
decibelsToVolume(double decibels) double
Converts decibels to linear volume.
estimateFileSize({required Duration duration, required int bitrate, AudioFormat format = AudioFormat.mp3}) int
Calculates the estimated file size for audio parameters.
generatePlaylistId() String
Generates a unique playlist ID.
generateTrackId() String
Generates a unique track ID.
getAudioFormat(String url) AudioFormat
Gets the audio format from a URL or file path.
getBitrateRange(AudioFormat format) BitrateRange
Gets the typical bitrate range for an audio format.
getFileExtension(String url) String
Gets the file extension from a URL or file path.
getFileName(String url) String
Gets the filename from a URL or file path.
getSourceType(String url) AudioSourceType
Gets the audio source type from a URL.
isLosslessFormat(AudioFormat format) bool
Checks if an audio format is lossless.
isValidAudioUrl(String url) bool
Validates an audio URL.
normalizeSpeed(double speed) double
Normalizes playback speed (0.1 to 5.0).
normalizeVolume(double volume) double
Normalizes volume level (0.0 to 1.0).
supportsMetadata(AudioFormat format) bool
Checks if an audio format supports metadata.
validateTrack(AudioTrack track) ValidationResult
Validates audio track data.
volumeToDecibels(double volume) double
Converts linear volume to decibels.