Difference between revisions of "Music 253 Humdrum homework"

From CCARH Wiki
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
 +
__NOTOC__
  
 
Do some vocal-range analysis of J.S. Bach chorales.
 
Do some vocal-range analysis of J.S. Bach chorales.
Line 4: Line 6:
 
See [[Getting started with Humdrum]] to access the Humdrum Tools.
 
See [[Getting started with Humdrum]] to access the Humdrum Tools.
  
You can download the Bach chorales by doing these commands in a terminal
+
You can download the Bach chorales by doing these commands in a terminal:
 
       mkdir chorales
 
       mkdir chorales
 
       cd chorales
 
       cd chorales
Line 13: Line 15:
 
or with more detail such as the size of the files:
 
or with more detail such as the size of the files:
 
       ls -asF
 
       ls -asF
 +
 +
If you are using Virtual Humdrum, then the chorales are already downloaded:
 +
    cd data/bach-js/371chorales/kern
 +
    ls -asCF
  
  
Line 27: Line 33:
  
  
The output can either be saved to a file, and then processed with prange, or the data can be sent directly to prange:
+
Intermediate output results can either be saved to a file, and then processed with prange, or the data can be sent directly to prange:
 
     extractx -f 1 chor001.krn > temp-file
 
     extractx -f 1 chor001.krn > temp-file
 
     prange temp-file
 
     prange temp-file
Line 41: Line 47:
 
Load the choral.pmx file into SCORE with the command:   
 
Load the choral.pmx file into SCORE with the command:   
 
     RE chor001.pmx
 
     RE chor001.pmx
 +
 +
 +
Alternatively, you can convert the PMX data into an SVG image from the command line with this program:
 +
 +
#!/usr/bin/perl
 +
 +
use HTTP::Request::Common;
 +
use LWP::UserAgent;
 +
 
 +
my $data;
 +
my $line;
 +
while ($line = <>) {
 +
    $data .= "$line";
 +
}
 +
 +
$ua = LWP::UserAgent->new;
 +
my $response = $ua->request(
 +
      POST 'http://score.sapp.org/cgi-bin/score',
 +
      [
 +
        outputformat => 'svg',
 +
        embedpmx    => 'yes',
 +
        inputdata    => [$data],
 +
      ]
 +
    );
 +
 +
if ($response->is_success) {
 +
    print $response->decoded_content;
 +
} else {
 +
    die $response->status_line;
 +
}
 +
 +
If this PERL script is saved to a file called "getsvg", then to generate the SVG image:
 +
 +
    ./getsvg file.pmx > file.svg
 +
 +
[note: you should run the following commands to make the getsvg script executable]:
 +
      chmod 0755 getsvg
 +
 +
All in one step:
 +
      humcat chor001.krn | prange --score | ./getsvg > chor001.svg
  
 
== Question 3 ==
 
== Question 3 ==
Line 63: Line 109:
 
== Question 5 ==  
 
== Question 5 ==  
  
What is the average twelve-tone pitch by each voice. What is the +/– 1 standard deviation range for each voice?  What is the average pitch for each part?
+
What is the average twelve-tone pitch for each voice? What is the lowest quartile and highest quartile pitch for each voice?  The lowest quartile point is where 25% of notes are below and 75% of notes are above.  50% of notes fall between the 25% and 75% quartile points.  You could also generate a box-and-whisker plot by hand or with a program:
 +
 
 +
 
 +
http://www.shmoop.com/basic-statistics-probability/box-whisker-plots.html
 +
 
 +
https://www.youtube.com/watch?v=8vul6_7TlWY
  
 +
https://www.youtube.com/watch?v=Cj-buDcHVMw
  
 
== Question 6 ==  
 
== Question 6 ==  
  
Extra credit: What is the 2-standard deviation of each voice's pitch range (the range of notes which covers 95% of the range that they sing).
+
What is the 2-standard deviation of each voice's pitch range (the range of notes which covers 95% of the range that they sing).
  
 
This should be the Tessitura (https://en.wikipedia.org/wiki/Tessitura) of the vocal ranges.  How does the measured tessitura match to standard listings for vocal ranges of soprano, alto, tenor, bass?
 
This should be the Tessitura (https://en.wikipedia.org/wiki/Tessitura) of the vocal ranges.  How does the measured tessitura match to standard listings for vocal ranges of soprano, alto, tenor, bass?

Latest revision as of 08:11, 12 March 2016


Do some vocal-range analysis of J.S. Bach chorales.

See Getting started with Humdrum to access the Humdrum Tools.

You can download the Bach chorales by doing these commands in a terminal:

     mkdir chorales
     cd chorales
     humsplit h://chorales

To see a list of the chorales:

     ls

or with more detail such as the size of the files:

     ls -asF

If you are using Virtual Humdrum, then the chorales are already downloaded:

    cd data/bach-js/371chorales/kern
    ls -asCF


Question 1

Use the Humdrum Extras programs 'extractx' and 'prange' to calculate the number of notes each voice plays on each twelve-tone pitch in chor001.krn. Plot the pitch range data as a histogram for each voice in a plotting program of your choice.


Here is how to extract the first part from a file:

    extractx -f 1 chor001.krn

Or to explicitly extract by instrument name:

    extractx -g Bass chor001.krn


Intermediate output results can either be saved to a file, and then processed with prange, or the data can be sent directly to prange:

    extractx -f 1 chor001.krn > temp-file
    prange temp-file
    extractx -f 1 chor001.krn | prange

Question 2

Try the “– –score” option for prange to generate SCORE data for pitch range histograms for each voice in chor001.krn. Print the SCORE output from prange for chor001.krn and a composite of all chorales.

    humcat chor001.krn | prange --score > chor001.pmx

Load the choral.pmx file into SCORE with the command:

    RE chor001.pmx


Alternatively, you can convert the PMX data into an SVG image from the command line with this program:

#!/usr/bin/perl

use HTTP::Request::Common;
use LWP::UserAgent;
 
my $data;
my $line; 
while ($line = <>) {
   $data .= "$line";
}

$ua = LWP::UserAgent->new;
my $response = $ua->request(
     POST 'http://score.sapp.org/cgi-bin/score',
     [
        outputformat => 'svg',
        embedpmx     => 'yes',
        inputdata    => [$data],
      ]
   ); 

if ($response->is_success) {
   print $response->decoded_content;
} else {
   die $response->status_line;
}

If this PERL script is saved to a file called "getsvg", then to generate the SVG image:

   ./getsvg file.pmx > file.svg

[note: you should run the following commands to make the getsvg script executable]:

     chmod 0755 getsvg

All in one step:

     humcat chor001.krn | prange --score | ./getsvg > chor001.svg

Question 3

Calculate and plot pitch histograms for each voice (soprano, alto, tenor, bass) in all 370 chorales. One histogram for each voice (not one for each chorale).

Extract all notes from all chorales like this (for Bass part):

   extractx -f 1 chor*.krn | prange


Also generate and print with SCORE similar plots:

       prange chor*.krn --score

Optional: add mouse hovering code to list the number of notes for each pitch

      prange chor*.krn --score --hover

Question 4

Based on the data/plots from question 3, what is the maximum and minimum pitch for each part in all of the chorales?


Question 5

What is the average twelve-tone pitch for each voice? What is the lowest quartile and highest quartile pitch for each voice? The lowest quartile point is where 25% of notes are below and 75% of notes are above. 50% of notes fall between the 25% and 75% quartile points. You could also generate a box-and-whisker plot by hand or with a program:


http://www.shmoop.com/basic-statistics-probability/box-whisker-plots.html

https://www.youtube.com/watch?v=8vul6_7TlWY

https://www.youtube.com/watch?v=Cj-buDcHVMw

Question 6

What is the 2-standard deviation of each voice's pitch range (the range of notes which covers 95% of the range that they sing).

This should be the Tessitura (https://en.wikipedia.org/wiki/Tessitura) of the vocal ranges. How does the measured tessitura match to standard listings for vocal ranges of soprano, alto, tenor, bass?


https://en.wikipedia.org/wiki/Soprano

https://en.wikipedia.org/wiki/Alto

https://en.wikipedia.org/wiki/Tenor

https://en.wikipedia.org/wiki/Bass