Lullabyte Stanley Chang Louis Croce Nathan Hayes-Roth Andrew - - PowerPoint PPT Presentation

lullabyte
SMART_READER_LITE
LIVE PREVIEW

Lullabyte Stanley Chang Louis Croce Nathan Hayes-Roth Andrew - - PowerPoint PPT Presentation

Lullabyte Stanley Chang Louis Croce Nathan Hayes-Roth Andrew Langdon Ben Nappier Peter Xu Overview Goals Generate MIDI music files C-like syntax Allow algorithmic or direct composition Building blocks Construct


slide-1
SLIDE 1

Lullabyte

Stanley Chang Louis Croce Nathan Hayes-Roth Andrew Langdon Ben Nappier Peter Xu

slide-2
SLIDE 2

Overview

  • Goals

○ Generate MIDI music files ○ C-like syntax ○ Allow algorithmic or direct composition

  • Building blocks

○ Construct sounds from ints, doubles, pitches ○ Construct tracks from series of sounds ○ Layer tracks into a song

slide-3
SLIDE 3

Program Structure

  • main function

void main() {...}

  • global variable declarations

int global_i; sound[] sounds;

  • function definitions

type function (types args) {...}

slide-4
SLIDE 4

Functions

type function(){

// local variable declarations // global variable assignments // control flow // other function calls // optional return value

}

slide-5
SLIDE 5

Arrays

  • Dynamic. Length is not fixed
  • Assigning element beyond length pads intermediate

elements with default type values (0, 0.0, false, C0, |C0|:0.0:0, etc.)

  • Accessing element beyond length throws IOB error
  • Reason: Make it easier for developer to not worry about

checking array lengths since musical tracks change a lot throughout development

slide-6
SLIDE 6

Types

  • int, double, boolean
  • Pitch: C0, A1, Bb4, G9, …
  • Sound: “<pitch(es)> : <double> : <int>”

|C0|:0.25:100 |C5, E4, G3|:0.25:70

slide-7
SLIDE 7

Statements & Control Flow

  • if, while, for, return
  • loop ( <var> : <array> ) {

//body }

  • Reference to <var> in body is treated as “array[i]”
  • Easy way to loop through sound arrays and make

modifications with cleaner code

slide-8
SLIDE 8

Built-in Functions

  • setPitches(<sound>,

<pitch>)

  • setDuration(<sound>,

<double>)

  • setAmplitude(<sound>,

<int>)

  • getPitches(<sound>)
  • getDuration(<sound>)
  • getAmplitude(<sound>)
  • length(<array>)
  • randomInt(<int>)
  • randomDouble(<double>)
  • bpm(<int>)
  • write()
  • play()
  • print(<expr>)
  • mixDown(<sound[]>, <int>)
slide-9
SLIDE 9

mixDown(sounds, track)

  • most important built-in function
  • writes array of sounds to midi
  • programmer specifies track number
  • can be called multiple times
  • sounds appended to specified track
slide-10
SLIDE 10

Architectural Design

slide-11
SLIDE 11

Front End

  • scanner.mll
  • parser.mly
  • ast.ml
slide-12
SLIDE 12

Back End

  • interpreter.ml

○ rules of our compiler

  • typechecking

○ variable type is stored on value declaration ○ function type is stored in module

slide-13
SLIDE 13

Conversion to Midi

  • Bytecode Conversion

○ catches .llb Failures ○ bpm, write, play, or both ○ tracks

  • BytecodeTranslator.java
  • JFugue

120 p 0[[Bb5]:0.5:100,[C6]:0.5:100, [C6]:0.5:100, [Bb5]:0.5:100] 1[[Bb4, D4, G3]:1.:100,[E4, G3, C3]:1.:100] 0[[Bb5]:0.5:100] “V1 [72]/0.5a100+[76]/0.25a100+[76]/0. 5a100”...

slide-14
SLIDE 14

Testing

  • testing suite

○ *.llb and *.out

  • type check test

○ breaking the compiler

slide-15
SLIDE 15

Lessons Learned

  • MicroC Slides
  • Version Control
  • Testing
  • Strength in Numbers
  • Communication
  • Accountability
slide-16
SLIDE 16

Hey Jude Demo

slide-17
SLIDE 17

Thank You

Any Questions?