简体   繁体   中英

Python & Audio Visualization

I am working on a pet project for rendering data output in Python from audio. I have seen plenty of examples of processing WAV files (such as this StackOverflow question/answer).

My issues is that I want to process either WAV or MP3 the same way but also in a more "universal" way (such as not having to worry about sample sizing for unpacking)?

The overall goal of the project is simple:

  1. Read the audio file (regardless of format)
  2. Get a list of the audio levels
  3. Play the sound
  4. Move a line (or progress bar) up-and-down real time based on the "volume" as the sound plays
  5. Evolve that into something a bit more visually appealing

PyGame 's mixer works great for throwing any file I want at it, but I don't see a way to get file analysis from the data. The WAV files I have also don't work in the aforementioned StackOverflow post.

Converting on-the-fly all the time wouldn't give me the responsiveness I want and I want to avoid having to process every file I want to throw at this thing to force it into mono, etc.

In the trend I've been having lately, I found something after asking a question.

I found the exact library I needed to take the complexity out: librosa . There's also a great intro tutorial here: https://medium.com/analytics-vidhya/how-to-create-a-music-visualizer-7fad401f5a69 - I recommend looking here for people looking to start that don't want to worry too much about the math/physics just yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM