使用网络音频API创建javascript中矢量 [英] Creating a vectorscope in javascript using the web audio api

查看:111
本文介绍了使用网络音频API创建javascript中矢量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在试图创建一个使用分析通过Web Audio API的Javascript实时音频矢量。该API允许访问当前的频率数据和时域数据。我已经重新使用在下面的等式为a和b的变量简单值Lissajous图

I'm currently attempting to create a vectorscope that analyzes realtime audio in Javascript using the Web Audio API. The API allows access to the current frequency data and time domain data. I have already recreated lissajous figures using simple values for the a and b variables in the following equations:

var x = A*sin(a*t);
var y = B*sin(b*t);

其中A和B是振幅,A和b是频率,t是时间(我与performance.now得到())。

Where A & B are the amplitudes, a & b are the frequencies, and t is time (which I obtain with performance.now() ).

我的问题是,我不知道如何实现从网络音频API的字节数据的频率和字节时域数据数据到上述公式。在我的code口有两个振荡器是立体失谐到它们被馈送成两个分析仪(一个用于左声道,一个用于右)彼此(以突出显示相位相关性)。无论从分析仪我可以提取的方法getByteFrequencyData()和getByteTimeDomainData数据()。这两种方法都返回所请求的数据的一个UINT8阵列。我目前正在通过从分析器缓冲区迭代,并在每次迭代中所包含的数据应用到上面的公式。其结果是线的一塌糊涂,虽然在X / Y图。

My issue is that I'm not sure how to implement the data from the Byte Frequency Data and the Byte Time Domain Data from the Web Audio API into the equations above. In my code I have two oscillators that are stereo-detuned to one another (to highlight phase correlation) which are fed into two analyzers (one for the left channel and one for the right). From both of the analyzers I can extract data with the methods getByteFrequencyData() and getByteTimeDomainData(). Both of these methods return a Uint8 array of the requested data. I currently iterate through the buffers from the analyzers and apply the contained data to the equations above during each iteration. The result is a mess of lines, albeit on an X/Y graph.

如果任何人有怎样的频率和时域数据成可用值的两个方程我将不胜AP preciate它的变量把任何想法。干杯!

If anyone has any idea on how to translate the frequency and time domain data into usable values for the variables of the two equations I would greatly appreciate it. Cheers!

推荐答案

我张贴在音响设计StackExchange这种过度并获得了有用的答案:<一href=\"http://sound.stackexchange.com/questions/35737/programming-a-vectorscope\">http://sound.stackexchange.com/questions/35737/programming-a-vectorscope

I posted this over at the Sound Design StackExchange and received a helpful answer: http://sound.stackexchange.com/questions/35737/programming-a-vectorscope

这篇关于使用网络音频API创建javascript中矢量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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