反转声波的算法 [英] An algorithm for inverting a soundwave

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

问题描述

我正在用Objective-C编写一个简单的程序,我需要获得声波的逆函数.我曾尝试搜索用于执行此操作的算法,但未找到任何内容.我想这不只是将每个值乘以-1:P

Hi I’m making a simple program in Objective-C and I need to get the inverse of a soundwave. I've tried searching for an algorithm for doing this but I haven't found anything. I guess it’s more complicated than just multiplying each value with -1 :P

到目前为止,这是我的代码,我已将数据转换为 int32_t 以便能够对其进行操作:

Here’s my code so far, I’ve cast the data to int32_t to be able to manipulate it:

int32_t* samples = (int32_t*)(sourceBuffer.mData);

for ( int i = 0; i < sourceBuffer.mDataByteSize / sizeof(int32_t); i++ )
{
    // Add algorithm here
}

谢谢.

推荐答案

乘以-1应该无效吗?你得到什么输出?请记住,除非将法线和反向叠加在一起,否则它们不会相互抵消.

Multiplying by -1 should work no? What output do you get? Bear in mind you won't hear ANY difference with the wave unless you layer the normal and inverted together in which case they will cancel each other out.

这篇关于反转声波的算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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