输入音频分析并生成特定频率输出

发布于 2024-09-27 18:35:54 字数 131 浏览 2 评论 0原文

我的目标是拥有一组频率,例如代表位(0 和 1)的 2 个频率。我想通过声卡将这些频率发送到音频输出。在另一端,我将电线连接到声卡的麦克风输入。我喜欢从其他计算机感知该信号(生成的 2 个固定频率系列)并重新形成数据。

我该怎么做?

My aim is to have a set of frequencies like 2 frequencies that represent the bits (0 and 1). I want to send those frequencies to the audio out through sound card. At the other end I connect the cord to microphone in of the sound card. I like to sense that signal (generated series of 2 fixed frequencies) from other computer and re-form the data.

How can I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫卆 2024-10-04 18:35:54

好吧,首先您必须生成两个特定频率的正弦波。基本上,您可以了解声卡的当前采样率,并生成一系列代表该采样率下特定频率的正弦波的浮点。即对于48000Hz、频率1000Hz的声卡,每个完整的正弦波(一个山峰,一个波谷)应该由48个样本组成。

请注意,您可以生成的最大频率是采样率的一半。

接下来,生成具有第二频率的第二个正弦波。确保两个频率彼此有一定的距离。一个半音的频率因子应该足以满足该因子 >= (1+1/12)

还要确保两个正弦的总和不会超过最大幅度。最简单的方法是将两个正弦限制为幅度 <= 0.5。过冲会削波信号,从而产生新的频率峰值。

在接收端,对输入信号的短时间片(大约 256-1024 个样本)进行 FFT。为了获得更好的频率分辨率,请采取重叠的切片并逐渐淡出末端,然后对频谱切片进行时间平均。在生成的频谱中,您应该清楚地看到两个发送频率处的峰值。

如果您对音频不太了解,这可能是一项非常艰巨的任务。

Well, first you have to generate two sine waves of a particular frequency. Basically, you get to know the current samplerate of your soundcard and just generate a series of floats that represent a sine wave of a certain frequency at that samplerate. I.e. for a soundcard with 48000 Hz and a frequency of 1000 Hz, each full sine wave (one hill, one trough) should consist of 48 samples.

Note that the maximum frequency you can generate is half the samplerate.

Next, you generate the second sine wave with the second frequency. Make sure that the two frequencies have a certain distance from one another. A frequency factor of one semitone should suffice for that factor >= (1+1/12).

Also make sure that the sum of both sinuses does not overshoot the max amplitude. The easiest way to do this is by limiting both sinuses to amplitudes <= 0.5. Overshooting will clip the signal, which will create new frequency peaks.

On the receiving end, do a FFT of short time slices (around 256-1024 samples) of the incoming signal. For better frequency resolution, take overlapping slices and gradually fade out the ends, then time-average the spectral slices. In the resulting spectrum you should clearly see peaks at the two sent frequencies.

If you don't know much about audio, this is probably a pretty tough task.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文