如何绘制Android音乐播放器的波形?

时间:2022-12-14 21:26:06

one of the default live wallpapers that came with my phone was a wallpaper that displayed the wave form of music playing in the background in real time. I was wondering how one could go about doing this. It seems I should somehow access the streaming data of the background music and compute the samples in real time, but I have no idea how to get the streaming data. I think I can display the wave form by following this tutorial http://codeidol.com/java/swing/Audio/Build-an-Audio-Waveform-Display/, but I'm not exactly sure how to do it. Help would be greatly appreciated/

我的手机附带的默认动态壁纸之一是一个壁纸,显示在后台实时播放音乐的波形。我想知道如何做到这一点。我似乎应该以某种方式访问​​背景音乐的流数据并实时计算样本,但我不知道如何获取流数据。我想我可以按照本教程http://codeidol.com/java/swing/Au​​dio/Build-an-Audio-Waveform-Display/显示波形,但我不确定如何做到这一点。非常感谢帮助/

2 个解决方案

#1


21  

There is an Android class called Visualizer that lets you access audio being played http://developer.android.com/reference/android/media/audiofx/Visualizer.html

有一个名为Visualizer的Android类,可以让你访问正在播放的音频http://developer.android.com/reference/android/media/audiofx/Visualizer.html

In addition, since Android is all open source, you can look at how the live wallpaper does it! https://android.googlesource.com/platform/packages/wallpapers/MusicVisualization/

另外,由于Android都是开源的,你可以看看动态壁纸是如何做到的! https://android.googlesource.com/platform/packages/wallpapers/MusicVisualization/

#2


19  

Also, check out https://github.com/felixpalmer/android-visualizer for an example of how to create visualizations from the audio output of the MediaPlayer.

另外,请查看https://github.com/felixpalmer/android-visualizer,了解如何从MediaPlayer的音频输出创建可视化的示例。

#1


21  

There is an Android class called Visualizer that lets you access audio being played http://developer.android.com/reference/android/media/audiofx/Visualizer.html

有一个名为Visualizer的Android类,可以让你访问正在播放的音频http://developer.android.com/reference/android/media/audiofx/Visualizer.html

In addition, since Android is all open source, you can look at how the live wallpaper does it! https://android.googlesource.com/platform/packages/wallpapers/MusicVisualization/

另外,由于Android都是开源的,你可以看看动态壁纸是如何做到的! https://android.googlesource.com/platform/packages/wallpapers/MusicVisualization/

#2


19  

Also, check out https://github.com/felixpalmer/android-visualizer for an example of how to create visualizations from the audio output of the MediaPlayer.

另外,请查看https://github.com/felixpalmer/android-visualizer,了解如何从MediaPlayer的音频输出创建可视化的示例。