Audio API & Audio Management for SMAPI, without any utilization of HarmonyLib.
Add custom music to your mods!
What does this mod do?
SAAT is a framework aimed to adding, managing, and modifying audio tracks in Stardew Valley. In addition, it seeks to improve the audio engine at a later date, as XNA / MonoGame’s audio engine is lackluster in memory management and support. It aims to be harmony-less.
You can see examples of how to add custom audio tracks from the Documentation on Github
New in v1.1.2:
– Fixed a bug that resulted in the warning message “Could not find a CueDefinition with the name ‘title_day’ “
New in v1.1.1:
– A fail-safety feature to prevent the game from crashing when a cue is incorrectly called / not found.
— Upon failure, a “Defaulting Cue” is played. This cue plays silence.
– The ability to forcibly add audio tracks to the jukebox. See “addtojukebox” command.
— This is to cover migrations. Mods that migrated from Custom Music to SAAT will have all custom tracks removed from the jukebox playlist due to the prefix (cm:) notation CM required. SAAT validates all tracks in the jukebox and removes ones that are missing to prevent.
New in v1.1.0:
– Add Audio Track Settings.
— You can now set an entry in tracks.json to continuously loop.
— You can now set an entry to immediately add itself to the jukebox when a new game is created.
– The command “setdebug” has been renamed to “audiodebug”, as there is a high possibility of conflict with other mods.
– The command “gen_track_json” has been renamed to “tracktemplate”.
– The command “audio_allocs” has been renamed to “audioallocs”.
– The audioallocs command has had some formatting fixes.
– The audioallocs command has an optional parameter now. Adding a track id will provide further details for a specific track.
– Some internal restructuring was done.
– Documentation update.
Allow brand new music and sound effects to be added into Stardew Valley
Allows music to be added into the jukebox.
Not Yet Implemented / Upcoming features:
Audio Track Replacement / Overrides
An individual can replace replace existing audio tracks with another, overriding vanilla assets in a non-destructable manner.
Audio Signal Processing (APS or DPS)
Upcoming feature that will allow for audio to undergo low-pass, high-pass, altered pitch, effects, and more without the need to create another track.
Proper memory management
This is to be the prime feature of the API. As of now, Stardew Valley relies on XNA / MonoGame to handle memory management for audio. The memory management is poor in design, as it loads all or nothing. Typically, audio is chunked into memory rather than retailing it all at once. This creates a very large consumption of memory.
In example, the winter music tracks are loaded into memory at the beginning of the game. Even if its spring. You won’t hear the audio track for 3/4th of the game, yet it is still consuming memory.
Note: This subset of the API / Mod will be written in C. Native is required to ensure performance.
Packed Audio Format
In conjunction with proper memory management, audio is to be compacted into binary files on a per mod basis. This allows for faster loading / unloading / reloading operating.
It will not be required, but it will optimizes performance. Especially for larger audio files.
Toolkit for Packed Audio Format
To assist and encourage content creators in optimizing audio for performance, a tool will be provided to create the packed audio format mentioned above.