如何跟踪 .wav 文件中的无声区? [英] How to track no-sound area in a .wav file?

查看:27
本文介绍了如何跟踪 .wav 文件中的无声区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 wav 文件中跟踪没有声音的部分?

How to track sections without sounds in a wav file?

我想开发的一个小软件是分割一个wav文件,它以一个没有音量的区域作为分割点.

A small software that I want to develop is dividing a wav file, and it consider a no volume area as a dividing point.

程序如何知道 wav 文件的音量很小?我将使用 Java 或 MFC.

How can a program know that volume of a wav file is low? I'll use Java or MFC.

推荐答案

我通过计算信号的 RMS 成功地进行了静音检测.这是通过以下方式完成的(假设您有一组音频样本):

I've had success with silence detection by calculating RMS of the signal. This is done in the following manner (assuming you have an array of audio samples):

    long sumOfSquares = 0;
    for (int i = startindex; i <= endindex; i++) {
        sumOfSquares = sumOfSquares + samples[i] * samples[i];
    }
    int numberOfSamples = endindex - startindex + 1;
    long rms = Math.sqrt(sumOfSquares / (numberOfSamples));

如果 rms 低于某个阈值,您可以认为它是静默的.

if rms is below a certain threshold, you can consider it being silent.

这篇关于如何跟踪 .wav 文件中的无声区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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