再presenting图形听起来波 [英] representing sound graphically as wave

查看:130
本文介绍了再presenting图形听起来波的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了录制和播放应用程序的声音和我期待的呈现出简约风潮的一种方式
重新录制声音的presentation,没有动画是必要的,只是一个简单的图表。

这也将是不错的它是可以选择波的一个子集,ofcourrse更漂亮
打那部分以及。

要总结起来,就是我在寻找:


  1. 图形重新present录制的声音的方式为波(例如如被看见在大胆)

  2. 的图形选择波重新presentation子集的方式。

和澄清远一点的东西我在寻找:


  1. 如果有一个lib为了这个,我会很开心疯狂:)

  2. 系统提示哪些组件来处理图形绘制尽其用。

  3. 在如何将图形组件内处理的选择小费。


解决方案

我已经这样做在其他应用程序,并已与它挣扎了一会儿......

您将由你必须显示图形像素的数量除以所述音频文件具有的样本数。这给你一个块大小。
对于所有的水桶你计算最小和最大价值,相对于使用的采样分辨率显示出来。

如果需要可提供进一步的例子。


对于图形的东西:
(我不是一个iOS开发者,但苹果的编程是不是太大的不同,我认为)。
只要创建一个NSView的一个子类(应该是的UIView iOS中),并重写drawRect方法。
然后,只需创建一个传递值的数组,为您的文件的函数,并绘制了一堆行的画面。这已经不是什么黑魔法在这里!

这是没什么好说的,你需要为图书馆!
而且,作为另一个积极的方面:如果你保持足够通用你总是可以重新使用它

I Have created an app that records and plays sound and I am looking for a way of showing a simple wave representation of the recorded sound, no animation is necessary, just a simple graph.

It would also be nice it is was possible to select a subset of the wave and ofcourrse even more nice playing that section aswell.

To sum up, what I'm looking for:

  1. A way of graphically represent a recorded sound as a wave (e.g as seen in audacity)
  2. A way of graphically selecting a subset of the wave representation.

And to clarify a bit further of what I'm looking for:

  1. If there is a lib for this I'd be insanely happy :)
  2. A hint on what components to best use for handling the graph drawing.
  3. A tip on how to handle the selection within the graphical component.

解决方案

I already did this in another application and have been struggling with it for a while ...

You would divide the number of samples the audio file has by the number of pixels you have to display the graph. This gives you a chunksize. For all the "buckets" you calculate the min and max value and display them in relation to the sample resolution used.

Can provide further examples if needed.


Regarding the graphics stuff: (I am not an iOS developer but Mac programming isn't that much different I think.) Just create a subclass of NSView ( should be UIView in iOS ) and override the drawRect method. Then just create a function which you pass an array of values for your file and draw a bunch of lines to the screen. It's no black magic here!!

This is really nothing you would need a library for! And, as another positive aspect : if you keep it generic enough you can always reuse it.

这篇关于再presenting图形听起来波的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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