Skip to content

Commit

Permalink
Update speechbrain.py
Browse files Browse the repository at this point in the history
Fixing style
  • Loading branch information
fabiocat93 authored Feb 3, 2025
1 parent e04923f commit c5b2c1f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/senselab/audio/tasks/speech_enhancement/speechbrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SpeechBrainEnhancer:
"""A factory for managing SpeechBrain enhancement pipelines."""

MAX_DURATION_SECONDS = 60 # Maximum duration per segment in seconds
MIN_LENGTH = 16 # kernel size for speechbrain/sepformer-wham16k-enhancement
MIN_LENGTH = 16 # kernel size for speechbrain/sepformer-wham16k-enhancement
_models: Dict[str, Union[separator, enhance_model]] = {}

@classmethod
Expand Down Expand Up @@ -115,11 +115,11 @@ def enhance_audios_with_speechbrain(
enhanced_waveform = enhancer.enhance_batch(segment.waveform, lengths=torch.tensor([1.0]))
else:
enhanced_waveform = enhancer.separate_batch(segment.waveform)

enhanced_segments.append(
Audio(waveform=enhanced_waveform.reshape(1, -1), sampling_rate=segment.sampling_rate)
)

# TODO: decide what to do with metadata
enhanced_audio = concatenate_audios(enhanced_segments)
enhanced_audio.metadata = audio.metadata
Expand Down

0 comments on commit c5b2c1f

Please sign in to comment.