如何在iOS中录制语音时以编程方式生成音频波形?
我正在研究iOS中的语音调制音频...一切正常......只需要一些最简单的方法就可以在检测噪声上生成音频波形...
请不要参考我的代码教程... speakhere和auriotouch ...我需要一些来自本机应用程序开发人员的最佳建议.
我录制了音频,录制后我播放了它.我创建了波形和附加截图.但它必须在视图中被描绘为录音正在进行中
-(UIImage *) audioImageGraph:(SInt16 *) samples
normalizeMax:(SInt16) normalizeMax
sampleCount:(NSInteger) sampleCount
channelCount:(NSInteger) channelCount
imageHeight:(float) imageHeight {
CGSize imageSize = CGSizeMake(sampleCount, imageHeight);
UIGraphicsBeginImageContext(imageSize);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor blackColor].CGColor);
CGContextSetAlpha(context,1.0);
CGRect rect;
rect.size = imageSize;
rect.origin.x = 0;
rect.origin.y = 0;
CGColorRef leftcolor = [[UIColor whiteColor] CGColor];
CGColorRef rightcolor = [[UIColor redColor] CGColor];
CGContextFillRect(context, rect);
CGContextSetLineWidth(context, 1.0);
float halfGraphHeight = (imageHeight / 2) / (float) channelCount ;
float centerLeft = halfGraphHeight;
float centerRight = (halfGraphHeight*3) ; …
Run Code Online (Sandbox Code Playgroud)