Computational Musicology 8824

Description

Notebooks made for the Computational Musicology 8824 seminar at The Ohio State University’s School of Music.

See the syllabus here: syllabus/Computational_Musicology_8824.02.pdf

The code for this website is hosted here: https://github.com/fdch/computational_musicology-8824.git

Usage

You can browse the read-only notebooks (html version) nlfollowing) the links in this website (https://fdch.github.io/computational_musicology-8824), or you can download or clone the repository and run the notebooks:

NOTE: see requirements.txt

git clone https://github.com/fdch/computational_musicology-8824.git
cd computational_musicology-8824
./config.py -depic
# or simply
jupyter notebook

Alternatively, you can browse the notebooks online following its corresponding colab link

Index


Unit 1 Symbolic Data

Week 01 Representation Formats html | colab

  1. Representation Formats
    1. Darms
    2. Plaine And Easie
    3. Kern
      1. More Info
      2. Let’S Begin
        1. Why Python?
      3. Variables
      4. Lists And Loops
      5. Basic Conditionals
    4. Exercise 1
    5. Exercise 2:
    6. Homework:
      1. Read In A File
      2. Wednesday Class
      3. Counting Things
      4. More On Lists
        1. Question: Why Is There No Output?
    7. Exercise: Odd Numbers Only.
      1. List Comprehension
      2. Functions
        1. Exercise
      3. Rhythms In A Polish Folksong
      4. Substitutions And Regular Expressions

Week 02 Music21 html | colab

  1. Playing With Toolkits (Music21)
    1. A Problem: Creating A Test Bank For Carmen Quizzes
    2. Music21 And Notation
      1. The Converter
      2. Looping With Music21
    3. Reading In Files.
      1. Back To The Exercise.
    4. Printing A Question
    5. Transposing
    6. Homework For Monday:

Week 03 Rhythms html | colab

  1. Rhythms
    1. Presentation And Paper
    2. Working With Rhythms
      1. Rhythmic Representation
        1. In Kern Files (Humdrum)
        2. In Music21
      2. Metric Position
        1. In Humdrum
        2. In Music21
    3. Exercise 1: Searching The Polska Collection
      1. Humdrum
      2. Music21
        1. Back To The Exercise.
    4. Return And Print
    5. Counting All Downbeats
    6. Testing A Hypothesis 6. Getting Rhythmic Content 7. The Npvi Equation.

Week 04 Key Finding html | colab

  1. Key Finding
  2. A Brief History Of Key Finding
    1. Longuet Higgins
    2. Krumhansl Schmuckler/Krumansl Kessler
    3. Aarden Essen
    4. Bellman Budge
    5. Temperley Kostka/Payne
    6. Craig Sapp’S Simple Weightings
    7. Results
  3. A “Bag Of Notes”?
    1. Keyscapes
      1. Exercise #1
    2. Exercise #2
  4. Wednesday
    1. Today’S Plan
    2. Windowed Graphs 1. What Key Would This Be In?
      1. Looking At Confidence In The Chorales.
    3. Exercise #3

Week 05 Chords html | colab

  1. Chords
    1. Vertical Sonorities
      1. How Humdrum Looks At Harmony
      2. How Music21 Looks At Harmony
        1. Chordify
          1. Annotating With Chordify:
      3. Roman Numerals
      4. Getting All The Chords In A Bach Chorale
    2. Exercise
    3. Annotating A Score
  2. Wednesday
    1. While Loops
    2. Exercise:

Week 06 Python Installation html | colab

  1. Install Python
  2. Does Your Computer Have Python Already?
    1. Installing With Homewbrew:

Unit 2 Audio Data

Week 07 Beat Tracking html | colab

  1. Audio Analysis
    1. A Bit Of History
  2. Beat Tracking
    1. Beat
    2. Pulse
    3. Usage
    4. Algorithm Structure
  3. Imports
  4. Audio Signal
  5. Librosa’S Beat Tracking
    1. Listen
  6. Spectral Analysis
  7. Spectral Energy Flux
    1. Custom Onset Strength Function
  8. Detection Function
    1. Listen
  9. Periodicity Estimation
    1. Autocorrelation
    2. Dft
  10. Essentia
    1. Compare Tempo Estimations
  11. References
  12. References
  13. Exercise

Week 08 Melodic Extraction html | colab

  1. Melodic Extraction
    1. Paiva’S Algorithm
    2. Melody
  2. Extra
  3. Algorithm Structure
  4. Load An Audio File
  5. Detect Onsets
    1. Librosa’S Onset Detection
    2. Segment The Audio
    3. Fundamental Frequency Estimation
      1. 1. Autocorrelation Method
    4. Run The Function And Estimate
  6. Exercise
    1. 2. Dft F0 Estimation Method
  7. Exercise
  8. Constant Q Transform

Week 09 Review 1 Spectrogram html | colab

  1. Libosa Load
  2. Audio Waveform
  3. Spectrogram Of A Sound
    1. Frequency Spectrum
    2. Magnitude (Aka Amplitude Spectrum)
    3. Plotting A Spectrogram
      1. Power Spectrum… Scaled In Decibels
  4. Exercise 1
  5. Exercise 2

Week 09 Review 2 Tempo html | colab

  1. Tempo Estimation
    1. Load A Sound
    2. Listen To It
    3. Librosa’S Beat.Tempo Function
    4. Custom Tempo Estimation
      1. 1. Compute The Power Spectrum Of A Signal
      2. 2. Compute The Mel Spectrogram Using The Power Spectrum
      3. 3. Compute The Onset Strength Envelope Using The Mel Spectrogram
      4. 4. Estimate The Tempo Using Autocorrelation Or Frequency Estimation
        1. 4.1 Autocorrelation
        2. 4.1 Frequency Estimation (Dft Method)
  2. Exercise 1
  3. Exercise 2

Week 09 Review 3 Beat Tracking html | colab

  1. Beat Tracking
    1. Load A Sound
    2. Listen To It
    3. Librosa’S Beat Track Function
    4. Plot The Waveform With Clicks
  2. Exercise 1
  3. Exercise 2

Week 10 Audio To Score Alignment Dtw html | colab

  1. Music Synchronization
  2. Dynamic Time Warping
  3. Compute Chroma Sens
  4. Dynamic Time Warping
  5. Audio To Score
  6. Fetch A Sound File
  7. Fetch A Kern File
    1. Try With Different Features
  8. Sources

Week 11 Python Classes html | colab

  1. Prepare Python (And Colab)
  2. Audio To Score Alignment
    1. Getting Bach Chorales (…From Youtube)
    2. Getting A Bach Chorale Score (From Kern To Synced Audio+Music21)
      1. Score Class
      2. Usage
    3. Aligning Source And Target For Querying
      1. Aligner Class
      2. Usage
  3. Python Classes
    1. Composer Class
    2. Classes Have A ‘Self’
    3. How Are Classes Different Than Variables? Functions
    4. Exercise
      1. 1. (Review) Put This Into A Function Called Plot Spectrogram
      2. 2. Place The Function Inside This (Slightly Changed) Bpm Class Creation

Week 11 Review 1 Melodic Extraction html | colab

  1. More On Classes
  2. Review: A Melodic Extraction Class
    1. Solutions
  3. Useful Functions 1. Autocorrelation 2. Dft Method

Unit 3 Machine Learning And Analytical Models

Week 12 Pandas Spotify Data html | colab

  1. Pandas And Spotify Data
    1. Goals This Week.
      1. Importing Pandas
    2. Picking Out Specific Things.
    3. Calculating Summary Statistics
    4. Testing A Hypothesis
    5. Results:
    6. Exercise

Week 13 1 Ml Intro Perceptron Svm html | colab

  1. Machine Learning
    1. Ml Model
      1. Generative Models
      2. Discriminative Models
    2. Python Modules
    3. Supervised Learning
      1. Regression
      2. Classification
    4. Unsupervised Learning
      1. Clustering
    5. Linear Classification
      1. Perceptron
        1. Perceptron (Classifier)
      2. Support Vector Machine (Classifier)
      3. Cross Validation
  2. Exercise

Week 13 2 Binary Class Mozart Or Salieri Svm Mfcc Youtube html | colab

  1. Mozart Or Salieri?
    1. Making A Dataset
      1. Download Audio Files
      2. Load Them To Memory
      3. Make The Features
      4. Make The Labels
    2. Model
      1. Choose A Model
      2. Train The Model
      3. Model Score
      4. Using Our Model
    3. Cross Validation
      1. Grid Search For Best Parameters
      2. Classification Report
      3. Confusion Matrix
  2. Final Prediction

Week 14 1 Binary Class Schumann Or Schubert Svm Mfcc Youtube html | colab

  1. Schumann Or Schubert?
    1. Making A Dataset
      1. Download Audio Files
      2. Load Them To Memory
      3. Make The Features
      4. Make The Labels
    2. Model
      1. Choose A Model
      2. Train The Model
      3. Model Score
      4. Using Our Model
    3. Cross Validation
      1. Grid Search For Best Parameters
      2. Classification Report
      3. Confusion Matrix
  2. Final Prediction

Week 14 Review 1 Binary Class Svm Spotify Data html | colab

  1. Make A Classifier
  2. 1. Getting Some Data
    1. 1.1 Load A Dataset
    2. 1.2 Features And Labels
      1. 1.2.0 Look At The Data:
      2. 1.2.1 Features
      3. 1.2.2 Labels
  3. 2. Split Data Into Train And Test Sets
  4. 3. Train Your Model
    1. 3.1. Load Your Model
    2. 3.2. Train The Model
    3. 3.3 Get Your Accuracy Score
  5. 4. Make A Prediction
  6. 5. Grid Search For Best Parameters (Optional)
    1. 5.1 Grid Search
    2. 5.2. Run A Prediction Again
  7. 6. Interpreting Results
    1. 6.1 Classification Report
    2. 6.2 Confusion Matrix
  8. 8. Extra

Week 15 1 Multinomial Classification Ann Spotify Data html | colab

  1. Classify Spotify Artists Using An Artificial Neural Network
    1. Import The Spotify Data
    2. Plot The First 25 Elements
    3. Build The Model
      1. Set Up The Layers
      2. Compile The Model
    4. Train The Model
      1. Feed The Model
      2. Evaluate Accuracy
      3. Make Predictions
    5. Confusion Matrix
    6. Use The Trained Model

Week 15 2 Multinomial Classification Cnn Nsynth html | colab

  1. Using A Convolutional Neural Network To Classify Musical Instruments
    1. Import The Nsynth Dataset
      1. The Nsynth Dataset
    2. Helper Functions
    3. Mfccs And Label Datasets
    4. Plot Some Elements Of The Labelled Mfccs
    5. Normalization Layer
  2. Batch, Cache And Prefetch
    1. Input Shape
    2. Innstantiate The Sequential Class With Your Layers
    3. Compile The Model
    4. Train
    5. Plot Results
    6. Confusion Matrix
    7. Single Predictions

Authors

Fede Camara Halac

Daniel Shanahan