필터 지우기
필터 지우기

Assigning time on x axis for audio samples

조회 수: 1 (최근 30일)
Sonia Wiemann
Sonia Wiemann 2012년 4월 8일
Hello,
I have audio samples and I know the sampling rate (44.1KHz per sec)) I also have loads of samples of varying lengths(titled calla etc). Is there a way for me to assign time in msec on the x axis in a way that I do not have to customize for each sample length?
Thanks! Sonia

답변 (1개)

Wayne King
Wayne King 2012년 4월 8일
You can create a time vector for your longest recording and then use subsets for a particular vector.
If N is the length of the longest:
Fs = 44.1e3;
t = 0:1/Fs:(N*1/Fs)-1/Fs;
Then for a particular vector, say x:
L = length(x);
tx = t(1:L);
  댓글 수: 1
Sonia Wiemann
Sonia Wiemann 2012년 4월 16일
I am very new to matlab so I am very likely doing something wrong. Every time I try to use this code I get a message that says "index exceeds matrix dimensions. maybe I should start with a more basic question.

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

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by