Spaces:
Sleeping
Sleeping
| # Variables for input and output paths to make it easier for users to modify | |
| input_path = "path_to_input_file_or_folder" # Set the path for the input files or folder // Example 'audio-understanding\speechs\speechs\test' | |
| output_cleaned_path = ( | |
| "cleaned" # Output path for cleaned audio after speech enhancement | |
| ) | |
| output_enhanced_path = ( | |
| "enhance" # Output path for enhanced audio after speech super-resolution | |
| ) | |
| # First, perform speech enhancement as speech_super_resolution requires clean speech input | |
| from clearvoice import ClearVoice | |
| myClearVoice = ClearVoice(task="speech_enhancement", model_names=["MossFormer2_SE_48K"]) | |
| # Apply speech enhancement | |
| myClearVoice(input_path=input_path, online_write=True, output_path=output_cleaned_path) | |
| # After speech enhancement, apply speech super-resolution | |
| myClearVoice = ClearVoice( | |
| task="speech_super_resolution", model_names=["MossFormer2_SR_48K"] | |
| ) | |
| # Apply speech super-resolution | |
| myClearVoice( | |
| input_path=output_cleaned_path, online_write=True, output_path=output_enhanced_path | |
| ) | |
| # Output files will be saved in the following directories: | |
| # - Cleaned audio: 'cleaned' folder | |
| # - Enhanced audio: 'enhance' folder | |