EZ Web Audio / createNoise
Function: createNoise()
Call Signature
createNoise(
type):Promise<Sound<BaseSoundEventMap>>
Defined in: packages/core/src/index.ts:1269
Create a Sound containing a specific type of noise.
A convenient unified API for all three noise types:
'white': Equal energy across all frequencies (hiss/static)'pink': Equal energy per octave (1/f spectrum; sounds balanced and natural)'brown': Heavier bass, deeper rumble (cumulative random walk)
All types return 1 second of loopable mono audio.
Parameters
type
The noise type: 'white', 'pink', or 'brown'
"white" | "pink" | "brown"
Returns
Promise<Sound<BaseSoundEventMap>>
Promise resolving to a Sound containing the generated noise
Example
import { createNoise } from 'ez-web-audio'
// Pink noise for focus/sleep
const pink = await createNoise('pink')
pink.loop = true
pink.play()
// Brown noise for deep rumble
const brown = await createNoise('brown')
brown.play()
// White noise (same as createWhiteNoise())
const white = await createNoise('white')
white.play()Call Signature
createNoise(
audioContext,type):Promise<Sound<BaseSoundEventMap>>
Defined in: packages/core/src/index.ts:1270
Create a Sound containing a specific type of noise.
A convenient unified API for all three noise types:
'white': Equal energy across all frequencies (hiss/static)'pink': Equal energy per octave (1/f spectrum; sounds balanced and natural)'brown': Heavier bass, deeper rumble (cumulative random walk)
All types return 1 second of loopable mono audio.
Parameters
audioContext
BaseAudioContext
type
The noise type: 'white', 'pink', or 'brown'
"white" | "pink" | "brown"
Returns
Promise<Sound<BaseSoundEventMap>>
Promise resolving to a Sound containing the generated noise
Example
import { createNoise } from 'ez-web-audio'
// Pink noise for focus/sleep
const pink = await createNoise('pink')
pink.loop = true
pink.play()
// Brown noise for deep rumble
const brown = await createNoise('brown')
brown.play()
// White noise (same as createWhiteNoise())
const white = await createNoise('white')
white.play()