webrtc audioprocess 分析
2015-06-15 23:50
260 查看
webrtc audioprocess 简称 apm是:
// The Audio Processing Module (APM) provides a collection of voice processing
// components designed for real-time communications software.
这里说了 apm是一个用于实时音频处理的组件
APM accepts only 16-bit linear PCM audio data in frames of 10 ms. Multiple channels should be interleaved.
这里说的很清楚 apm仅仅接受16bit的10毫秒每帧的pcm音频数据
// Usage example, omitting error checking:
// AudioProcessing* apm = AudioProcessing::Create(0);
//
// apm->high_pass_filter()->Enable(true);
//
// apm->echo_cancellation()->enable_drift_compensation(false);
// apm->echo_cancellation()->Enable(true);
//
// apm->noise_reduction()->set_level(kHighSuppression);
// apm->noise_reduction()->Enable(true);
//
// apm->gain_control()->set_analog_level_limits(0, 255);
// apm->gain_control()->set_mode(kAdaptiveAnalog);
// apm->gain_control()->Enable(true);
//
// apm->voice_detection()->Enable(true);
//
// // Start a voice call...
//
// // ... Render frame arrives bound for the audio HAL ...
// apm->AnalyzeReverseStream(render_frame);
//
// // ... Capture frame arrives from the audio HAL ...
// // Call required set_stream_ functions.
// apm->set_stream_delay_ms(delay_ms);
// apm->gain_control()->set_stream_analog_level(analog_level);
//
// apm->ProcessStream(capture_frame);
//
// // Call required stream_ functions.
// analog_level = apm->gain_control()->stream_analog_level();
// has_voice = apm->stream_has_voice();
//
// // Repeate render and capture processing for the duration of the call...
// // Start a new call...
// apm->Initialize();
//
// // Close the application...
// delete apm;
//
// DEPRECATED: It is now possible to modify the sample rate directly in a call
// to |ProcessStream|.
// Sets the sample |rate| in Hz for both the primary and reverse audio
// streams. 8000, 16000 or 32000 Hz are permitted.
这里有说 目前支持 8000 16000 32000hz采样率的音频
// Processes a 10 ms |frame| of the primary audio stream. On the client-side,
// this is the near-end (or captured) audio.
//
// If needed for enabled functionality, any function with the set_stream_ tag
// must be called prior to processing the current frame. Any getter function
// with the stream_ tag which is needed should be called after processing.
//
// The |sample_rate_hz_|, |num_channels_|, and |samples_per_channel_|
// members of |frame| must be valid. If changed from the previous call to this
// method, it will trigger an initialization.
这里说的很清楚:调用此processstream之前必须要至少设置3个参数 第一个是:
sample_rate_hz_ = 32000
num_channels_ =2
samples_per_channel_ = 320
virtual int ProcessStream(AudioFrame* frame) = 0;
后续文章继续追加
// The Audio Processing Module (APM) provides a collection of voice processing
// components designed for real-time communications software.
这里说了 apm是一个用于实时音频处理的组件
APM accepts only 16-bit linear PCM audio data in frames of 10 ms. Multiple channels should be interleaved.
这里说的很清楚 apm仅仅接受16bit的10毫秒每帧的pcm音频数据
// Usage example, omitting error checking:
// AudioProcessing* apm = AudioProcessing::Create(0);
//
// apm->high_pass_filter()->Enable(true);
//
// apm->echo_cancellation()->enable_drift_compensation(false);
// apm->echo_cancellation()->Enable(true);
//
// apm->noise_reduction()->set_level(kHighSuppression);
// apm->noise_reduction()->Enable(true);
//
// apm->gain_control()->set_analog_level_limits(0, 255);
// apm->gain_control()->set_mode(kAdaptiveAnalog);
// apm->gain_control()->Enable(true);
//
// apm->voice_detection()->Enable(true);
//
// // Start a voice call...
//
// // ... Render frame arrives bound for the audio HAL ...
// apm->AnalyzeReverseStream(render_frame);
//
// // ... Capture frame arrives from the audio HAL ...
// // Call required set_stream_ functions.
// apm->set_stream_delay_ms(delay_ms);
// apm->gain_control()->set_stream_analog_level(analog_level);
//
// apm->ProcessStream(capture_frame);
//
// // Call required stream_ functions.
// analog_level = apm->gain_control()->stream_analog_level();
// has_voice = apm->stream_has_voice();
//
// // Repeate render and capture processing for the duration of the call...
// // Start a new call...
// apm->Initialize();
//
// // Close the application...
// delete apm;
//
// DEPRECATED: It is now possible to modify the sample rate directly in a call
// to |ProcessStream|.
// Sets the sample |rate| in Hz for both the primary and reverse audio
// streams. 8000, 16000 or 32000 Hz are permitted.
这里有说 目前支持 8000 16000 32000hz采样率的音频
// Processes a 10 ms |frame| of the primary audio stream. On the client-side,
// this is the near-end (or captured) audio.
//
// If needed for enabled functionality, any function with the set_stream_ tag
// must be called prior to processing the current frame. Any getter function
// with the stream_ tag which is needed should be called after processing.
//
// The |sample_rate_hz_|, |num_channels_|, and |samples_per_channel_|
// members of |frame| must be valid. If changed from the previous call to this
// method, it will trigger an initialization.
这里说的很清楚:调用此processstream之前必须要至少设置3个参数 第一个是:
sample_rate_hz_ = 32000
num_channels_ =2
samples_per_channel_ = 320
virtual int ProcessStream(AudioFrame* frame) = 0;
后续文章继续追加
相关文章推荐
- Linode Centos6.5从零开始装环境...流水账
- Linux之安装Ubuntu
- Linux下常用命令
- Nginx 301重定向域名
- hadoop集群搭建笔记
- hadoop的伪分布式安装(详细)
- linux笔记整理(cent os)
- hat linux下vnc的安装
- Apache Qpid 高可用集群
- 总结shell
- linux并发连接数查看
- 查找依赖结构有个不错的网站(备忘)
- linux netstat 统计查看外部连接数
- HDU1195---Open the Lock
- FreeBSD上构架Nginx服务器
- Linux下Squid正向/反向代理配置
- 一个国外的ios学习网站
- CentOS安装\卸载 apache、mysql、php
- Linux-Nginx-Rewrite规则-1
- linux 的文件系统(2)