1 / 5

Session 18 CPSC 231 Tu#02

Learn about sampling audio waves and how to play them back with examples and notes.

eangie
Download Presentation

Session 18 CPSC 231 Tu#02

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Session 18 CPSC 231 Tu#02

  2. Table of content Audio Object Types Examples

  3. Audio Notes are a sin wave that oscillates with different frequencies

  4. Audio (cont’d) Waves are analog, but our systems are digital We have to sample the wave The more samples, the more accurate For note A: sin(2πt ×440)

  5. Audio (cont’d) • stdaudio, accepts an array of samples • For t seconds, we need t * sampling-rate samples • t = 1: 44,100 samples SPS = 44100              # samples per secondhz = 440.0               # concert Aduration = 1.0          # one secondn = int(SPS * duration)a = stdarray.create1D(n+1)for i in range(n+1):    a[i] = math.sin(2.0 * math.pi * i * hz / SPS)stdaudio.playSamples(a)stdaudio.wait()

More Related