简体   繁体   English

如何在Android中收到Audiorecord的硬件时间戳?

[英]How can I receive the Hardware Timestamp of Audiorecord in Android?

I need to retrieve the timestamp of when the AudioRecord class does a read of a buffer. 我需要检索AudioRecord class读取缓冲区的时间戳。 I need to keep track of the time in milliseconds. 我需要以毫秒为单位跟踪时间。 I have tried to add a timestamp retrieve after I read the buffer, however when I receive the next buffer, the amount of time it takes to retrieve it can fluctuate a lot. 我尝试在读取缓冲区后添加时间戳检索,但是当我收到下一个缓冲区时,检索它所需的时间可能会波动很多。 Is there a way from a callback to receive the time that the audio was recorded? 回调是否有办法接收录制音频的时间?

int bufferReadResult = audioRecord.read(buffer, 0,blockSize);
            long startTime = System.nanoTime()/ 1000; 

is what I am currently trying. 是我目前正在尝试的。

Audio is sampled realtime by local oscillator. 音频由本地振荡器实时采样。 A chunk is sent to you as soon as the operative system has free time to send it to you. 只要操作系统有空闲时间将一个块发送给您,就会向您发送一个块。 I'm not sure, but i think that you can't get the absolute time of the aquired signal. 我不确定,但我认为你无法获得获得信号的绝对时间。 What you can do is to count the samples between 2 events on the recorded audio signal, and get the precise elapsed time, by counting the samples and knowing the sample frequency. 您可以做的是对记录的音频信号上的2个事件之间的样本进行计数,并通过计算样本并了解采样频率来获得精确的经过时间。 Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何判断android AudioRecord read()方法何时发生溢出? - How can I tell when android AudioRecord read() method encounters an overflow? 我可以在AIDE IDE应用程序上使用Android Audiorecord吗? - Can I use Android Audiorecord with AIDE IDE app? 为什么我不能在Android上播放用AudioRecord录制的音频? - Why can not I play an audio recorded with AudioRecord on Android? Android - 我可以使用MediaRecord / MediaPlayer而不是AudioRecord / Track吗? - Android - Can I do this with MediaRecord/MediaPlayer instead of AudioRecord/Track? AudioRecord:如何使用公共缓冲区将其用于处理和存储? - AudioRecord : How can I use a common buffer to use it for processing and storing? 如何更好地区分Android硬件以进行错误跟踪? - How can I better differentiate between Android hardware for bug tracking? 如何判断我的Android相机上的闪存硬件是否已打开? - How can I tell if the flash hardware is open on my android camera? 如何在 Android 应用中获取硬件信息 - How I can get Hardware Information in Android app Android:如何使用 adb 命令获取设备硬件信息? - Android: How can I get device hardware information with adb command? 如何在Android上接收多播消息? - How can I receive Multicast messages on Android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM