forked from CarmineCella/nanoscat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.m
36 lines (25 loc) · 760 Bytes
/
demo.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
% nanoscat demo, (c) 2015 carmine e. cella
%
% basic pedagogical implementation of scattering transform for 1D signals
% (dyadic wavelets only)
%
addpath ('lib');
%% params
M = 2; % orders
J = 11; % maximal scale
%% load and zero pad audio
[sig, N, len] = nanoscat_load ('samples/drum1_90.wav');
sig = sig / norm(sig); % normalization
assert (J < log2(N));
%% compute filters
[psi, phi, lp] = nanoscat_make_filters (N, J, 'gaussian');
%% plot filters
nanoscat_display_filters (psi, phi, lp);
%% compute scattering
[S, U] = nanoscat_compute (sig, psi, phi, M);
%% format and plot S coefficients
scat = nanoscat_format (S, [1:M+1]); % creates a matrix with all coefficients
figure
imagesc (scat);
title ('Scattering coefficients (all orders)');
% eof