필터 지우기
필터 지우기

nth frame to time

조회 수: 6 (최근 30일)
Kayacan CITAK
Kayacan CITAK 2022년 7월 25일
편집: Akshat 2023년 8월 31일
I wanna find in the audio recording, how many seconds does it correspond to the frame. How can i do that?
  댓글 수: 1
dpb
dpb 2022년 7월 25일
Do you know the sampling rate? If so, it's trivial; if not, you're stuck. 44.1kHz is a fairly common rate, but not the only one.

댓글을 달려면 로그인하십시오.

답변 (1개)

Akshat
Akshat 2023년 8월 31일
편집: Akshat 2023년 8월 31일
Hi Kayacan,
I understand that you would like to find out the timestamp of a frame number you have. You can do this with the help of sampling rate of audio clip.
The sample rate can be found out using the “audioread” function (https://in.mathworks.com/help/matlab/ref/audioread.html#btiabil-1-Fs , the variable "Fs" gives us the sampling rate).
Once you have the sampling rate in the variable “Fs”, you can simply multiply the inverse of this with “n” which is your frame number. The math behind this is that every second has “Fs” number of frames. Thus, every frame is lasting 1/Fs seconds. Multiply this by “n” and you get the frame timestamp.
I have done the same with a sample audio file (change the 'test.wav' inside audioread to the name of your audio file), and here is the code I used for the same:
[y, Fs] = audioread('test.wav');
n = 1024; % frame number
sampleDuration = 1 / Fs; % Duration of each sample in seconds
timeStamp = n* sampleDuration; % Time stamp
I hope it helps!

카테고리

Help CenterFile Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by