-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsaltafoss.m
166 lines (131 loc) · 3.21 KB
/
saltafoss.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
%% Saltafoss
% Desciption: This code visualizes audio files in 3D graphs and saves a
% .tiff image
% Author: Jérôme Roy
% Date: 25.01.23
% Update: 08.02.23
clc
clear all
[filename, pathname] = uigetfile('*.*'); %change the extension for other file formats
fullpath = fullfile(pathname, filename);
data = importdata(fullpath);
[y, Fs] = audioread(filename);
y = mean(y,2); % convert stereo to mono
[p,f,t] = pspectrum(y,Fs,'spectrogram');
a = sqrt(p.*f*3);
%figure;
%waterfall(f,t,10*log10(p.'));
obj = waterfall(f,t,a.');
%set(gca,'XScale','log')
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view([40 30]);
%}
scrsz = get(0,'ScreenSize');
set(gcf, 'Position', [1 1 scrsz(3) scrsz(4)])
imgfilename = [filename(1:end-4) '_persp' '.tiff'];
print(imgfilename, '-dtiff', '-r600');
% Logaritmic
figure();
subplot(231)
copyobj(obj,gca)
set(gca,'XScale','log')
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view(90,0)
subplot(232)
copyobj(obj,gca)
set(gca,'XScale','log')
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view(-35,30)
subplot(233)
copyobj(obj,gca)
set(gca,'XScale','log')
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view(30,45)
subplot(234)
copyobj(obj,gca)
set(gca,'XScale','log')
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view(0,90)
subplot(235)
copyobj(obj,gca)
set(gca,'XScale','log')
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view(0,0)
subplot(236)
copyobj(obj,gca)
set(gca,'XScale','log')
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view(125,45)
scrsz = get(0,'ScreenSize');
set(gcf, 'Position', [1 1 scrsz(3) scrsz(4)])
imgfilename = [filename(1:end-4) '_log' '.tiff'];
print(imgfilename, '-dtiff', '-r600');
% Linear
figure();
subplot(231)
copyobj(obj,gca)
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view(90,0)
subplot(232)
copyobj(obj,gca)
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view(-35,30)
subplot(233)
copyobj(obj,gca)
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view(30,45)
subplot(234)
copyobj(obj,gca)
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view(0,90)
subplot(235)
copyobj(obj,gca)
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view(0,0)
subplot(236)
copyobj(obj,gca)
xlabel('Frequency (Hz)');
ylabel('Time (seconds)');
%zlabel('Power Spectral Density (dB)');
zlabel('Amplitude');
view(125,45)
scrsz = get(0,'ScreenSize');
set(gcf, 'Position', [1 1 scrsz(3) scrsz(4)])
imgfilename = [filename(1:end-4) '_lin' '.tiff'];
print(imgfilename, '-dtiff', '-r600');