美文网首页
创建AVAudioPCMBuffer

创建AVAudioPCMBuffer

作者: 丶信步沧桑 | 来源:发表于2019-03-25 09:57 被阅读0次
    
        _audioFormat = [[AVAudioFormat alloc] initWithCommonFormat:AVAudioPCMFormatInt16 sampleRate:16000 channels:1 interleaved:false];
    
        NSData *data = [NSData dataWithContentsOfFile:@""]
    
        AVAudioPCMBuffer *pcmBuffer = [[AVAudioPCMBuffer alloc] initWithPCMFormat:_audioFormat frameCapacity:(uint32_t)(data.length) / _audioFormat.streamDescription->mBytesPerFrame];
        
        pcmBuffer.frameLength = pcmBuffer.frameCapacity;
        
        [data getBytes:*pcmBuffer.int16ChannelData length:data.length];

    相关文章

      网友评论

          本文标题:创建AVAudioPCMBuffer

          本文链接:https://www.haomeiwen.com/subject/nwnmvqtx.html