πŸ”₯
Sparkle
  • πŸ‘‹Welcome to Sparkle!
  • πŸ”©Installation
  • πŸ—ƒοΈGeneral Information
    • πŸ–₯️For server owners
    • πŸ‘¨β€πŸ’»For developers
  • βš™οΈApps
    • πŸ“±Apps
    • 🚞Components
    • πŸ“¦Services
  • πŸ•ΉοΈInterchange
    • πŸ–¨οΈInterchanges
    • πŸ”©InterchangeStructure
    • 🧫CompletionAsset
    • πŸ—»StructuredInterchange
  • πŸ–₯️User Experience
    • πŸ“¨Transmission
    • πŸ—³οΈItems
    • 🎨Canvas
    • πŸ§‘β€πŸš€Effects
      • ⛓️Types
      • πŸ—―οΈParticleEffect
      • πŸ”ŠSoundEffect
  • πŸ—ΊοΈWorld
    • πŸ–οΈDyeableMaterial
    • 🌈ColorType
    • πŸ™οΈShapes
  • ⏱️Timing
    • πŸ›£οΈCoroutines
    • ⏳Scheduling & Deferral
  • βš—οΈOther
    • 🧬Debug
    • 🏜️SandBox
Powered by GitBook
On this page
  • SoundData
  • SoundMelody

Was this helpful?

  1. User Experience
  2. Effects

SoundEffect

Play sounds, create sounds

SoundData

Create sounds with ease, by using SoundData!


val sound = soundOf(Sound.ENTITY_ILLUSIONER_CAST_SPELL, pitch = .6)

fun playMySound(player: Player) = player.playEffect(sound)

Things like pitch, volume, and sound source are set by default, but can still be changed quite easily.

SoundEffects may not be so fascinating, but the following stuff, that builds ontop of this, may be!

SoundMelody

With melodies, you can create a sound effect, which plays multiple sounds, like a jingle or a spooky sound effect.

You can construct & play a sound melody like this:

val sound = buildMelody {
   beat {
      sound(soundOf(ENTITY_ILLUSIONER_CAST_SPELL, pitch = .6))
   }
   beat(soundOf(Sound.BLOCK_NOTE_BLOCK_BANJO, pitch = .1))
   beat(soundOf(Sound.BLOCK_NOTE_BLOCK_BANJO, pitch = .5))
   beat(soundOf(Sound.BLOCK_NOTE_BLOCK_BANJO, pitch = 1))
   beat(soundOf(Sound.BLOCK_NOTE_BLOCK_BANJO, pitch = 1.5))
   beat(soundOf(Sound.BLOCK_NOTE_BLOCK_BANJO, pitch = 2))
   repetitions = 2
   delayPerBeat = .2.seconds
   delayPerSound = Duration.ZERO
}

fun playMySound(player: Player) =
	player.playEffect(sound)

The playEffect part is the same because the melody itself is also a compatible effect!

PreviousParticleEffectNextDyeableMaterial

Last updated 2 years ago

Was this helpful?

πŸ–₯️
πŸ§‘β€πŸš€
πŸ”Š