Giter Site home page Giter Site logo

fp1's Introduction

Final Project Assignment 1: Exploration (FP1)

DUE Friday, March 11, 2016

#My Library: rsound My Name: David Benoit

What I did:

I created an interface to rsound that allows programmers to express rsounds as music theory elements, enabling them to think like musicians as they program with the rsound library.

Here are some examples of useful procedures the API provides:

;; Take a note letter name and its octave 
;; and create a piano-tone rsound
(define (piano-note note octave)
  (piano-tone (note-to-midi-number note octave)))

;; Take multiple note rsounds
;; put them in sequence to create
;; a melody rsound
(define (create-melody n1 . note-end)
  (rs-append* (cons n1 note-end)))

;; Take multiple note rsounds
;; overlay them to create
;; a harmony(chord) rsound
(define (create-harmony n1 . note-end)
  (rs-overlay* (cons n1 note-end)))

;; Take an rsound and create a note that has the
;; duration of a quarter note
(define (quarter-note note)  
  (clip note 0 (round (* whole-note-length 0.25))))

;; Take an rsound and create a note that has the
;; duration of an eighth note
(define (eighth-note note)
  (clip note 0 (round (* whole-note-length 0.125))))


I also wrote a program to build and play an exerpt from Bach's Well Tempered Clavier to demonstrate the music theory interface. The program both plays a generated audio clip and displays a waveform image of the Bach exerpt.

Here are some code snippets of the exerpt program:


;; Create the first measure
(define prelude-measure1
 ;; Consolidate the voices into harmonies
  (create-harmony
  ;; Create soprano voice
   (create-melody
    (eighth-note rest)
    (sixteenth-note (piano-note 'G 5))
    (sixteenth-note (piano-note 'C 6))
    (sixteenth-note (piano-note 'E 6))
    (sixteenth-note (piano-note 'G 5))
    (sixteenth-note (piano-note 'C 6))
    (sixteenth-note (piano-note 'E 6))
    (eighth-note rest)
    (sixteenth-note (piano-note 'G 5))
    (sixteenth-note (piano-note 'C 6))
    (sixteenth-note (piano-note 'E 6))
    (sixteenth-note (piano-note 'G 5))
    (sixteenth-note (piano-note 'C 6))
    (sixteenth-note (piano-note 'E 6)))
    
   ;; Create alto voice
   (create-melody
    (sixteenth-note rest)
    (double-dotted-quarter-note (piano-note 'E 5))
    (sixteenth-note rest)
    (double-dotted-quarter-note (piano-note 'E 5)))
   ;; Create bass voice
   (create-melody
     (half-note (piano-note 'C 5))
      (half-note (piano-note 'C 5)))))
;; Draw a waveform in a new window
(rs-draw Bach-exerpt)

;; Play Bach
(play Bach-exerpt)

Here is a picture of the waveform:

Image of Waveform

Here is a link to a .wav file generated by the program: Bach Exerpt Audio

fp1's People

Contributors

benoid avatar marksherman avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.