2

良い一日!ユーザーの通常の声を検出するために、コードと条件内にどの値を入力する必要があるかを尋ねたいだけです。音声を検出した後、自動的に録音し、次の場合に録音を停止しますサイレント/レコーダーは音声を検出しませんでした。これは私のコードであり、ユーザーがマイクに息を吹きかけたときにそれを検出して取得します。

- (void)levelTimerCallback:(NSTimer *)timer {
    [recorder updateMeters];

    const double ALPHA = 0.05;
    double peakPowerForChannel = pow(10, (0.05 * [recorder peakPowerForChannel:0]));
    lowPassResults = ALPHA * peakPowerForChannel + (1.0 - ALPHA) * lowPassResults;  

    [recorder record];
    if (lowPassResults < 0.95)
        {NSLog(@"Recording");
             [recorder record];}

}

私は目的cが初めてです。どんな助けも私にとって非常に役に立ちます...前もって感謝します。

4

1 に答える 1

1

There is no set level you can use to detect the volume of normal speech. Leaving aside issues of background noise and so on, There is no standard translation between audio levels as numbers in a computer and sound levels in the air.

Think about it: what are the input levels? What type of mike is it? How far away is the user? You don't know any of these things, so there's no way to know the answer.

You might want to think about looking for relative change in volume, rather than absolute level (although this is iffy as well) or a different user experience entirely.

于 2012-08-02T22:25:09.530 に答える