exNoops v0.1.1 Exnoops.Melodybot View Source

Module to interact with Github's Noop: Melodybot

See the official noop documentation for API information including the accepted parameters.

Link to this section Summary

Functions

Get a list of generators

Query Melodybot for a melody

Link to this section Functions

Link to this function

get_generators() View Source
get_generators() :: {atom(), list()}

Get a list of generators

Examples

iex> Exnoops.Melodybot.get_generators()
{:ok, [
  %{ "name" => "chaos", "description" => "Chaotic Neutral Melody Generator" },
  %{ "name" => "arpeggio", "description" => "Generate Arpeggios" },
  %{ "name" => "walk", "description" => "Random Walk" }
]}
Link to this function

get_melody(opts \\ []) View Source
get_melody(keyword()) :: {atom(), map()}

Query Melodybot for a melody

Examples

iex> Exnoops.Melodybot.get_melody()
{:ok, %{
  "generator" => "chaos",
  "stepCount" => 32,
  "key" => %{
    "name" => "A Major", "root" => "A", "relativeMajorRoot" => "A", "type" => "major"
  },
  "notes" => [
    %{
      "start" => 0,
      "duration" => 2,
      "value" => 64,
      "name" => "E4",
      "noteName" => "E",
      "octave" => 4,
      "frequency" => 329.6275569128699
    },
    %{
      "start" => 2,
      "duration" => 1,
      "value" => 59,
      "name" => "B3",
      "noteName" => "B",
      "octave" => 3,
      "frequency" => 246.94165062806206
    },
    %{
      "start" => 17,
      "duration" => 4,
      "value" => 74,
      "name" => "D5",
      "noteName" => "D",
      "octave" => 5,
      "frequency" => 587.3295358348151
    },
    %{
      "start" => 25,
      "duration" => 4,
      "value" => 62,
      "name" => "D4",
      "noteName" => "D",
      "octave" => 4,
      "frequency" => 293.6647679174076
    },
    %{
      "start" => 29,
      "duration" => 2,
      "value" => 57,
      "name" => "A3",
      "noteName" => "A",
      "octave" => 3,
      "frequency" => 220
    },
    %{
      "start" => 31,
      "duration" => 1,
      "value" => 57,
      "name" => "A3",
      "noteName" => "A",
      "octave" => 3,
      "frequency" => 220
    }
  ]
}}