Skip to content

An iOS app that plays a 440 Hz pulse wave sound and draws a scrolling waveform in sync with the audio.

Notifications You must be signed in to change notification settings

ekdysis/pulse_wave

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

pulse_wave

An iOS app that plays a 440 Hz pulse wave sound and draws a scrolling waveform in sync with the audio.

Screen.Recording.2026-02-13.at.8.11.08.PM.mov

What It Does

  • Plays a 440 Hz pulse wave through the device speaker.
  • Displays a scrolling waveform animation that stays in sync with the audio.
  • Tap Play to start both the audio and the animation; tap Stop to silence both.

How It Works

A Remote I/O Audio Unit generates the tone. iOS invokes a render callback each time it needs samples; the callback reads the current phase and duty cycle (0.5 = square wave), writes +0.25 or −0.25 per sample, and advances the phase for the next call.

AVAudioSession is configured for playback so the output routes to the speaker.

PulseWaveView draws the pulse waveform. While playing, a CADisplayLink fires every frame, redrawing the view and advancing its phase at the same frequency and rate as the audio engine to keep the animation in sync with what you hear. ViewController owns the audio unit, registers itself as the render-callback context (refCon), and manages the Play / Stop toggle and display-link lifecycle.

Libraries

Library Role
AudioToolbox Remote I/O Audio Unit and render callback
AVFAudio AVAudioSession playback configuration and audio session activation

About

An iOS app that plays a 440 Hz pulse wave sound and draws a scrolling waveform in sync with the audio.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published