Daniel@0: function demo7tonality Daniel@0: %To get familiar with some approaches of tonal analysis using MIRtoolbox, Daniel@0: % and to assess their performances. Daniel@0: Daniel@0: % Part 1. We will first investigate the performance of the chromagram Daniel@0: % analysis, using very simple musical samples. Daniel@0: Daniel@0: % 1.3. In the audio file ÔtrumpetÕ, the same pitch is played by a trumpet. Daniel@0: % Compute its chromagram. What are the chromas detected by the function? Daniel@0: % Can you explain the result? Daniel@0: mirchromagram('trumpet') Daniel@0: Daniel@0: % 1.4. A more detailed representation of the chromagram can be obtained by Daniel@0: % decomposing each pitch class into its different possible absolute values. Daniel@0: % For that purpose, just add the parameter: Daniel@0: c = mirchromagram('trumpet','Wrap',0) Daniel@0: Daniel@0: % 1.5. Compute also the key strength related to the chromagram. Daniel@0: mirkeystrength(c) Daniel@0: Daniel@0: pause, close all Daniel@0: Daniel@0: % 1.6. In the audio file ÔpianoF4Õ, the same pitch is played by a piano. Daniel@0: [ks c] = mirkeystrength('pianoF4') Daniel@0: Daniel@0: a = miraudio('pianoF4','excerpt',.7,2); Daniel@0: [ks c] = mirkeystrength(a) Daniel@0: Daniel@0: pause, close all Daniel@0: Daniel@0: % 1.7. Investigate the chromagram analysis of triad chords Daniel@0: [ks c] = mirkeystrength('Amin3') Daniel@0: p = mirpeaks(ks) Daniel@0: mirkey(p) Daniel@0: Daniel@0: pause, close all Daniel@0: Daniel@0: [k kc ks] = mirkey('Amaj3') Daniel@0: [k kc ks] = mirkey('Amin4') Daniel@0: [k kc ks] = mirkey('Amaj4') Daniel@0: Daniel@0: pause, close all Daniel@0: Daniel@0: [k kc ks] = mirkey('Amin5') Daniel@0: [k kc ks] = mirkey('Amaj5') Daniel@0: [k kc ks] = mirkey('Cmaj') Daniel@0: Daniel@0: pause, close all Daniel@0: Daniel@0: [k kc ks] = mirkey(miraudio('Amin3','Excerpt',.2,1)) Daniel@0: [k kc ks] = mirkey(miraudio('Amin4','Excerpt',.2,1)) Daniel@0: [k kc ks] = mirkey(miraudio('Amaj3','Excerpt',.2,1)) Daniel@0: [k kc ks] = mirkey(miraudio('Amaj4','Excerpt',.2,1)) Daniel@0: Daniel@0: pause, close all Daniel@0: Daniel@0: [k kc ks] = mirkey(miraudio('Amin5','Excerpt',.2,1)) Daniel@0: [k kc ks] = mirkey(miraudio('Amaj5','Excerpt',.2,1)) Daniel@0: [k kc ks] = mirkey(miraudio('Cmaj','Excerpt',.2,1)) Daniel@0: Daniel@0: pause, close all Daniel@0: Daniel@0: %Part 2. Let's analyze several extracts from Daniel@0: %real music. For each extract, try the Daniel@0: %following: Daniel@0: Daniel@0: %2.1. Listen to the piece: Daniel@0: mirplay('vivaldi') Daniel@0: soundsc(sin(2*pi*440*(0:1/8192:1))) Daniel@0: Daniel@0: %2.2. Compute the chromagram of the Daniel@0: %whole extract. What tonal center could be Daniel@0: %inferred from the curve? Does it Daniel@0: %correspond to your expectation? Daniel@0: c = mirchromagram('vivaldi') Daniel@0: Daniel@0: %2.3. Compute the key strength related to Daniel@0: %the chromagram. Is the result congruent Daniel@0: %with the tonality inferred in 2.1. and 2.2.? Daniel@0: ks = mirkeystrength(c) Daniel@0: [k kc ks] = mirkey(ks) Daniel@0: Daniel@0: %2.4. A more detailed representation of the Daniel@0: %key strengths can be obtained by Daniel@0: %computing the self-organizing map: Daniel@0: som = mirkeysom(c) Daniel@0: Daniel@0: pause, close all Daniel@0: Daniel@0: %2.5. Analyse in the same way other audio files Daniel@0: [k kc ks] = mirkey('czardas') Daniel@0: mirkeysom('czardas') Daniel@0: Daniel@0: pause, close all Daniel@0: Daniel@0: %Part 3. The temporal evolution of the Daniel@0: %tonal dimension can be assessed by Daniel@0: %decomposing first the audio into frames Daniel@0: [k kc ks] = mirkey('czardas','frame') Daniel@0: mirkeysom('czardas','frame')