确定声音流的定向声音

Determine directional sound of sound stream

我天生单侧死亡,简而言之,就是你的一只耳朵死了。只有一只耳朵能听到,使你失去了听到声音方向和距离的能力。

我想知道是否可以在给定立体声流的情况下确定声音的方向。为简化起见,仅针对两个通道(左和右)并假设不存在背景噪声。

解决这个问题的初始策略是什么?

提前致谢。

这似乎是一个有趣的问题。 此外,由于这是一个假设场景,下面给出的解决方案/想法也是可能的,并且将取决于很多因素。

考虑到我们有一个立体声音频,使用 pydub 我们可以使用以下方法将其分成两个单声道:

AudioSegment(…).split_to_mono()
Splits a stereo AudioSegment into two, one for each channel (Left/Right). Returns a list with the new AudioSegment objects with the left channel at index 0 and the right channel at index 1.

然后我们可以使用

找出哪个频道最响亮

AudioSegment(…).split_to_mono()
Splits a stereo AudioSegment into two, one for each channel (Left/Right). Returns a list with the new AudioSegment objects with the left channel at index 0 and the right channel at index 1.

然后我们使用以下方法测量每个声道的响度:

AudioSegment(…).rms A measure of loudness. Used to compute dBFS, which is what you should use in most cases. Loudness is logarithmic (rms is not), which makes dB a much more natural scale.

所以为了测试,我使用了一个立体声音乐波形文件并将其分成两个单声道并检查其响度以查看哪个声道最响亮。

from pydub import AudioSegment
sound = AudioSegment.from_file("audio.wav")
split_sound = sound.split_to_mono()

left_loudness = split_sound[0].rms
right_loudness = split_sound[1].rms

输出

>>> left_loudness
7030
>>> right_loudness
6993
>>>