721
edits
Line 39: | Line 39: | ||
This is a code snippet that illustrates how to search for the peak in a block of audio samples: | This is a code snippet that illustrates how to search for the peak in a block of audio samples: | ||
<syntaxhighlight lang="c++"> | <syntaxhighlight lang="c++"> | ||
float getPeakOfBlock(){ | |||
float peak=0; | float peak=0; | ||
// imagine that the audio block and its length (n_smps) is given to you | // imagine that the audio block and its length (n_smps) is given to you | ||
Line 46: | Line 47: | ||
// is greater then we seen so far | // is greater then we seen so far | ||
peak = block[i]; | peak = block[i]; | ||
} | } | ||
} | |||
return peak; | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |