8bit采样声音数据的音量计算
2013-05-16 17:01
369 查看
float calcSoundVol(IN void * pBuf, int nlen){ // 计算该采样率下的最大值 float maxVol=pow(2.0f,sampleBits-1)-1; switch(sampleBits) { case 8: // 该例子只处理8bit采样的情况 { float resultVol = 0.0f; // 该例子只有一个声道 if(nChannels == 1) { for(int i=0;i<nlen;i++) { float sampleVol = fabs(*(char*)pBuffer); if(sampleVol>-maxVol && sampleVol<maxVol && value > resultVol) resultVol = value; } printf("Volume=%.2f\n", resultVol/maxVol*100.0f); } }break; } }
相关文章推荐
- 获取mp4文件信息3 - 计算电影声音采样频率
- 控制数据采样分布 计算概念
- DoubleUtils:double数据计算的工具类,避免精度丢失
- 大数据运算系统(2)--- 图计算系统
- 不需要sql进行计算数据的平均值、最大值、最小值、和
- 画出wav文件声音数据的波形曲线
- OWI监控和收集方法——利用PL/SQL过程进行性能数据采样(2)
- 什么是阿里云数加大数据计算服务MaxCompute?
- 定位排查工作流的计算结果数据量不符合预期的方法
- 大数据实时计算工程师/Hadoop工程师/数据分析师职业路线图
- 大数据计算框架Hadoop, Spark和MPI
- 大数据n!(n的阶乘)计算方法讨论
- Python 网页爬虫 & 文本处理 & 科学计算 & 机器学习 & 数据挖掘兵器谱 - 数客
- 结合谷歌地图多边形(polygon)与Sql Server 2008的空间数据类型计算某个点是否在多边形内的注意事项
- MATLAB数值计算与数据分析(3)
- 深度学习座下的四大神兽:计算能力、算法、数据、场景
- numpy.mean和numpy.random.multivariate_normal(依据均值和协方差生成数据,提醒:计算协方差别忘了转置)
- 输入一个int型数据,计算出它在内存中存储时含1的个数
- 计算unsigned int型数据二进制形式中1出现的次数
- Java 各数据类型计算的精度问题