Dump libasound 音频数据

本文介绍了QNX操作系统下两种记录声卡PCM数据的方法:使用pcm_logger工具和通过设置PLAYBACK_LOGGING及CAPTURE_LOGGING环境变量。pcm_logger通过-l参数开启和关闭录音,数据保存在/dev/shmem。另一种方法涉及在PCM数据处理前(unprocessed)和后(processed)进行日志,文件名遵循特定格式,并指出如果在播放/捕获完成前终止,可能会导致记录的PCM数据文件无法在某些媒体应用中播放。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

QNX有如下两种方法dump pcm数据,可以录声卡之前的数据

1,

QNX自带的pcm_logger工具

工具位置:

qnx\qnx-sdp\target\qnx7\aarch64le\usr\bin\pcm_logger

//打开pcm dump

pcm_logger -l1

//关闭 pcm dump

pcm_logger -l0

数据保存到/dev/shmem

2,
This is how it has been tested:

-- To enable logging use the PLAYBACK_LOGGING and CAPTURE_LOGGING environment variables.
-- To log PCM data before it runs through the libasound conversion plugins assign a value of 'unprocessed' to the environment variable.
-- To log PCM data after it has run through the libasound conversion plugins assign a value of 'processed' to the environment variables.

Examples:
PLAYBACK_LOGGING=processed wave /myfile.wav
PLAYBACK_LOGGING=unprocessed wave /myfile.wav
CAPTURE_LOGGING=processed waverec -t5 /tmp/myfile.wav
CAPTURE_LOGGING=unprocessed waverec -t5 /tmp/myfile.wav


-- Logged PCM data files will be created under /dev/shmem with the following filename convention: direction_pid_processed/unprocessed_YYYYMMDD-HHmmssUTC.wav

Example: /dev/shmem/playback_1928374_processed_20120613-093433UTC.wav

Note that the length fields in the wave header are filled in when the client calls snd_pcm_close(), so if the client terminates without calling close those lengths will not be filled in and the logged file may not be playable by some media applications. In other words, please wait for the playback/capture to complete and do not terminate in between. Otherwise the PCM data captured file may not be playable on some media players.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值