Generated jump sound, matched to Wicked Quest's jump
movement.jump is a triangle tone sweeping straight up from 300 to 1000 Hz over 0.24 seconds. It holds full volume for 0.04 seconds, then fades out along a half sine. It matches the SoX recipe the original was most likely made with (synth 0.24 triangle 300:1000 fade h 0 0.24 0.2), and it was compared with the original by ear. It peaks at 0.3, like the library's other short tones, so a game that wants it as loud as the old file can pass a volume to make_sound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f164697cf6
commit
ec82210ea6
7 files changed
+29
-2
No files matched your search
@@ -633,6 +633,7 @@ The modules:
|
||||
- `ambience`: looping voices `BubblingVoice`, `DrippingVoice`, `GurglingVoice`, `BouncingSpringVoice`,
|
||||
`RatchetVoice`, and `PatternVoice` for any repeating pattern of sounds
|
||||
- `alerts`: live voices `ProximityWarningVoice`, `FallingScreamVoice`, `WhistlingFallVoice`, `ChatteringVoice`
|
||||
- `movement`: `jump`
|
||||
- `synth`: the building blocks, for making new sounds
|
||||
|
||||
Voices make sound a block at a time, for a game with its own live mixer. To
|
||||
|
||||
@@ -26,6 +26,7 @@ The modules:
|
||||
- vehicles: skids, and live voices for road surfaces and wind.
|
||||
- ambience: loops such as bubbling, dripping and repeating patterns.
|
||||
- alerts: live voices for warnings, falling screams, whistles and chattering.
|
||||
- movement: a jump.
|
||||
|
||||
Generated sounds need numpy and scipy. Nothing else in libstormgames imports
|
||||
this package, so a game that does not use it does not need scipy.
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
"""Movement sounds: jumping."""
|
||||
|
||||
import numpy as np
|
||||
|
||||
from .synth import sampleRate
|
||||
|
||||
|
||||
def jump(seconds=0.24, low=300.0, high=1000.0):
|
||||
"""A triangle tone springing straight up in pitch from low to high as it fades out.
|
||||
|
||||
The tone holds full volume for its first 0.04 seconds, then fades out over
|
||||
the rest along a half sine.
|
||||
"""
|
||||
times = np.arange(int(sampleRate * seconds)) / sampleRate
|
||||
frequency = low + (high - low) * times / seconds
|
||||
# Start halfway through the cycle, at the triangle's lowest point.
|
||||
phases = np.cumsum(frequency) / sampleRate + 0.5
|
||||
triangle = 2.0 * np.abs(2.0 * (phases % 1.0) - 1.0) - 1.0
|
||||
fadeSeconds = min(0.2, seconds)
|
||||
fade = np.clip((times - (seconds - fadeSeconds)) / fadeSeconds, 0.0, 1.0)
|
||||
envelope = 0.5 * (1.0 + np.cos(np.pi * fade))
|
||||
return 0.3 * triangle * envelope
|
||||
Binary file not shown.
@@ -20,6 +20,7 @@ def cases(modules):
|
||||
vehicles = modules["vehicles"]
|
||||
ambience = modules["ambience"]
|
||||
alerts = modules["alerts"]
|
||||
movement = modules["movement"]
|
||||
sampleRate = synth.sampleRate
|
||||
blockSize = synth.blockSize
|
||||
|
||||
@@ -175,6 +176,8 @@ def cases(modules):
|
||||
"alerts.whistling_fall": lambda: record(alerts.WhistlingFallVoice(1), 2.0, ramp("pitchFactor", 1.2, 0.8)),
|
||||
"alerts.chattering": lambda: record(alerts.ChatteringVoice(1), 2.0, ramp("pitchFactor", 1.3, 0.7)),
|
||||
|
||||
"movement.jump": movement.jump,
|
||||
|
||||
"synth.make_loop": lambda: synth.make_loop(record(ambience.BubblingVoice(3), 2.0), 0.2),
|
||||
"synth.join": lambda: synth.join(ui.menu_move(), vehicles.tyre_scrub_turn(1)),
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import sfx_cases # noqa: E402
|
||||
|
||||
libraryRoot = Path(__file__).resolve().parents[1]
|
||||
moduleNames = ("synth", "impacts", "ui", "rewards", "materials", "creatures", "babble", "vehicles", "ambience",
|
||||
"alerts")
|
||||
"alerts", "movement")
|
||||
|
||||
|
||||
def load_sfx():
|
||||
|
||||
@@ -19,7 +19,7 @@ sys.path.insert(0, str(libraryRoot / "tests"))
|
||||
import sfx_cases # noqa: E402
|
||||
|
||||
moduleNames = ("synth", "impacts", "ui", "rewards", "materials", "creatures", "babble", "vehicles", "ambience",
|
||||
"alerts")
|
||||
"alerts", "movement")
|
||||
|
||||
|
||||
def load_modules():
|
||||
|
||||
Reference in new issue
Block a user