IPhone launches voice recording

I already have an “initial voice recording” when the volume reaches a special level. But he has one drawback. When he starts recording, he already missed 1/2 second or so. Speaking a sentence, he will miss the first word.

Any ideas (best example).

Suppose I start listening and getting maximum power first, medium, low

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

than I'm watching, is it loud enough to record

 if (peakPowerForChannel > 0.08f) ) -> start recording

and if its value is less than the value

  (peakPowerForChannel < 0.01f) -> stop record, start listening again

, , . . , , , - 2 . - , , . .

chris

+3
1

, 1/2s, , . , 1/2s.

0

Source: https://habr.com/ru/post/1757404/


All Articles