i already have a 'start voice recording" when the volume reach a special level. But it has one downside. When it starts recording it already missed a 1/2 second or so. When speaking a sentence it would miss the first word.
Any ideas (best with example).
Lets say I start first listening and get the peakpower, average, lowpass
[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 look if its loud enough to record
if (peakPowerForChannel > 0.08f) ) -> start recording
and if its less than a value 开发者_如何学JAVAit stops
(peakPowerForChannel < 0.01f) -> stop record, start listening again
for now I found best is listening the peakpower, rather the average. but still its not fine. I also thought about to have a kind of tempory recording all time and when the peak is high enough I could start from now-2 seconds. Something like that, but here I dont know how to realize. So any practical suggestions are welcome.
thanks chris
Like you said, continually record a short 1/2s chunk, which expands indefinitely when the power level is reached and indefinite recording starts. When recording stops, it should include the missing 1/2s opening.
精彩评论