-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to decide the output audio duration #358
Comments
Hey @UtkuBulkan! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this issue together! I couldn't find specific information on how the To predict the output audio duration, you might need to experiment with these parameters and observe their effects on the audio processing. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
@dosu, how can I further eloborate this? I want to call the following function once with an additional argument of duration, so it will create alter the speed accordingly and produce an audio file in the exact duration I desire. def convert(self, audio_src_path, src_se, tgt_se, output_path=None, tau=0.3, message="default"): |
To achieve the desired output duration by adjusting the speed dynamically, you would need to calculate the required speed factor based on the original duration of the input audio and the target duration. Here's a general approach you can take:
Here's a conceptual example of how you might implement this: import librosa
def convert(self, audio_src_path, src_se, tgt_se, output_path=None, tau=0.3, message="default", target_duration=None):
# Load the audio to get the original duration
original_duration = librosa.get_duration(filename=audio_src_path)
# Calculate the speed factor if target_duration is provided
if target_duration is not None:
speed_factor = original_duration / target_duration
else:
speed_factor = 1.0 # Default speed
# Use the speed factor in your conversion process
# Assuming you have a method to set the speed in your model
self.model.set_speed(speed_factor)
# Proceed with the conversion
# Your existing conversion logic here This approach allows you to specify a target duration, and the function will adjust the speed to match that duration. Note that you may need to adapt this example to fit the specifics of your codebase and the To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
I want to know the exact output duration prior generating the audio through tone_color_converter.convert call. How may I achieve that ?
I believe that I need to use somehow the speed argument. Any help would be welcomed.
The text was updated successfully, but these errors were encountered: