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

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

问题描述

我有一个矢量化的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输入所需的值)格式化和/或缩放值的正确方法是什么,以使音频本身在收听时不会因缩放因子而失真,除了保留采样率之外?还是在全局图中我缺少其他?

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套接字库,将一个字符的音频字符串数组char逐个发送到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天全站免登陆