目标C - 音频延迟估计互相关 [英] Objective C - Cross-correlation for audio delay estimation

查看:161
本文介绍了目标C - 音频延迟估计互相关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人知道如何在 iOS版

两个音频信号之间执行互相关

我想对齐FFT窗口,我在接收器(我收到来自麦克风的信号)与发射器的那些(这是玩的音轨),即得到确认的第一个样本在发射机每个窗口(除了一个同步周期)也将在接收器处的第一窗口。

我在发送的音频的已知波形的每块(在频域中)注入。我想通过估算已知的波形和接收信号(在几个连续的块)之间的互相关的延迟,但我不知道该怎么办了。

它看起来像有 vDSP_convD 的方法来做到这一点,但我不知道如何使用它,以及是否我首先要执行样本的实数FFT (或许是肯定的,因为我有双重[]通过)。

 无效vDSP_convD(
   常量双__vDSP_signal [],
   vDSP_Stride __vDSP_signalStride,
   常量双__vDSP_filter [],
   vDSP_Stride __vDSP_strideFilter,
   双__vDSP_result [],
   vDSP_Stride __vDSP_strideResult,
   vDSP_Length __vDSP_lenResult,
   vDSP_Length __vDSP_lenFilter


解决方案

互相关的解决方案,是的。但也有需要处理许多障碍。如果你从音频文件样本,它们含有填充其互相关函数不喜欢。这也是非常低效的所有那些样本执行相关 - 这需要大量的时间。我做了一个样本code这表明两个音频文件时移。如果你有兴趣的样品中,看我 Github上项目

I would like to know if anyone knows how to perform a cross-correlation between two audio signals on iOS.

I would like to align the FFT windows that I get at the receiver (I am receiving the signal from the mic) with the ones at the transmitter (which is playing the audio track), i.e. make sure that the first sample of each window (besides a "sync" period) at the transmitter will also be the first window at the receiver.

I injected in every chunk of the transmitted audio a known waveform (in the frequency domain). I want estimate the delay through cross-correlation between the known waveform and the received signal (over several consecutive chunks), but I don't know how to do it.

It looks like there is the method vDSP_convD to do it, but I have no idea how to use it and whether I first have to perform the real FFT of the samples (probably yes, because I have to pass double[]).

void vDSP_convD (
   const double __vDSP_signal[],
   vDSP_Stride __vDSP_signalStride,
   const double __vDSP_filter[],
   vDSP_Stride __vDSP_strideFilter,
   double __vDSP_result[],
   vDSP_Stride __vDSP_strideResult,
   vDSP_Length __vDSP_lenResult,
   vDSP_Length __vDSP_lenFilter
)

解决方案

Cross-correlation is the solution, yes. But there are many obstacles you need to handle. If you get samples from the audio files, they contain padding which cross-correlation function does not like. It is also very inefficient to perform correlation with all those samples - it takes a huge amount of time. I have made a sample code which demonstrates time shift of two audio files. If you are interested in the sample, look at my Github Project.

这篇关于目标C - 音频延迟估计互相关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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