forked from ruixv/DSP_CourseDesign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpractice6.m
44 lines (44 loc) · 938 Bytes
/
practice6.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
% global I1
load('mtlb.mat')
y = mtlb;
sound(y,Fs);
y1 = y(:,1);
size_self = floor(sqrt(length(y)));
image_audio = zeros(size_self,size_self);
min_y1 = min(y1);
y2 = 40*(y1- min_y1);
y2 = uint8(y2);
for Li=1:1:size_self
for Lj=1:1:size_self
% image_audio(Li,Lj) = floor((y2((Li-1)*size_self +Lj)));
image_audio(Li,Lj) = (y2((Li-1)*size_self +Lj));
end
end
image_audio = uint8(image_audio);
% subplot(121)
image_audio = histeq(image_audio);
% imshow(image_audio)
% title('mtlb')
% subplot(122)
% imhist(image_audio);
I1 = image_audio;
title('mtlbµÄÖ±·½Í¼')
I1 = image_audio;
X = I1;
Fs = 8000;
X = double(X);
X = (X-39.3)/200;
% X = rgb2gray(X);
% X = double(X);
[m n] = size(X);
music = zeros(m*n,1);
for Li = 1:1:m
for Lj = 1:1:n
music((Li-1)*n+Lj) = X(Li,Lj);
end
end
x = (1:1:63*63)/Fs;
plot(x,music)
xlabel('ʱ¼ä/s')
ylabel('·ù¶È')
% sound(music,Fs);