使用 VBAP 进行 HRIR 插值

信息处理 声音的 插值 3d 空间的 hrtf
2022-02-22 00:30:29

1) 问题描述

我正在尝试在 Python 中实现 3D 音频模拟器。我正在使用 HUTUBS 数据集作为 HRIR 数据库(更多信息在这里:https ://depositonce.tu-berlin.de/handle/11303/9429 ),特别是我使用的是模拟的,它比测量的分辨率更高数据集。

由于我需要声源的连续移动,我正在使用 Pulkki 提出的 VBAP 技术(http://lib.tkk.fi/Diss/2001/isbn9512255324/article1.pdf)对可用的 HRIR 进行插值,特别是我指的是本文解决方案:https ://www.ime.usp.br/~mqz/TwoApproachesForHRTFInterpolation.pdf ,作者建议利用 VBAP 技术插入可用的 HRIR。

到目前为止,我已经实现了所有代码,并且在一定程度上可以正常工作,但是我无法使用建议的插值技术实现恒定的增益幅度。当我使用插值技术时,我会得到音量的“跳跃”(稍后我将展示一个音频示例)

2)我的实现

使用之前的 HRIR 数据库,我将使用以下函数计算距离请求位置最近的 3 个 HRIR:

 def compute_three_closest_positions(self, azimuth_angle, elevation):
        requested_position = np.array([azimuth_angle, elevation, 0])

        # computing the absolute difference between the requested angles and the available one in the dataset
        result = abs(self.sourcePositions - requested_position)
        result = np.delete(result, 2, 1)
        result = result.sum(axis=1)

        # returning index of the requested IR
        indexes = result.argsort()[:3]

        interpolated_positions = self.sourcePositions[indexes]
        print(interpolated_positions)
        self.real_azimuth_angles = interpolated_positions[:,0]
        self.real_elevations = interpolated_positions[:,1]
        print('printing azimuth angles: ',self.real_azimuth_angles)
        print('printing elevation angles: ',self.real_elevations)
        return indexes, interpolated_positions, requested_position

此函数返回数据库中的索引,其中包含距离目标点最近的 3 个 HRIR(以及这些点的位置和请求的位置)。self.sourcePosition是通过self.sourcePositions = self.HRIR_SOFA_file.getVariableValue('SourcePosition')利用pysofaconventions库读取 SOFA 数据集来计算的。

一旦获得所需的 HRIR,我就使用其公式计算 VBAP 增益:

def compute_gains(self, indexes, interpolated_positions, requested_position):
   
    interpolated_positions_cartesian = self.polar2cart(1.47, interpolated_positions[:,0], interpolated_positions[:,1])
    requested_position_cartesian = self.polar2cart(1.47, requested_position[0], requested_position[1], array = False)

    inverse_interpolated_positions_cartesian = np.linalg.inv(interpolated_positions_cartesian)
    g = np.matmul(requested_position_cartesian,inverse_interpolated_positions_cartesian)
    g_normalized = (np.sqrt(1.47)*g)/np.sqrt(g[0][0]**2 + g[0][1]**2 + g[0][2]**2)

    return g_normalized

Whereself.polar2cart是一个简单的支持函数,可以将输入数据从球面坐标转换为笛卡尔坐标,并且使用了常数值1.47,因为数据集的 HRIR 在 1.47 米的距离处测量。

上述两个函数已在返回最终插值 HRIR 的函数内部使用:

 def get_interpolated_IR(self,azimuth_angle, elevation, distance):
        indexes, interpolated_positions, requested_position = self.compute_three_closest_positions(azimuth_angle, elevation)
        gains = self.compute_gains(indexes, interpolated_positions, requested_position)
        aux_IR = np.array((self.IR_dictionary[indexes, 0, :],
                           self.IR_dictionary[indexes, 1, :]))
        aux_IR = np.moveaxis(aux_IR, 1,0)
        gains = np.squeeze(gains,axis=0)
        weighted_IR = 0
        for i in range(0,3):
            weighted_IR =+ gains[i] * aux_IR[i,:,:]

        return weighted_IR

self.IR_dictionary通过以下方式计算self.IR_dictionary = self.HRIR_SOFA_file.getDataIR()

最后,我使用 weighted_IR 过滤一些音频数据。省略了有关音频处理、再现 ecc... 的代码,因为它工作正常。

3) 问题和例子

如果我使用最接近所需位置的单个 HRIR 使用标准 HRIR 数据集(因此没有通过 VBAP 进行插值),这就是我得到的(使用耳机): https ://drive.google.com/file/d/1ywMwmHMKlmnG0MnjEnrmztxmuiZDxDjO/ view?usp=sharing 正如您所听到的,3D 音频模拟的效果相当不错,即使您可以听到每个空间位置之间的一种“步进”行为。

另一方面,如果我使用上述插值方法,这是我得到的结果(音频移动较慢,使音量跳跃更明显):https ://drive.google.com/file/d/ 1F_9IdfiWgeHQNYSYrdqMYC1SQ9q_U7QE/view?usp=sharing

4) 已知的可能错误

我注意到,在我的方法中,计算最接近所需源位置的 3 个点有时会导致一个不包含源位置的三角形,从而获得负增益因子。一个例子如下:

Requested point: azimut, elevation, distance
[200   0   1.47]

Three closest points: azimut, elevation, distance
[[199.69547046   0.           1.47      ]
 [199.40203659   5.61508214   1.47      ]
 [199.40203659  -5.61508214   1.47      ]]

gain matrix:  [[ 2.03778511 -0.52140831 -0.52140831]]

g_normalized:  [[1.1400898290447332 -0.29171491366465313 -0.2917149136646515]]

注意:我也获得“跳跃”交易量以获得有效收益(所有积极因素),如下例所示:

Requested position:
[190   0   0]
Three closest points:
[[191.83033621   0.           1.47      ]
 [188.02560265   2.34839855   1.47      ]
 [188.02560265  -2.34839855   1.47      ]]
gain matrix:  [[0.51921064 0.24087231 0.24087231]]
g_normalized:  [[1.013732209139594 0.47029087177669177 0.47029087177668905]]

5) 问题

哪一个可能是跳跃收益和非恒定交易量的原因?(除了上面已经提到的错误)我也得到了“有效”三元组位置的这种行为。

注意:我的数据具有以下形状(我添加了可视化以简化对我的问题的理解)

领域

这是一个数据矩阵的示例,其中包含数据集中的可用位置(由于问题中的字符限制,我无法提供完整的矩阵):

Source Positions
[[  0.          90.           1.47      ]
 [  0.          85.2073787    1.47      ]
 [  0.          78.16966379   1.47      ]
 [  0.          70.30452954   1.47      ]
 [  0.          62.0367492    1.47      ]
 [  0.          53.56289304   1.47      ]
 [  0.          45.           1.47      ]
 [  0.          36.43710696   1.47      ]
 [  0.          27.9632508    1.47      ]
 [  0.          19.69547046   1.47      ]
 [  0.          11.83033621   1.47      ]
 [  0.           4.7926213    1.47      ]
 [  0.           0.           1.47      ]
 [  0.          -4.7926213    1.47      ]
 [  0.         -11.83033621   1.47      ]
 [  0.         -19.69547046   1.47      ]
 [  0.         -27.9632508    1.47      ]
 [  0.         -36.43710696   1.47      ]
 [  0.         -45.           1.47      ]
 [  0.         -53.56289304   1.47      ]
 [  0.         -62.0367492    1.47      ]
 [  0.         -70.30452954   1.47      ]
 [  0.         -78.16966379   1.47      ]
 [  0.         -85.2073787    1.47      ]
 [  0.         -90.           1.47      ]
 [  1.64008341  -1.6394119    1.47      ]
 [  1.64008341   1.6394119    1.47      ]
 [  2.37160039   8.01881788   1.47      ]
 [  2.37160039  -8.01881788   1.47      ]
 [  2.80356493 -15.58649429   1.47      ]
 [  2.80356493  15.58649429   1.47      ]
 [  3.16999007  23.70233802   1.47      ]
 [  3.16999007 -23.70233802   1.47      ]
 [  3.56208248 -32.09871039   1.47      ]
 [  3.56208248  32.09871039   1.47      ]
 [  4.04606896  40.63141594   1.47      ]
 [  4.04606896 -40.63141594   1.47      ]
 [  4.1063771   -4.09587122   1.47      ]
 [  4.1063771    4.09587122   1.47      ]
 [  4.70089981  49.2024397    1.47      ]
 [  4.70089981 -49.2024397    1.47      ]
 [  4.7926213    0.           1.47      ]
 [  5.18003348  11.34988901   1.47      ]
 [  5.18003348 -11.34988901   1.47      ]
 [  5.65662228 -57.72525378   1.47      ]
 [  5.65662228  57.72525378   1.47      ]
 [  5.950799    19.30523849   1.47      ]
 [  5.950799   -19.30523849   1.47      ]
 [  6.69117127 -27.61716167   1.47      ]
 [  6.69117127  27.61716167   1.47      ]
 [  6.99679324   6.9451987    1.47      ]
 [  6.99679324  -6.9451987    1.47      ]
 [  7.17914676 -66.09875172   1.47      ]
 [  7.17914676  66.09875172   1.47      ]
 [  7.54685777  36.10960472   1.47      ]
 [  7.54685777 -36.10960472   1.47      ]
 [  8.02560265  -2.34839855   1.47      ]
 [  8.02560265   2.34839855   1.47      ]
 [  8.31015293  14.75097316   1.47      ]
 [  8.31015293 -14.75097316   1.47      ]
 [  8.65428668 -44.67195851   1.47      ]
 [  8.65428668  44.67195851   1.47      ]
 [  9.4113917   22.9850347    1.47      ]
 [  9.4113917  -22.9850347    1.47      ]
 [  9.94527716 -74.16952628   1.47      ]
 [  9.94527716  74.16952628   1.47      ]
 [ 10.16924521  10.01274933   1.47      ]
 [ 10.16924521 -10.01274933   1.47      ]
 [ 10.20644567 -53.21545998   1.47      ]
 [ 10.20644567  53.21545998   1.47      ]
 [ 10.57849119  31.43870375   1.47      ]
 [ 10.57849119 -31.43870375   1.47      ]
 [ 11.39521763  -5.07846224   1.47      ]
 [ 11.39521763   5.07846224   1.47      ]
 [ 11.71781242  18.18752703   1.47      ]
 [ 11.71781242 -18.18752703   1.47      ]
 [ 11.83033621   0.           1.47      ]
 [ 12.00910817  39.98781129   1.47      ]
 [ 12.00910817 -39.98781129   1.47      ]
 [ 12.55572647 -61.64591517   1.47      ]
 [ 12.55572647  61.64591517   1.47      ]
 [ 13.18808541  26.61516878   1.47      ]
 [ 13.18808541 -26.61516878   1.47      ]
 [ 13.57223424 -13.20668987   1.47      ]
 [ 13.57223424  13.20668987   1.47      ]
 [ 13.93222636  48.53955038   1.47      ]
 [ 13.93222636 -48.53955038   1.47      ]
 [ 14.86973294 -35.15709506   1.47      ]
 [ 14.86973294  35.15709506   1.47      ]
 [ 14.9005703    8.03442269   1.47      ]
 [ 14.9005703   -8.03442269   1.47      ]
 [ 15.39564168 -21.62918492   1.47      ]
 [ 15.39564168  21.62918492   1.47      ]
 [ 15.6042627    2.70038857   1.47      ]
 [ 15.6042627   -2.70038857   1.47      ]
 [ 16.36946156 -81.6400267    1.47      ]
 [ 16.36946156  81.6400267    1.47      ]
 [ 16.48669352  69.83188274   1.47      ]
 [ 16.48669352 -69.83188274   1.47      ]
 [ 16.7150029  -57.00288364   1.47      ]
 [ 16.7150029   57.00288364   1.47      ]
 [ 17.02691737  43.71636296   1.47      ]
 [ 17.02691737 -43.71636296   1.47      ]
 [ 17.19395061 -16.46805812   1.47      ]
 [ 17.19395061  16.46805812   1.47      ]
 [ 17.30592586  30.17930126   1.47      ]
 [ 17.30592586 -30.17930126   1.47      ]
 [ 18.5483898  -11.124716     1.47      ]
 [ 18.5483898   11.124716     1.47      ]
 [ 19.35894951  25.04791476   1.47      ]
 [ 19.35894951 -25.04791476   1.47      ]
 [ 19.40203659  -5.61508214   1.47      ]
 [ 19.40203659   5.61508214   1.47      ]
 [ 19.62236001  38.75484136   1.47      ]
 [ 19.62236001 -38.75484136   1.47      ]
 [ 19.69547046   0.           1.47      ]
 [ 20.01992939  52.2039386    1.47      ]
 [ 20.01992939 -52.2039386    1.47      ]
 [ 21.04482476 -19.7531228    1.47      ]
 [ 21.04482476  19.7531228    1.47      ]
 [ 21.08234374  65.25985975   1.47      ]
 [ 21.08234374 -65.25985975   1.47      ]
 [ 21.80747487 -33.65623199   1.47      ]
 [ 21.80747487  33.65623199   1.47      ]
 [ 22.35617628  14.28763204   1.47      ]
 [ 22.35617628 -14.28763204   1.47      ]
 [ 22.7019775  -47.26870019   1.47      ]
 [ 22.7019775   47.26870019   1.47      ]
 [ 23.26547643   8.65819735   1.47      ]
 [ 23.26547643  -8.65819735   1.47      ]
 [ 23.63943111 -28.41582338   1.47      ]
 [ 23.63943111  28.41582338   1.47      ]
 [ 23.7346488    2.9023498    1.47      ]
 [ 23.7346488   -2.9023498    1.47      ]
 [ 24.21803858 -77.53803241   1.47      ]
 [ 24.21803858  77.53803241   1.47      ]
 [ 24.47980904  60.51175385   1.47      ]
 [ 24.47980904 -60.51175385   1.47      ]
 [ 24.91227418 -42.20657626   1.47      ]
 [ 24.91227418  42.20657626   1.47      ]
 [ 25.15024972  23.02517483   1.47      ]
 [ 25.15024972 -23.02517483   1.47      ]
 [ 26.35068855 -17.47624816   1.47      ]
 [ 26.35068855  17.47624816   1.47      ]
 [ 26.75062552  37.01937754   1.47      ]
 [ 26.75062552 -37.01937754   1.47      ]
 [ 27.0913713  -55.62120718   1.47      ]
 [ 27.0913713   55.62120718   1.47      ]
 [ 27.23340936  11.76937527   1.47      ]
 [ 27.23340936 -11.76937527   1.47      ]
 [ 27.77832208  -5.92590316   1.47      ]
 [ 27.77832208   5.92590316   1.47      ]
 [ 27.9632508    0.           1.47      ]
 [ 28.28221843 -31.70311174   1.47      ]
 [ 28.28221843  31.70311174   1.47      ]
 [ 28.76376549  73.11464641   1.47      ]
 [ 28.76376549 -73.11464641   1.47      ]
 [ 29.1592042  -50.60695206   1.47      ]
 [ 29.1592042   50.60695206   1.47      ]
 [ 29.54728944  26.24983039   1.47      ]
 [ 29.54728944 -26.24983039   1.47      ]
 [ 30.56674657 -20.65061551   1.47      ]
 [ 30.56674657  20.65061551   1.47      ]
 [ 30.83270788  45.47781292   1.47      ]
 [ 30.83270788 -45.47781292   1.47      ]
 [ 31.34578223 -14.9011977    1.47      ]
 [ 31.34578223  14.9011977    1.47      ]
 [ 31.72271753  68.47240153   1.47      ]
 [ 31.72271753 -68.47240153   1.47      ]
 [ 31.87747186  -9.01147133   1.47      ]
 [ 31.87747186   9.01147133   1.47      ]
 [ 32.14860743   3.0170113    1.47      ]
 [ 32.14860743  -3.0170113    1.47      ]
 [ 32.20717627 -40.23544245   1.47      ]
 [ 32.20717627  40.23544245   1.47      ]
 [ 33.34422421  34.87601987   1.47      ]
 [ 33.34422421 -34.87601987   1.47      ]
 [ 33.80374677 -63.6670032    1.47      ]
 [ 33.80374677  63.6670032    1.47      ]
 [ 34.28301486  29.39174041   1.47      ]
 [ 34.28301486 -29.39174041   1.47      ]
 [ 35.04658869 -23.77296238   1.47      ]
 [ 35.04658869  23.77296238   1.47      ]
 [ 35.34895957  58.73011406   1.47      ]
 [ 35.34895957 -58.73011406   1.47      ]
 [ 35.64559338 -18.01217841   1.47      ]
 [ 35.64559338  18.01217841   1.47      ]
 [ 36.08099358  12.11111736   1.47      ]
 [ 36.08099358 -12.11111736   1.47      ]
 [ 36.3472473   -6.09089013   1.47      ]
 [ 36.3472473    6.09089013   1.47      ]
 [ 36.43710696   0.           1.47      ]
 [ 36.54240134 -53.67929106   1.47      ]
 [ 36.54240134  53.67929106   1.47      ]
 [ 37.49104029  48.52285063   1.47      ]
 [ 37.49104029 -48.52285063   1.47      ]
 [ 38.26049473 -43.26244646   1.47      ]
 [ 38.26049473  43.26244646   1.47      ]
 [ 38.89235441  37.89458326   1.47      ]
 [ 38.89235441 -37.89458326   1.47      ]
 [ 39.41317128 -32.41179615   1.47      ]
 [ 39.41317128  32.41179615   1.47      ]
 [ 39.83934649  26.80417916   1.47      ]
 [ 39.83934649 -26.80417916   1.47      ]
 [ 40.17988842 -21.06217068   1.47      ]
 [ 40.17988842  21.06217068   1.47      ]
 [ 40.4381312   15.18178714   1.47      ]
 [ 40.4381312  -15.18178714   1.47      ]
 [ 40.61322257  -9.17306752   1.47      ]
 [ 40.61322257   9.17306752   1.47      ]
 [ 40.70208965   3.06953652   1.47      ]
 [ 40.70208965  -3.06953652   1.47      ]
 [ 45.         -87.68120488   1.47      ]
 [ 45.         -84.20260831   1.47      ]
 [ 45.         -80.15364767   1.47      ]
 [ 45.         -75.76582943   1.47      ]
 [ 45.         -71.14963815   1.47      ]
 [ 45.         -66.36539941   1.47      ]
 [ 45.         -61.44781755   1.47      ]
 [ 45.         -56.41666981   1.47      ]
 [ 45.         -51.28206575   1.47      ]
 [ 45.         -46.04723346   1.47      ]
 [ 45.         -40.71010299   1.47      ]
 [ 45.         -35.26438968   1.47      ]
 [ 45.         -29.70075831   1.47      ]
 [ 45.         -24.00879372   1.47      ]
 [ 45.         -18.18080994   1.47      ]
 [ 45.         -12.21860297   1.47      ]
 [ 45.          -6.14282693   1.47      ]
 [ 45.           0.           1.47      ]
 [ 45.           6.14282693   1.47      ]
 [ 45.          12.21860297   1.47      ]
 [ 45.          18.18080994   1.47      ]
 [ 45.          24.00879372   1.47      ]
 [ 45.          29.70075831   1.47      ]
 [ 45.          35.26438968   1.47      ]
 [ 45.          40.71010299   1.47      ]
 [ 45.          46.04723346   1.47      ]
 [ 45.          51.28206575   1.47      ]
 [ 45.          56.41666981   1.47      ]
 [ 45.          61.44781755   1.47      ]
 [ 45.          66.36539941   1.47      ]
 [ 45.          71.14963815   1.47      ]
 [ 45.          75.76582943   1.47      ]
 [ 45.          80.15364767   1.47      ]
 [ 45.          84.20260831   1.47      ]
 [ 45.          87.68120488   1.47      ]
 [ 49.29791035   3.06953652   1.47      ]
 [ 49.29791035  -3.06953652   1.47      ]
 [ 49.38677743  -9.17306752   1.47      ]
 [ 49.38677743   9.17306752   1.47      ]
 [ 49.5618688   15.18178714   1.47      ]
 [ 49.5618688  -15.18178714   1.47      ]
 [ 49.82011158 -21.06217068   1.47      ]
 [ 49.82011158  21.06217068   1.47      ]
 [ 50.16065351  26.80417916   1.47      ]
 [ 50.16065351 -26.80417916   1.47      ]
 [ 50.58682872 -32.41179615   1.47      ]
 [ 50.58682872  32.41179615   1.47      ]
 [ 51.10764559  37.89458326   1.47      ]
 [ 51.10764559 -37.89458326   1.47      ]
 [ 51.73950527 -43.26244646   1.47      ]
 [ 51.73950527  43.26244646   1.47      ]
 [ 52.50895971  48.52285063   1.47      ]
 [ 52.50895971 -48.52285063   1.47      ]
 [ 53.45759866 -53.67929106   1.47      ]
 [ 53.45759866  53.67929106   1.47      ]
 [ 53.56289304   0.           1.47      ]
 [ 53.6527527   -6.09089013   1.47      ]
 [ 53.6527527    6.09089013   1.47      ]
 [ 53.91900642  12.11111736   1.47      ]
 [ 53.91900642 -12.11111736   1.47      ]
 [ 54.35440662 -18.01217841   1.47      ]
 [ 54.35440662  18.01217841   1.47      ]
 [ 54.65104043  58.73011406   1.47      ]
 [ 54.65104043 -58.73011406   1.47      ]
 [ 54.95341131 -23.77296238   1.47      ]
 [ 54.95341131  23.77296238   1.47      ]
 [ 55.71698514  29.39174041   1.47      ]
 [ 55.71698514 -29.39174041   1.47      ]
 [ 56.19625323 -63.6670032    1.47      ]
 [ 56.19625323  63.6670032    1.47      ]
 [ 56.65577579  34.87601987   1.47      ]
 [ 56.65577579 -34.87601987   1.47      ]
 [ 57.79282373 -40.23544245   1.47      ]
 [ 57.79282373  40.23544245   1.47      ]
 [ 57.85139257   3.0170113    1.47      ]
 [ 57.85139257  -3.0170113    1.47      ]
 [ 58.12252814  -9.01147133   1.47      ]
 [ 58.12252814   9.01147133   1.47      ]
 [ 58.27728247  68.47240153   1.47      ]
 [ 58.27728247 -68.47240153   1.47      ]
 [ 58.65421777 -14.9011977    1.47      ]
 [ 58.65421777  14.9011977    1.47      ]
 [ 59.16729212  45.47781292   1.47      ]
 [ 59.16729212 -45.47781292   1.47      ]
 [ 59.43325343 -20.65061551   1.47      ]
 [ 59.43325343  20.65061551   1.47      ]
 [ 60.45271056  26.24983039   1.47      ]
 [ 60.45271056 -26.24983039   1.47      ]
 [ 60.8407958  -50.60695206   1.47      ]
 [ 60.8407958   50.60695206   1.47      ]
 [ 61.23623451  73.11464641   1.47      ]
 [ 61.23623451 -73.11464641   1.47      ]
 [ 61.71778157 -31.70311174   1.47      ]
 [ 61.71778157  31.70311174   1.47      ]
 [ 62.0367492    0.           1.47      ]
 [ 62.22167792  -5.92590316   1.47      ]
 [ 62.22167792   5.92590316   1.47      ]
 [ 62.76659064  11.76937527   1.47      ]
 [ 62.76659064 -11.76937527   1.47      ]
 [ 62.9086287  -55.62120718   1.47      ]
 [ 62.9086287   55.62120718   1.47      ]
 [ 63.24937448  37.01937754   1.47      ]
 [ 63.24937448 -37.01937754   1.47      ]
 [ 63.64931145 -17.47624816   1.47      ]
 [ 63.64931145  17.47624816   1.47      ]
 [ 64.84975028  23.02517483   1.47      ]
 [ 64.84975028 -23.02517483   1.47      ]
 [ 65.08772582 -42.20657626   1.47      ]
 [ 65.08772582  42.20657626   1.47      ]
 [ 65.52019096  60.51175385   1.47      ]
 [ 65.52019096 -60.51175385   1.47      ]
 [ 65.78196142 -77.53803241   1.47      ]
 [ 65.78196142  77.53803241   1.47      ]
 [ 66.2653512    2.9023498    1.47      ]
 [ 66.2653512   -2.9023498    1.47      ]
 [ 66.36056889 -28.41582338   1.47      ]
 [ 66.36056889  28.41582338   1.47      ]
 [ 66.73452357   8.65819735   1.47      ]
 [ 66.73452357  -8.65819735   1.47      ]
 [ 67.2980225  -47.26870019   1.47      ]
 [ 67.2980225   47.26870019   1.47      ]
 [ 67.64382372  14.28763204   1.47      ]
 [ 67.64382372 -14.28763204   1.47      ]
 [ 68.19252513 -33.65623199   1.47      ]
 [ 68.19252513  33.65623199   1.47      ]
 [ 68.91765626  65.25985975   1.47      ]
 [ 68.91765626 -65.25985975   1.47      ]
 [ 68.95517524 -19.7531228    1.47      ]
 [ 68.95517524  19.7531228    1.47      ]
 [ 69.98007061  52.2039386    1.47      ]
 [ 69.98007061 -52.2039386    1.47      ]
 [ 70.30452954   0.           1.47      ]
 [ 70.37763999  38.75484136   1.47      ]
 [ 70.37763999 -38.75484136   1.47      ]
 [ 70.59796341  -5.61508214   1.47      ]
 [ 70.59796341   5.61508214   1.47      ]
 [ 70.64105049  25.04791476   1.47      ]
 [ 70.64105049 -25.04791476   1.47      ]
 [ 71.4516102  -11.124716     1.47      ]
 [ 71.4516102   11.124716     1.47      ]
 [ 72.69407414  30.17930126   1.47      ]
 [ 72.69407414 -30.17930126   1.47      ]
 [ 72.80604939 -16.46805812   1.47      ]
 [ 72.80604939  16.46805812   1.47      ]
 [ 72.97308263  43.71636296   1.47      ]
 [ 72.97308263 -43.71636296   1.47      ]
 [ 73.2849971  -57.00288364   1.47      ]
 [ 73.2849971   57.00288364   1.47      ]
 [ 73.51330648  69.83188274   1.47      ]
 [ 73.51330648 -69.83188274   1.47      ]
 [ 73.63053844 -81.6400267    1.47      ]
 [ 73.63053844  81.6400267    1.47      ]
 [ 74.3957373    2.70038857   1.47      ]
 [ 74.3957373   -2.70038857   1.47      ]
 [ 74.60435832 -21.62918492   1.47      ]
 [ 74.60435832  21.62918492   1.47      ]
 [ 75.0994297    8.03442269   1.47      ]
 [ 75.0994297   -8.03442269   1.47      ]
 [ 75.13026706 -35.15709506   1.47      ]
 [ 75.13026706  35.15709506   1.47      ]
 [ 76.06777364  48.53955038   1.47      ]
 [ 76.06777364 -48.53955038   1.47      ]
 [ 76.42776576 -13.20668987   1.47      ]
 [ 76.42776576  13.20668987   1.47      ]
 [ 76.81191459  26.61516878   1.47      ]
 [ 76.81191459 -26.61516878   1.47      ]
 [ 77.44427353 -61.64591517   1.47      ]
 [ 77.44427353  61.64591517   1.47      ]
 [ 77.99089183  39.98781129   1.47      ]
 [ 77.99089183 -39.98781129   1.47      ]
 [ 78.16966379   0.           1.47      ]
 [ 78.28218758  18.18752703   1.47      ]
 [ 78.28218758 -18.18752703   1.47      ]
 [ 78.60478237  -5.07846224   1.47      ]
 [ 78.60478237   5.07846224   1.47      ]
 [ 79.42150881  31.43870375   1.47      ]
 [ 79.42150881 -31.43870375   1.47      ]
 [ 79.79355433 -53.21545998   1.47      ]
 [ 79.79355433  53.21545998   1.47      ]
 [ 79.83075479  10.01274933   1.47      ]
 [ 79.83075479 -10.01274933   1.47      ]
 [ 80.05472284 -74.16952628   1.47      ]
 [ 80.05472284  74.16952628   1.47      ]
 [ 80.5886083   22.9850347    1.47      ]
 [ 80.5886083  -22.9850347    1.47      ]
 [ 81.34571332 -44.67195851   1.47      ]
 [ 81.34571332  44.67195851   1.47      ]
 [ 81.68984707  14.75097316   1.47      ]
 [ 81.68984707 -14.75097316   1.47      ]
 [ 81.97439735  -2.34839855   1.47      ]
 [ 81.97439735   2.34839855   1.47      ]
 [ 82.45314223  36.10960472   1.47      ]
 [ 82.45314223 -36.10960472   1.47      ]
 [ 82.82085324 -66.09875172   1.47      ]
 [ 82.82085324  66.09875172   1.47      ]
 [ 83.00320676   6.9451987    1.47      ]
 [ 83.00320676  -6.9451987    1.47      ]
 [ 83.30882873 -27.61716167   1.47      ]
 [ 83.30882873  27.61716167   1.47      ]
 [ 84.049201    19.30523849   1.47      ]
 [ 84.049201   -19.30523849   1.47      ]
 [ 84.34337772 -57.72525378   1.47      ]
 [ 84.34337772  57.72525378   1.47      ]
 [ 84.81996652  11.34988901   1.47      ]
 [ 84.81996652 -11.34988901   1.47      ]
 [ 85.2073787    0.           1.47      ]
 [ 85.29910019  49.2024397    1.47      ]
 [ 85.29910019 -49.2024397    1.47      ]
 [ 85.8936229   -4.09587122   1.47      ]
 [ 85.8936229    4.09587122   1.47      ]
 [ 85.95393104  40.63141594   1.47      ]
 [ 85.95393104 -40.63141594   1.47      ]
 [ 86.43791752 -32.09871039   1.47      ]
 [ 86.43791752  32.09871039   1.47      ]
 [ 86.83000993  23.70233802   1.47      ]
 [ 86.83000993 -23.70233802   1.47      ]
 [ 87.19643507 -15.58649429   1.47      ]
 [ 87.19643507  15.58649429   1.47      ]
 [ 87.62839961   8.01881788   1.47      ]
 [ 87.62839961  -8.01881788   1.47      ]
 [ 88.35991659  -1.6394119    1.47      ]
 [ 88.35991659   1.6394119    1.47      ]
 [ 90.          85.2073787    1.47      ]
 [ 90.          78.16966379   1.47      ]
 [ 90.          70.30452954   1.47      ]
 [ 90.          62.0367492    1.47      ]
 [ 90.          53.56289304   1.47      ]
 [ 90.          45.           1.47      ]
 [ 90.          36.43710696   1.47      ]
 [ 90.          27.9632508    1.47      ]
 [ 90.          19.69547046   1.47      ]
 [ 90.          11.83033621   1.47      ]
 [ 90.           4.7926213    1.47      ]
 [ 90.           0.           1.47      ]
 [ 90.          -4.7926213    1.47      ]
 [ 90.         -11.83033621   1.47      ]
 [ 90.         -19.69547046   1.47      ]
 [ 90.         -27.9632508    1.47      ]
 [ 90.         -36.43710696   1.47      ]
 [ 90.         -45.           1.47      ]
 [ 90.         -53.56289304   1.47      ]
 [ 90.         -62.0367492    1.47      ]
 [ 90.         -70.30452954   1.47      ]
 [ 90.         -78.16966379   1.47      ]
 [ 90.         -85.2073787    1.47      ]
 [ 91.64008341  -1.6394119    1.47      ]
 [ 91.64008341   1.6394119    1.47      ]
 [ 92.37160039   8.01881788   1.47      ]
 [ 92.37160039  -8.01881788   1.47      ]
 [ 92.80356493 -15.58649429   1.47      ]
 [ 92.80356493  15.58649429   1.47      ]
 [ 93.16999007  23.70233802   1.47      ]
 [ 93.16999007 -23.70233802   1.47      ]
 [ 93.56208248 -32.09871039   1.47      ]
 [ 93.56208248  32.09871039   1.47      ]
 [ 94.04606896  40.63141594   1.47      ]
 [ 94.04606896 -40.63141594   1.47      ]
 [ 94.1063771   -4.09587122   1.47      ]
 [ 94.1063771    4.09587122   1.47      ]
 [ 94.70089981  49.2024397    1.47      ]
 [ 94.70089981 -49.2024397    1.47      ]
 [ 94.7926213    0.           1.47      ]
 [ 95.18003348  11.34988901   1.47      ]
 [ 95.18003348 -11.34988901   1.47      ]
 [ 95.65662228 -57.72525378   1.47      ]
 [ 95.65662228  57.72525378   1.47      ]
 [ 95.950799    19.30523849   1.47      ]
 [ 95.950799   -19.30523849   1.47      ]
 [ 96.69117127 -27.61716167   1.47      ]
 [ 96.69117127  27.61716167   1.47      ]
 [ 96.99679324   6.9451987    1.47      ]
 [ 96.99679324  -6.9451987    1.47      ]
 [ 97.17914676 -66.09875172   1.47      ]
 [ 97.17914676  66.09875172   1.47      ]
 [ 97.54685777  36.10960472   1.47      ]
  ecc...
2个回答

对于您已知的错误:

由于您的方位角网格是均匀分布的,因此找到包含目标方向的最近三角形并不困难。

说目标方向是(φ,ϑ). φ=[φ1,φ2,...,φM]ϑ=[ϑ1,ϑ2,...,ϑN]分别是方位角和仰角的升序排序数组。您可以使用二分搜索找到最近的方位角-仰角对(φm,ϑn)令人满意的φmφϑnϑ,另外两点应该是(φm+1,ϑn)(φm,ϑn+1). 注意在 360 处环绕的方位角.

其他需要注意的事项:

当您对 HRIR 进行插值时,您应该计算 HRIR 的最小相位部分的加权平均值。具体步骤是:去除HRIR的延迟,插值,添加通过特定插值方法计算的新延迟。

为什么要对最小相位部分执行插值,想想两个 HRIR,它们是理想的 delta 函数。

h1(t)=A1δ(t1)h2(t)=A2δ(t2), 在哪里A1A2分别是 HRIR 的幅度和t1一般不等于t2. 如果你只是求和,你会得到两个脉冲h1(t)h2(t)加上不同的权重,这显然不是我们想要的结果。

这是一篇很长的帖子,里面有很多信息,我只是给出一些高水平的反馈

  1. 松开 1.47 比例因子,只在单位球体上做所有事情。如果绝对距离/增益很重要,只需将整个 HRIR 设置缩放 1.47/1。
  2. 如果您进行三点插值,则三个点应形成一个三角形,包围您想要的点。这些不一定是最近的三个点(取决于您的网格的样子),您的结果似乎表明这不是封闭三角形的情况。
  3. 增益归一化是棘手的:在低频 HRIR 增加幅度而不是能量,即它们高度相关。

这是我会做的

  1. 将 HRIR 数据库标准化为单位球体。
  2. 找到封闭的三角形。
  3. 如果目标点“非常接近”三角形的一侧,我会做一个两点插值
  4. 将增益计算为每个顶点(三角形或线)到目标点的距离的倒数
  5. 归一化增益,使增益的总和(不是增益的平方)为单位。你有一个相当密集的 HRIR 网格,所以你会看到比不相关求和更多的相关求和。

另一种方法是 4 点插值。在两个最近的仰角处进行两个 2 点方位角插值,然后在方位角插值结果之间进行另一个 2 点仰角。这样做的好处是您可以在插值之前排列不同方位角的耳间延迟。因此,您可以分别插入耳间延迟和频谱特征。

一种完全不同的方法来处理这种类型的东西,如球谐函数。您可以通过一系列球面谐波来表示整个数据集,只需对目标位置的谐波进行加权求和即可。