フィルターのクリア

I want use function tfrsp of my sound from microphone

8 ビュー (過去 30 日間)
matija corak
matija corak 2015 年 2 月 1 日
コメント済み: Star Strider 2015 年 2 月 1 日
Hello. I have problem with function tfrsp. I want to use that function for spectrogram of sound. I can get the spectrogram of regular signal. This is the only thing what I can get from help tfrsp
tfrsp Spectrogram time-frequency distribution.
[TFR,T,F]=tfrsp(X,T,N,H,TRACE) computes the Spectrogram
distribution of a discrete-time signal X.
X : signal.
T : time instant(s) (default : 1:length(X)).
N : number of frequency bins (default : length(X)).
H : analysis window, H being normalized so as to
be of unit energy. (default : Hamming(N/4)).
TRACE : if nonzero, the progression of the algorithm is shown
(default : 0).
TFR : time-frequency representation. When called without
output arguments, tfrsp runs TFRQVIEW.
F : vector of normalized frequencies.
Example :
sig=fmlin(128,0.1,0.4);
h=tftb_window(17,'Kaiser'); tfrsp(sig,1:128,64,h,1);
[tfr,t,freq]=tfrsp(sig,1:128,64,h,1); plot(fftshift(freq),fftshift(tfr(:,100)))
When I try to use some sound what I took from my microphone example:
sig=audiorecorder;
record(sig);
stop(sig);
play(sig);
h=tftb_window(17,'rect');
[tfr,t,f]=tfrsp(sig,1:128,64,h,1);
Spectrogram
Undefined function 'times' for input arguments of type 'audiorecorder'.
Error in tfrsp (line 87)
tfr(indices,icol)=x(ti+tau).*conj(h(Lh+1+tau))/norm(h(Lh+1+tau));
>>or if I change time [tfr,t,f]=tfrsp(sig,1:length(sig),64,h,1);
Spectrogram
100 % complete in 0 seconds.
Undefined function 'times' for input arguments of type 'audiorecorder'.
Error in tfrsp (line 87)
tfr(indices,icol)=x(ti+tau).*conj(h(Lh+1+tau))/norm(h(Lh+1+tau));
thanks in advance.

採用された回答

Star Strider
Star Strider 2015 年 2 月 1 日
編集済み: Star Strider 2015 年 2 月 1 日
I am not certain what you are doing, but if you want to get your recorded sound as numeric array, you have to use the getaudiodata function.
This works:
Fs = 1E+4;
nBits = 24;
nChannels = 2;
sig = audiorecorder(Fs, nBits, nChannels);
recordblocking(sig,5);
sigsound = getaudiodata(sig);
t = linspace(0, size(sigsound,1), size(sigsound,1))/Fs;
figure(1)
plot(t, sigsound)
grid
xlabel('Time (s)')
ylabel('Amplitude (kPa)')
It plots the amplitude as a function of time, not the spectrogram, but it illustrates the idea.
I cannot find any information on ‘tfrsp’. It is not in the online documentation, and I cannot find it in the File Exchange, so I cannot help you with it. (I have the Signal Processing Toolbox, that has the spectrogram function.)
Also, be certain that your microphone is turned on! In Windows machines, go to Control Panel > Sound to be sure.
  2 件のコメント
matija corak
matija corak 2015 年 2 月 1 日
Thanks
Star Strider
Star Strider 2015 年 2 月 1 日
My pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by