| | import gradio as gr |
| | from pydub import AudioSegment |
| |
|
| | def combine_audio(waves_file, seagulls_file): |
| | try: |
| | |
| | waves = AudioSegment.from_file(waves_file) |
| | seagulls = AudioSegment.from_file(seagulls_file) |
| |
|
| | |
| | waves = waves - 5 |
| | seagulls = seagulls + 3 |
| |
|
| | |
| | combined_audio = waves.overlay(seagulls) |
| |
|
| | |
| | output_file = "seagulls_over_waves.mp3" |
| | combined_audio.export(output_file, format="mp3") |
| |
|
| | return output_file |
| | except Exception as e: |
| | return f"Error: {e}" |
| |
|
| | |
| | interface = gr.Interface( |
| | fn=combine_audio, |
| | inputs=[ |
| | gr.Audio(type="filepath", label="Upload Audio"), |
| | gr.Audio(type="filepath", label="Upload Audio"), |
| | ], |
| | outputs=gr.Audio(type="filepath", label="Combined Audio"), |
| | title="AudioMix_v1", |
| | description="Upload two audio files (e.g., waves and seagulls) to combine them into one seamless track.", |
| | ) |
| |
|
| | |
| | if __name__ == "__main__": |
| | interface.launch() |
| |
|