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

#DigitalKnowHow

If you attended the morning (overview) session

"This is called a neuralyzer. It's a gift from some friends from out of town. This red eye here will isolate the electronic impulses in your brains, more specifically the ones for memory."

—Agent K describing the neuralyzer to its soon to be targets.

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

#DigitalKnowHow

High-level architecture

@JavaFXpert

#DigitalKnowHow

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:

@JavaFXpert

#DigitalKnowHow

RESTful services & usage

@JavaFXpert

#DigitalKnowHow

Let's examine the ChordAnalyzerService

@JavaFXpert

#DigitalKnowHow

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

#DigitalKnowHow

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

#DigitalKnowHow

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

#DigitalKnowHow

App build/deploy cycle

  1. $ mvn clean install
  2. $ cf push -p ./target/counterpoint-service.jar CounterpointService

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

@JavaFXpert

#DigitalKnowHow

Pivotal Web Services Console

@JavaFXpert

#DigitalKnowHow

start.spring.io

@JavaFXpert

#DigitalKnowHow

Chord Analyzer Client

@JavaFXpert

#DigitalKnowHow

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

#DigitalKnowHow

Adapt or Die conference - Counterpoint Composer Technical Perspective

By javafxpert

Adapt or Die conference - Counterpoint Composer Technical Perspective

Adapt or Die conference - Exploring the technologies employed in Counterpoint Composer

  • 2,289