comparison toolboxes/MIRtoolbox1.3.2/MIRToolboxDemos/demo7tonality.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function demo7tonality
2 %To get familiar with some approaches of tonal analysis using MIRtoolbox,
3 % and to assess their performances.
4
5 % Part 1. We will first investigate the performance of the chromagram
6 % analysis, using very simple musical samples.
7
8 % 1.3. In the audio file ÔtrumpetÕ, the same pitch is played by a trumpet.
9 % Compute its chromagram. What are the chromas detected by the function?
10 % Can you explain the result?
11 mirchromagram('trumpet')
12
13 % 1.4. A more detailed representation of the chromagram can be obtained by
14 % decomposing each pitch class into its different possible absolute values.
15 % For that purpose, just add the parameter:
16 c = mirchromagram('trumpet','Wrap',0)
17
18 % 1.5. Compute also the key strength related to the chromagram.
19 mirkeystrength(c)
20
21 pause, close all
22
23 % 1.6. In the audio file ÔpianoF4Õ, the same pitch is played by a piano.
24 [ks c] = mirkeystrength('pianoF4')
25
26 a = miraudio('pianoF4','excerpt',.7,2);
27 [ks c] = mirkeystrength(a)
28
29 pause, close all
30
31 % 1.7. Investigate the chromagram analysis of triad chords
32 [ks c] = mirkeystrength('Amin3')
33 p = mirpeaks(ks)
34 mirkey(p)
35
36 pause, close all
37
38 [k kc ks] = mirkey('Amaj3')
39 [k kc ks] = mirkey('Amin4')
40 [k kc ks] = mirkey('Amaj4')
41
42 pause, close all
43
44 [k kc ks] = mirkey('Amin5')
45 [k kc ks] = mirkey('Amaj5')
46 [k kc ks] = mirkey('Cmaj')
47
48 pause, close all
49
50 [k kc ks] = mirkey(miraudio('Amin3','Excerpt',.2,1))
51 [k kc ks] = mirkey(miraudio('Amin4','Excerpt',.2,1))
52 [k kc ks] = mirkey(miraudio('Amaj3','Excerpt',.2,1))
53 [k kc ks] = mirkey(miraudio('Amaj4','Excerpt',.2,1))
54
55 pause, close all
56
57 [k kc ks] = mirkey(miraudio('Amin5','Excerpt',.2,1))
58 [k kc ks] = mirkey(miraudio('Amaj5','Excerpt',.2,1))
59 [k kc ks] = mirkey(miraudio('Cmaj','Excerpt',.2,1))
60
61 pause, close all
62
63 %Part 2. Let's analyze several extracts from
64 %real music. For each extract, try the
65 %following:
66
67 %2.1. Listen to the piece:
68 mirplay('vivaldi')
69 soundsc(sin(2*pi*440*(0:1/8192:1)))
70
71 %2.2. Compute the chromagram of the
72 %whole extract. What tonal center could be
73 %inferred from the curve? Does it
74 %correspond to your expectation?
75 c = mirchromagram('vivaldi')
76
77 %2.3. Compute the key strength related to
78 %the chromagram. Is the result congruent
79 %with the tonality inferred in 2.1. and 2.2.?
80 ks = mirkeystrength(c)
81 [k kc ks] = mirkey(ks)
82
83 %2.4. A more detailed representation of the
84 %key strengths can be obtained by
85 %computing the self-organizing map:
86 som = mirkeysom(c)
87
88 pause, close all
89
90 %2.5. Analyse in the same way other audio files
91 [k kc ks] = mirkey('czardas')
92 mirkeysom('czardas')
93
94 pause, close all
95
96 %Part 3. The temporal evolution of the
97 %tonal dimension can be assessed by
98 %decomposing first the audio into frames
99 [k kc ks] = mirkey('czardas','frame')
100 mirkeysom('czardas','frame')