Skip to content

EZ Web Audio / createWhiteNoise

Function: createWhiteNoise() ​

Call Signature ​

createWhiteNoise(): Promise<Sound<BaseSoundEventMap>>

Defined in: packages/core/src/index.ts:1214

Create a Sound containing white noise.

White noise is useful for sound effects (rain, static, wind) and as a synthesis building block when combined with filters.

Returns ​

Promise<Sound<BaseSoundEventMap>>

Promise resolving to a Sound containing 1 second of white noise

Example ​

typescript
import { createWhiteNoise, createFilterEffect } from 'ez-web-audio'

// Create white noise
const noise = await createWhiteNoise()
noise.play()

// Filter white noise to create wind-like sound
const wind = await createWhiteNoise()
const lowpass = createFilterEffect('lowpass', {
  frequency: 400
})
wind.addEffect(lowpass)
wind.play()

Call Signature ​

createWhiteNoise(audioContext): Promise<Sound<BaseSoundEventMap>>

Defined in: packages/core/src/index.ts:1215

Create a Sound containing white noise.

White noise is useful for sound effects (rain, static, wind) and as a synthesis building block when combined with filters.

Parameters ​

audioContext ​

BaseAudioContext

Returns ​

Promise<Sound<BaseSoundEventMap>>

Promise resolving to a Sound containing 1 second of white noise

Example ​

typescript
import { createWhiteNoise, createFilterEffect } from 'ez-web-audio'

// Create white noise
const noise = await createWhiteNoise()
noise.play()

// Filter white noise to create wind-like sound
const wind = await createWhiteNoise()
const lowpass = createFilterEffect('lowpass', {
  frequency: 400
})
wind.addEffect(lowpass)
wind.play()