读取的AudioFile和显示与Java的波形。 [英] Reading an audiofile and displaying the waveform with Java.

查看:441
本文介绍了读取的AudioFile和显示与Java的波形。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我我如何可以读取音频文件,其存储在一个字节数组,继续显示其波形?我的Java知识是非常基本的。如果任何人都可以链接到我的学习资料对Java音频节目将是巨大的。

Can anyone advise me on how I could read an audio file, store it in a byte array and proceed to display its waveform? My knowledge of Java is very basic. If anyone can link me to learning materials for Java audio programming it would be great.

推荐答案

您需要了解脉冲code调制的一些基础知识,因为这是波如何重新数字psented离散字节/值$ P $。大多数波形格式都只是一些头/元数据,然后脉冲的codeS。

You will need to understand some basics about Pulse Code Modulation, as that is how waves are represented digitally as discrete byte/values. Most waveform formats are just some header/metadata and then a stream of pulse codes.

下面是数字采样和脉冲code调制底漆:

Here is a primer on digital sampling and pulse code modulation:

<一个href=\"http://www.speaking$c$c.com/2011/12/31/primer-on-digital-audio-and-pulse-$c$c-modulation-pcm/\">http://www.speaking$c$c.com/2011/12/31/primer-on-digital-audio-and-pulse-$c$c-modulation-pcm/

在此之后,这是相对简单的。加载文件时,通过元数据读取,让你知道采样率,位深度,等再基本建立与PCM值的数组。一般的Java文件中所描述的阅读技巧将罚款为此,这样的Java教程,许多网页在线,和几个相关的问题上堆栈溢出。

After that, it's relatively simple. Load the file, read through the meta data so you know the sampling rate, bit depth, etc. and then basically build up an array with the pcm values.. general java file reading techniques will work fine for that, such as described in the Java tutorials, many pages online, and several relevant questions on stack overflow.

<一个href=\"http://docs.oracle.com/javase/tutorial/essential/io/\">http://docs.oracle.com/javase/tutorial/essential/io/

一旦你有你的数组,你的价值观有效地重新present在那个时间点的波的振幅位置...推广这些价值观,转化为图像 - 有这么多的方式来做到这一点,它真的只是取决于你。有些事情要考虑的是你关心的时间轴,或波形的只是形状?如果你只关心形状,它更容易,因为你并不需要在x轴上适当标记时间和规模(假设你按照时间在X轴和Y轴的幅度标准)

Once you have your array, your values effectively represent the amplitude position of the wave at that point in time... scale those values and translate to an image - there's so many ways to do that, it's really just up to you. Some things to consider are do you care about the time axis, or just the shape of the wave form? if you only care about the shape, it's easier, cause you don't need to appropriately mark time and scale on the x axis (assuming you follow the standard of time on x axis and amplitude on y axis)

这篇关于读取的AudioFile和显示与Java的波形。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆