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