Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Fast Music Editing by Python

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Python how to achieve fast music editing, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

You read it right. Python editing music can be done instantly with only three lines of sentences. For example, I want to edit music clips ranging from 33 seconds to 1 minute and 10 seconds:

By running this script, we can complete the clip in an instant:

For Python, this function is too basic to speak fast. During this period of time, the Adobe Audition of ordinary students may not have been successfully opened. Here are some more advanced ways to play.

Before you begin, make sure that Python and pip are successfully installed on your computer. Oh, if not, please visit this article: hyperdetailed Python installation Guide for installation.

Open Cmd (start-run-CMD) in Windows environment, and open Terminal (command+ space input Terminal) in Apple system environment, ready to start entering commands to install dependencies.

Of course, I recommend that you use the VSCode editor to Copy the code of this article and install the dependency module in the terminal at the bottom of the editor. What a comfortable thing: the best partner of Python programming-VSCode detailed guide.

Enter the following command to install the dependency modules we need:

Pip install pydub

If you see Successfully installed xxx, the installation is successful. You also need to install ffmpeg, there are many tutorials on this network, you can also read our last "extract the best part of music" with detailed installation tutorials. The full code of this article can be obtained by replying to the music clip in the background.

1. Volume change

We can also modify the entry volume and exit volume of the above edited music:

Listen to this:

The effect is as expected, think about it, if you use a professional music editor to do this, you have to draw a slice, set the volume, and then save, think about it, it takes too much time! Python may be finished within the time you open the software.

two。 Repetitive fragment

How to repeat the music clip from 33 seconds to 70 seconds that we mentioned at the beginning? It's easy, all you have to do is multiply:

Since only three audio are allowed on the official Wechat account, you can read the original text and listen to this example. Yes, in pydub, the volume is adjusted by addition and the length is adjusted by multiplication in the operation between segment and quantity, do you remember?

3. Gradually coming out

Sometimes our ears need time to adapt to changes in volume, especially when watching short videos, when the volume goes up and down and there is no user experience, and the gradual design is particularly important:

Listen, it's excellent!

4. Reverse music

This is probably the most interesting and most likely to have a special effect, and it will make you completely unaware of the song:

Of course, after reversing the music, it will become "ears" can not bear to "listen", which is also normal, after the original "positive law" is reversed, the tone rhythm has also changed (do not rule out the possibility that people with special tastes like this feeling). Curious? If you are curious, try it yourself!

After messing with this song for such a long time, I still have to tell you the original song: it's End of Time of KMel 391 / Alan Walker / Ahrix.

After reading the above, have you mastered how Python can quickly edit music? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report