Learn how to produce MIDI sounds in Clojure using JFugue.
- [Narrator] In this video we'll create…the routines for playing sound.…We'll create these in the sound.clj file…and I'll begin by defining our namespace…as theremin.sound…and in an import expression,…I'll need to import jfugue using org.jfugue.…From jfugue I'll pull in the Player class.…Using the Player class, we'll need a player object…so I'll define one using defonce player…and then instantiate the player using Player.…
I'm using defonce here in case we…reload the namespace in the REPL,…we'll be reusing the same object.…Now, I'd like to define a function…that uses the player to play the sound.…So, I call this play-str because it will take a string.…Jfugue calls this string a pattern,…so I'll name our parameter pattern-str…for pattern string.…Now, in its body I'll use the .play method…on the player that we've defined,…and I'll pass in the given pattern-str.…We can leverage play-str in the function…that I'll define called play-note.…
This will take a volume argument…and n as a pitch.…Here we'll use midi pitches rather…
Skill Level Intermediate
1. Problem 1: Exploring Lake Pend Oreille
2. Problem 2: Image Analysis
3. Problem 3: Eight Queens
4. Problem 4: Accessing Peripherals
5. Problem 5: Recursion and Directories
6. Problem 6: Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.