Skip to content

Audio oscillator#253

Merged
waynemwashuma merged 7 commits into
wimaengine:devfrom
waynemwashuma:audio-oscillator
Sep 13, 2025
Merged

Audio oscillator#253
waynemwashuma merged 7 commits into
wimaengine:devfrom
waynemwashuma:audio-oscillator

Conversation

@waynemwashuma
Copy link
Copy Markdown
Collaborator

Objective

Introduces a new AudioOscillator component to the audio module, allowing users to generate and control oscillator-based audio signals directly within the engine.

Solution

The solution adds a new AudioOscillator component that wraps the Web Audio API's OscillatorNode. The component supports configurable waveform types (sine, square, triangle, sawtooth), frequency and detune. It integrates with the existing audio graph system and follows similar pattern as the audio player.

Showcase

To use the audio oscillator component:

import { AudioOscillator, AudioOscillatorType } from 'wima'

// Create an oscillator entity
commands
  .spawn()
  .insert(new AudioOscillator({
    type: AudioOscillatorType.Sine,
    frequency: 440, // A4 note
    detune: 0
  }))
  .build()

The oscillator will automatically start playing when added to an entity and stop when the entity is removed.

Migration Guide

No breaking changes were introduced. Existing audio functionality remains unchanged.

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@waynemwashuma waynemwashuma self-assigned this Sep 13, 2025
@waynemwashuma waynemwashuma added type:enhancement New feature or request mod:audio labels Sep 13, 2025
@waynemwashuma waynemwashuma merged commit f10f0f9 into wimaengine:dev Sep 13, 2025
5 checks passed
@waynemwashuma waynemwashuma deleted the audio-oscillator branch September 13, 2025 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:audio type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant