Use-Cases: Difference between revisions

From Audio WG Wiki
Amacdona (talk | contribs)
Amacdona (talk | contribs)
Line 86: Line 86:
=Basic Example Code=
=Basic Example Code=


<div id="Loop_Sounds_Without_Gaps">====Loop Sounds Without Gaps====</div>
====<div id="Loop_Sounds_Without_Gaps">Loop Sounds Without Gaps</div>====
  <nowiki>
  <nowiki>
   var context = new webkitAudioContext()
   var context = new webkitAudioContext()

Revision as of 23:53, 1 November 2011

Basic Examples

What can web developers do with the Web Audio API?

  • Looping sounds without gaps: Code Example
  • Creating seamless playlists
  • FadeIns / FadeOuts / Crossfades
  • Add filters to the audio such as: Bass/Treble EQ Control
  • Changing parameters such as volume, pan, speed/pitch over time
  • Cross-fading between two sounds.
  • Synchronizing sounds to begin playing at the same time, or at specific times.
  • Playing sounds with rhythm: EG: Drum beats
  • Sound level meter to monitor the volume of audio
  • Create audio visualizations
  • Low-Latency Sound Playback eg:
    • In response to user-input from keyboard/mouse etc
    • Collisions of objects in games
  • JavaScript access to audio data
    • Create custom audio processing effects
    • Music synthesis

Use Cases

Use Cases from Audio Incubator Group http://www.w3.org/2005/Incubator/audio/wiki/Audio_API_Use_Cases

Scenarios from MediaStream Processing API http://hg.mozilla.org/users/rocallahan_mozilla.com/specs/raw-file/tip/StreamProcessing/StreamProcessing.html#scenarios



Requirements

OpenAL/EAX Style Effects for Games

  • Doppler Shift
  • Distance attenuation
  • Obstruction
  • Room simulation
  • 3D Positioning


Features Realting to Accessibility

  • Changing pitch of voices without effect the speed
  • Change speed of voices without effecting the pitch
  • Smooth changes over time of audio parameters like volume, pan etc


Resource Management

  • Playing Short Sound now with minimal latency
  • Loading and managing short-medium length audio assets
  • Load audio assets faster than real-time


DAW Applications

  • Creating an multi-track mixer
    • Insert effects
    • sends
    • sub-mixes
    • mute
    • solo

Modular routing,

Dynamics Compressor

Faster than real time mix-down (such as exporting a track to a file)

Scheduling of many overlapping audio clips on multiple tracks Automation curves for volume, panning, other effect params Analysis and metering (Temporal frequency domain)


Synthesizer Playback

  • Basic sample-based synthesizer playback - ADSR envelopes, waveforms etc


Effects

Basic Example Code

Loop Sounds Without Gaps

  var context = new webkitAudioContext()
    , source  = context.createBufferSource()
    ;

  // Request & decode audio
  ... source.buffer = decoded_data; ...

  source.connect( context.destination );
  source.loop = true;
  source.noteOn( 0 );