This video demonstrates how to integrate sound into our solution.
- [Instructor] In this video, we'll complete the solution…by wiring in the sound.…First, in the core dot clj file,…I'll add a require for the sound module that we just wrote.…Hold this in as theremin dot sound and alias it as sound.…Next, I'll scroll down to the draw state function.…Inside of the let bindings, we'll set the pitch and volume…for our sound.…First, I'll set our pitch.…I'm gonna multiply our normalized y value by 12,…because there are 12 notes chromatically in an octave,…and then I'll multiply by six…because I want to have six octaves of range.…
Our midi pitch needs to be an integer…and this expression will return a decimal number.…So I'll wrap this in a cast to int.…Lastly, this will start our pitch at zero…which is a bit too low to hear.…So I'm gonna add 24 to our value…to increase it by two octaves.…Next, I'll set our volume.…This will also need to be an integer.…And I'll multiply our normalized x value…by the maximum amplitude, which is 16,383.…
With these values established,…we should be ready to play our sound.…
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.