Composing Music in the Cloud

Counterpoint Composer from a technical perspective

James L. Weaver
Developer / Evangelist

 

Twitter: @JavaFXpert
Email: jweaver@pivotal.io
http://JavaFXpert.com
http://CulturedEar.com

@JavaFXpert

Where we'll go today

Composing music algorithmically

  • Examine about counterpoint music
  • Demo/analyze CounterpointComposer

Composing music via machine learning

  • Discuss machine learning
  • Demo A.I. Duet

Live demo of CounterpointComposer chord analysis microservice while playing

@JavaFXpert

High-level architecture

@JavaFXpert

Source code is in GitHub:

https://github.com/JavaFXpert/chord-analyzer-service

Note: These Technical Presentation slides and Getting Started slides are available on the CounterpointComposer.com Help menu:

RESTful services & usage

@JavaFXpert

Exploring other music composition approaches

We'll come back to CounterpointComposer in a bit

@JavaFXpert

Other Music Composition Approaches

Music composition games popularized in 1800s

@JavaFXpert

Music Composition with Machine Learning

Pivotal Cloud Foundry now runs on Google Cloud Platform

@JavaFXpert

Definition of Machine Learning

"Machine learning is the science of getting computers to learn, without being explicitly programmed"

- Andrew Ng (co-founder of Coursera, Chief Scientist of Baidu)

@JavaFXpert

Anatomy of an Artificial Neural Network

Text

Modeled after the brain

@JavaFXpert

Artificial Neural Network

@JavaFXpert

Predicting/classifying an elephant

@JavaFXpert

Predicting/classifying a cat

@JavaFXpert

Time series prediction with neural networks

What is happening?  What is most likely to happen next?

@JavaFXpert

This is a job for a Recurrent Neural Network

What is happening?  What is most likely to happen next?

@JavaFXpert

Music composition with an RNN

@JavaFXpert

Predicting the most likely next note

@JavaFXpert

Playing a duet with neural networks

@JavaFXpert

Playing a duet with neural networks

@JavaFXpert

Now back to CounterpointComposer

Let's examine the ChordAnalyzerService

@JavaFXpert

Let's examine the ChordAnalyzerService

@JavaFXpert

Resource controller

http://example/analyze?notes=G3 D4 B4

Note: Because Jackson 2 is on the classpath, Spring’s MappingJackson2HttpMessageConverter is automatically chosen to convert the MusicChord instance to JSON

@RestController
public class ChordAnalyzerController {
  private MusicChord musicChord;
  @RequestMapping("/analyze")  // endpoints s/b nouns, so analysis is a better name
  public MusicChord identifyChordByNotes(@RequestParam(value = "notes") String notes) {
    ...
    return musicChord;
  }
}

To learn more, see Building a RESTful Web Service Spring Guide

@JavaFXpert

Resource representation

public class MusicChord {
  private final String root;
  private final String chordType;
  private final String bassNote;

  public MusicChord(String root, String chordType, String bassNote) {
    this.root = root;
    this.chordType = chordType;
    this.bassNote = bassNote;
  }

  public String getRoot() {
    return root;
  }

  public String getChordType() {
    return chordType;
  }

  public String getBassNote() {
    return bassNote;
  }
}

@JavaFXpert

Make the app executable

package com.culturedear.chord;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ChordAnalyzerServiceApplication {
  public static void main(String[] args) {
    SpringApplication.run(ChordAnalyzerServiceApplication.class, args);
  }
}

To learn more, see Building a RESTful Web Service Spring Guide

@JavaFXpert

App build/deploy cycle

$ mvn clean install

$ cf push

Note: One method of deployment for Spring Boot apps is a JAR file, which contains an embedded Tomcat servlet container.

@JavaFXpert

Pivotal Web Services Console

@JavaFXpert

start.spring.io

@JavaFXpert

Chord Analyzer Client

@JavaFXpert

Counterpoint Composer

from a technical perspective

James L. Weaver
Developer / Evangelist

 

Twitter: @JavaFXpert
Email: jweaver@pivotal.io
http://JavaFXpert.com
http://CulturedEar.com

http://CounterpointComposer.com

Hope you enjoyed

@JavaFXpert

Counterpoint Composer Technical Perspective

By javafxpert

Counterpoint Composer Technical Perspective

Exploring the technologies employed in Counterpoint Composer

  • 32,223