开发者

How can I create a graphical representation of a musical track using Java? [closed]

开发者 https://www.devze.com 2023-03-15 00:38 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this po
Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 4 years ago.

开发者_C百科 Improve this question

I have what I think is an incredible idea, but I don't really know how to execute it. I'm looking for some examples or just general pointers. I've tried researching this, but I can't find much. I want to be able to break a track apart into a graphical representation much like garageband does on Mac. Hopefully this makes some kind of sense. Any help is appreciated!


Step 1 - decode your audio file into raw numbers
It'll be a different process depending on what file type you're trying to read. I'd suggest you google around and find some java libraries to help with reading whichever file type you end up using. (The code to interact with headers / decompression is a drag to write). WAV files are pretty simple, if you want to start with those.

Step 2 - process the numbers
Assuming your audio data is normalized, what you'll have at this point is a loooooong string of numbers ranging from -1 to +1. I don't know how much you know about audio, but it's a digital representation of the waveform. Since the waveform moves far to rapidly to see visually (up to 22.05k oscillations per second in a CD quality audio file), you might want to lean toward visualizing trends.

Step 3 - display it
I don't know how you're planning on dealing with the visual aspect - if you're looking to record a video to match the music, display a static image, or do something like an itunes visualization while the music plays. There's a decent 2d drawing library packaged with Java if you want to go that route, but I'd recommend looking for some other library if you want to make a video file out of it.

0

精彩评论

暂无评论...
验证码 换一张
取 消