数字音频格式 [英] Digital audio formatting

查看:28
本文介绍了数字音频格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个矢量化的 wav 文件,其值在 -1 到 1 之间,88,200 个样本,44.1 kHz 采样率,可以在两秒内听到音频.我想通过蓝牙将音频发送到蓝牙模块、arduino、DAC 和带耳塞的 3.5 毫米分线板.

I have a vectorized wav file with values between -1 and 1, 88,200 samples, 44.1 kHz sampling rate to hear the audio within two seconds. I'd like to send the audio through bluetooth to a bluetooth module, arduino, DAC, and 3.5mm breakout board with earbuds.

当我最后收到它时,我听到了噼啪声.我试图重新创建这是 MATLAB,结果证明它是缩放(乘以 + 将值移到 0 以上)和由于接收器引起的采样率变化的组合.当然,我可以用低效的 Arduino 代码完全计算采样频率,但由于一个因素也是初始缩放,我的猜测是我误解了音频处理的基本原理.

I am getting crackly audio when I receive it at the end. I tried to recreate this is MATLAB and it turns out to be a combination of the scaling (multiplying + shifting the values over 0) and the sampling rate change due to the receivers. Of course, I could be completely recking the sampling frequency with inefficient Arduino code, but since a factor is also the initial scaling my guess is that I am misunderstanding something fundamental to audio processing.

在 0-4095(DAC 输入所需)之间格式化和/或缩放值的正确方法是什么,以便音频本身在聆听时不会失真由于缩放因子/em>,除了采样率保留?还是我在这方面的大局中遗漏了其他?

What is the proper way to format and or scale the values between 0-4095 (which are needed for the DAC input) so that the audio itself is not distorted upon listening due to the scaling factor, sampling rate retention aside? OR is there something else I am missing in the big picture of this?

澄清:目前我正在使用 python 套接字库将音频字符串数组按字符发送到 Arduino 数组并将它们作为整数读取,然后输入到 DAC.不确定 python 套接字是否是最好的方法,应该有更好或更健壮的套接字实现来发送数据

Clarification: Currently I am using the python sockets library to send an audio string array char by char into an Arduino array and reading them as an integers, then inputting into the DAC. Not sure if python sockets is the best way to go, there should be something better or a more robust implementation of sockets to send the data

更新:我意识到 HC-05 使用 SPP 蓝牙协议,它的分辨率似乎太低,无法发送可靠的音频.我会看看是否可以发送压缩程度更高的音频文件,将其存储在 arduino 中,然后输出到 DAC.这可以提供更可靠的音频.

UPDATE: I realized that the HC-05 uses SPP bluetooth protocol, which seems to be waaay too low resolution to send reliable audio. I will see if I can send a more compressed audio file, store it in the arduino, then output to the DAC. That could provide more reliable audio.

推荐答案

图书馆有一个关于带宽的例子:https://www.arduino.cc/en/Reference/AudioFrequencyMeter

The library has an example for bandwidth: https://www.arduino.cc/en/Reference/AudioFrequencyMeter

但是 begin() 和 end() 还有其他函数.您可以将它们声明为样本中开始和结束时间的变量,这样一个将成为给定时间的活动轨道.您还可以将您的 frequency() 声明为 44.1 的常量值,但您可能必须为此转义句点.(否则为 60 到 1500.)

But there are other functions for begin() and end(). You could declare them as variable to your start and end times within the samples, such that one will be the active track at a given time. You could also declare your frequency() as a constant value of 44.1, but you might have to escape the period for that. (It otherwise reads 60 to 1500.)

这篇关于数字音频格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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