AppleyAppley Docs
Docs/Audio

Pitch Shifting

Dynamically adjust audio pitch.

13 min read Advanced Updated 2026-07-01 v2.0 ~38 min to complete

Introduction

Dynamically adjust audio pitch. This page provides a complete guide to pitch shifting in Appley, covering everything from setup to advanced techniques.

Audio is a core area of Appley. Understanding pitch shifting will help you build better games and use the platform more effectively. This documentation is designed for advanced level users.

Requirements

Before working with pitch shifting, ensure you have the following:

  • Audio files (MP3, WAV, OGG)
  • An Appley project
  • Basic understanding of game audio
  • Optional: Freesound API key for sound search

Estimated Completion Time

This guide takes approximately 38 minutes to complete. The estimated reading time is 13 minutes. Difficulty level: Advanced.

Step-by-Step Guide

Follow these steps to work with pitch shifting in your Appley project:

1

Prepare audio files

Obtain or create audio files in MP3, WAV, or OGG format for pitch shifting.

2

Import audio

Upload the audio files through the Asset Browser in Creator Studio.

3

Configure audio source

Set the audio properties: loop, volume, pitch, 3D spatial, and channel.

4

Script playback

Use the audio API in Appley Scripting to play and control sounds.

5

Mix and test

Adjust volume levels and test the audio mix. Use the Audio Manager.

FluxScript Example

Below is an Appley Scripting (Flux Scripting) code example demonstrating pitch shifting:

Pitch Shifting — Appley Scripting
// Audio — Pitch Shifting
on start {
  audio.playLoop("ambient_wind")
  audio.setVolume("ambient_wind", 0.3)
  bgm = audio.play("bgm", { volume: 0.7, loop: true })
}

on collision(other) {
  if other.type == "coin" {
    audio.play("collect", { pitch: 1.0 + math.random(0.2) })
  }
  if other.type == "enemy" {
    audio.play("hit", { volume: 0.9 })
    audio.setPitch("hit", 0.8)
  }
}

on event("gameOver") {
  audio.fadeOut("bgm", 1.5)
}

Node Script Example

The same logic can be implemented using Node Scripting. Here is the equivalent node graph:

Pitch Shifting — Node Graph
[On Collision] ──► [Branch: type]
            ├─ "coin" ──► [Play: "collect", random pitch]
            └─ "enemy" ──► [Play: "hit", volume 0.9]

[On Event "gameOver"] ──► [Fade Out: "bgm", 1.5s]

Interchangeable Systems

FluxScript and Node Scripting compile to the same runtime. You can mix both in a single project — use whichever is best for each task.

Common Mistakes

Avoid these frequent mistakes when working with pitch shifting:

Using uncompressed WAV files for long music

Use MP3 or OGG for background music to reduce file size.

Playing too many simultaneous audio sources

Limit to 8-10 concurrent sounds. Use audio channels for grouping.

Not setting 3D audio properties

Enable spatial audio for positional sounds like footsteps and gunfire.

Loading all audio at startup

Stream long audio files instead of loading them into memory.

Troubleshooting

If you encounter issues with pitch shifting, try these solutions:

No sound plays
Check that audio is not muted. Verify the file loaded. Ensure volume is above 0.
Audio is distorted
Reduce the volume. Check for overlapping sources. Lower the master mixer level.
3D audio has no direction
Ensure the listener is attached to the camera. Enable spatial audio.
Audio loops have a gap
Use seamless loop files. Check for silence at start/end of the clip.

Performance Tips

Optimize your use of pitch shifting with these performance tips:

  • Use audio channels to group sounds (music, sfx, voice) for independent volume control.
  • Randomize pitch slightly (0.9-1.1) on repeated sound effects to avoid monotony.
  • Use audio occlusion for realistic sound blocking behind walls.
  • Pre-load frequently used short sounds; stream long music tracks.

Explore these related documentation pages:

Example Project

Download a complete example project demonstrating pitch shifting: