Add audio API
Pathoschild opened this issue ยท 3 comments
Add an API to add/replace cues, and possibly override the game's music selection.
Requires Stardew Valley 1.4 (#638).
The upcoming Stardew Valley 1.6 adds support for adding/replacing audio directly, so an audio API in SMAPI is no longer needed.
One tricky part is supporting the custom XACT variables used via Cue.GetVariable/SetVariable
to change audio in-game. Those are custom for the game or even per-cue, so they might be implemented inconsistently or have different value ranges. Only a subset of cues seem to support them; for others they have no effect.
These are the affected cues:
field name | cue name | custom variables |
---|---|---|
AmbientLocationSounds.babblingBrook |
babblingBrook |
Volume |
AmbientLocationSounds.cracklingFire |
cracklingFire |
Volume |
AmbientLocationSounds.engine |
heavyEngine |
Volume, Frequency |
AmbientLocationSounds.cricket |
cricketsAmbient |
Volume, Frequency |
CommunityCenter.buildUpSound |
wind |
Volume, Frequency |
FarmAnimal.sound |
cluck cow Duck goat pig rabbit sheep |
Pitch |
MineShaft.bugLevelLoop |
bugLevelLoop |
Volume, Frequency |
Railroad (local variable) |
distantTrain |
Volume |
Railroad.trainLoop |
trainLoop |
Volume |
Intro.roadNoise |
roadnoise |
Volume |
Fly.buzz |
flybuzzing |
Volume |
Object.internalSound |
flute |
Pitch |
FishingRod.chargeSound |
SinWave |
Pitch |
Game1.currentSong |
(various) | Volume, Frequency |
Here are the default/min/max values for Stardew Valley's XACT variables (thanks to ConcernedApe):
Based on the above, these are the variables SMAPI will need to replicate:
variable | default | min | max | effect |
---|---|---|---|---|
Volume |
0 | 0 | 100 | a percentage of the max volume? |
Frequency |
0 | 0 | 100 | a percentage of the original frequency? |
Pitch |
1200 | 0 | 2400 | an absolute pitch value? |
Archived experimental branches:
- 2019-08-09 NVorbis audio API in the SMAPI repository;
- 2019-08-18 Ogg2XNA audio API in a test mod.