pub struct AudioProcessor {
pub file_path: String,
}
Expand description
Main struct for processing an audio file.
Fields§
§file_path: String
Implementations§
Source§impl AudioProcessor
impl AudioProcessor
Sourcepub fn new(file_path: &str) -> Result<Self, AudioError>
pub fn new(file_path: &str) -> Result<Self, AudioError>
Creates a new audio processor instance from a file path.
Sourcepub fn seek(&self, position: Duration) -> Result<Self, AudioError>
pub fn seek(&self, position: Duration) -> Result<Self, AudioError>
Seeks to a given time position and outputs a new file.
Sourcepub fn trim(&self, start: Duration, end: Duration) -> Result<Self, AudioError>
pub fn trim(&self, start: Duration, end: Duration) -> Result<Self, AudioError>
Trims the audio between start and end durations. Returns a new AudioProcessor instance with the trimmed segment.
Sourcepub fn transcode(
&self,
output_format: AudioFormat,
output_path: &str,
) -> Result<(), AudioError>
pub fn transcode( &self, output_format: AudioFormat, output_path: &str, ) -> Result<(), AudioError>
Transcodes the current audio to a different format.
Sourcepub fn adjust_volume(&self, factor: f32) -> Result<Self, AudioError>
pub fn adjust_volume(&self, factor: f32) -> Result<Self, AudioError>
Adjusts the audio volume by a scaling factor.
Sourcepub fn change_speed(&self, factor: f32) -> Result<Self, AudioError>
pub fn change_speed(&self, factor: f32) -> Result<Self, AudioError>
Changes the playback speed (and optionally pitch) by a factor.
Sourcepub fn apply_effect(&self, effect: AudioEffect) -> Result<Self, AudioError>
pub fn apply_effect(&self, effect: AudioEffect) -> Result<Self, AudioError>
Applies an audio effect using FFmpeg filters.
Sourcepub fn merge_audios(
audios: &[AudioProcessor],
output_path: &str,
) -> Result<Self, AudioError>
pub fn merge_audios( audios: &[AudioProcessor], output_path: &str, ) -> Result<Self, AudioError>
Merges multiple audio files sequentially (concatenation). Uses FFmpeg’s concat demuxer.
Sourcepub fn reverse(&self) -> Result<Self, AudioError>
pub fn reverse(&self) -> Result<Self, AudioError>
Reverses the audio.
Sourcepub fn normalize(&self) -> Result<Self, AudioError>
pub fn normalize(&self) -> Result<Self, AudioError>
Normalizes the audio volume.
Sourcepub fn overlay(
&self,
overlay_audio: &AudioProcessor,
start_time: Duration,
) -> Result<Self, AudioError>
pub fn overlay( &self, overlay_audio: &AudioProcessor, start_time: Duration, ) -> Result<Self, AudioError>
Overlays another audio onto this one at a given start time.
Trait Implementations§
Source§impl Clone for AudioProcessor
impl Clone for AudioProcessor
Source§fn clone(&self) -> AudioProcessor
fn clone(&self) -> AudioProcessor
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for AudioProcessor
impl RefUnwindSafe for AudioProcessor
impl Send for AudioProcessor
impl Sync for AudioProcessor
impl Unpin for AudioProcessor
impl UnwindSafe for AudioProcessor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more