Modding:Audio

From Stardew Valley Wiki
Revision as of 03:28, 17 October 2021 by 7automaton (talk | contribs) (Playing client-side sounds (edit 3))
Jump to navigation Jump to search

Index

Axe.png
Article Stub

This article is marked as a stub for the following reason:

  • add info about Custom Music, C# audio loading/playing, track list

This page explains how to use and edit audio/music in Stardew Valley. This is an advanced guide for modders.

Track list

These are the raw soundbank IDs for music and sounds exported from the game data (see the talk page for the export code). A few notes about the values shown here:

  • The game data only has numeric IDs like 5; the category names like "Footsteps" are arbitrarily assigned based on the tracks they contain.
  • Some tracks have multiple soundbank IDs for the same name. Each time you play that name, the game will randomly choose one of the soundbank IDs to play.
  • The soundtrack ID is the hexadecimal position in the soundbank, and matches the track's filename if you unpack the wavebank using unxwb.
  • The description column is filled in manually for the wiki.

Footsteps

name soundbank ID description
Cowboy_Footstep 0000010d
grassyStep 00000016
sandyStep 00000010
snowyStep 00000154
stoneStep 00000017
thudStep 00000018
woodyStep 0000001d

Music

name soundbank ID description
50s 0000002d
AbigailFlute 00000117
AbigailFluteDuet 00000118
aerobics 00000037
archaeo 00000000
bigDrums 000000ac
breezy 00000119
caldera 0000017f
Cavern 00000041
christmasTheme 00000131
Cloth 00000043
CloudCountry 000000be
clubloop 00000066
cowboy_boss 0000010b
cowboy_outlawsong 00000115
Cowboy_OVERWORLD 00000105
Cowboy_singing 00000106
Cowboy_undead 0000010e
crane_game 0000000c
crane_game_fast 0000000d
Crystal Bells 00000040
Cyclops 0000007c
desolate 00000028
distantBanjo 0000015b
EarthMine 00000040
EarthMine 00000041
EarthMine 00000042
echos 00000031
elliottPiano 00000127
EmilyDance 00000165
EmilyDream 00000166
EmilyTheme 00000167
end_credits 00000193
event1 0000012b
event2 0000012e
fall1 00000079
fall2 00000077
fall3 00000078
fallFest 00000130
fieldofficeTentMusic 00000177
FlowerDance 0000012d
FrogCave 00000183
FrostMine 00000043
FrostMine 00000044
FrostMine 00000045
Ghost Synth 00000077
grandpas_theme 00000150
gusviolin 00000129
harveys_theme_jazz 00000004
heavy 00000033
honkytonky 00000034
Icicles 00000044
IslandMusic 00000176
jaunty 00000029
junimoKart 00000014
junimoKart_ghostMusic 00000000
junimoKart_mushroomMusic 00000015
junimoKart_slimeMusic 00000016
junimoKart_whaleMusic 00000001
junimoStarSong 00000134
kindadumbautumn 0000011a
LavaMine 00000048
LavaMine 00000049
LavaMine 000000c6
LavaMine 000000d7
libraryTheme 00000155
MainTheme 0000014f
Majestic 00000079
MarlonsTheme 0000015d
marnieShop 000000b4
mermaidSong 0000016a
moonlightJellies 0000012f
movie_classic 00000007
movie_nature 00000008
movie_wumbus 00000009
movieTheater 0000000a
movieTheaterAfter 0000000b
musicboxsong 0000002c
Near The Planet Core 00000048
New Snow 0000007e
night_market 0000016c
Of Dwarves 00000049
Orange 0000007a
Overcast 000000d7
Pink Petals 0000005d
PIRATE_THEME 00000186
PIRATE_THEME(muffled) 00000186
playful 00000116
Plums 00000078
poppy 00000035
ragtime 0000002e
sad_kid 00000185
sadpiano 0000002f
Saloon1 0000015e
sam_acoustic1 00000002
sam_acoustic2 00000003
sampractice 00000032
sappypiano 0000002b
Secret Gnomes 00000042
SettlingIn 000000c0
shaneTheme 00000169
shimmeringbastion 00000036
spaceMusic 0000011d
spirits_eve 0000014e
spring1 0000005d
spring2 0000005b
spring3 0000005c
springsongs 0000005b
springsongs 0000005c
springsongs 0000005d
springtown 0000005e
Stadium_ambient 00000164
starshoot 0000002a
submarine_song 0000016e
summer1 0000007a
summer2 0000007b
summer3 00000073
SunRoom 00000011
sweet 00000090
tickTock 0000012c
tinymusicbox 00000128
title_night 0000007f
tribal 000000c6
Tropical Jam 00000073
VolcanoMines 0000017e
VolcanoMines 00000180
VolcanoMines1 0000017e
VolcanoMines2 00000180
wavy 0000005f
wedding 00000068
winter1 0000007e
winter2 0000007c
winter3 0000007d
WizardSong 00000141
woodsTheme 000000d8
XOR 00000045

Music (ambient)

name soundbank ID description
babblingBrook 00000157
bugLevelLoop 000000a9
communityCenter 00000133
cracklingFire 00000156
darkCaveLoop 000000a8
fall_day_ambient 00000152
Frost_Ambient 000000c8
heavyEngine 00000158
Hospital_Ambient 0000011b
jojaOfficeSoundscape 00000151
jungle_ambience 00000173
Lava_Ambient 000000c9
movieScreenAmbience 00000006
nightTime 000000e0
ocean 000000af
pool_ambient 00000120
rain 00000074
roadnoise 000000bd
spring_day_ambient 000000b3
spring_night_ambient 00000159
summer_day_ambient 00000153
tropical_island_day_ambient 00000178
Upper_Ambient 000000c7
Volcano_Ambient 00000179
wind 00000055
winter_day_ambient 00000162

Sound

name soundbank ID description
achievement 00000067
axchop 0000008d
axe 00000001
backpackIN 00000085
barrelBreak 00000136
batFlap 000000aa
batScreech 000000ab
bigDeSelect 00000002
bigSelect 00000003
bob 0000001e
boop 00000062
boop 00000063
boop 00000064
boop 00000065
boulderBreak 000000ee
boulderCrack 00000004
breakingGlass 0000011c
breathin 00000054
breathout 00000053
bubbles 000000eb
bubbles 000000ec
busDoorOpen 000000bf
busDriveOff 00000135
button1 000000fa
cacklingWitch 00000143
camel 00000017
cameraNoise 00000124
cancel 00000161
cast 000000f6
cat 0000014c
cat 0000014d
cavedrip 00000081
clam_tone 0000016b
clank 000000ad
clank 000000cb
clank 000000cb
clank 000000cc
clank 000000cd
clank 000000cd
clubhit 0000009f
clubSmash 000000ae
clubswipe 000000a0
cluck 0000001f
cluck 00000020
cluck 00000021
coin 00000005
coldSpell 000000c5
cow 00000050
cow 00000051
cow 00000052
cowboy_dead 0000010c
cowboy_explosion 00000114
cowboy_gopher 00000113
cowboy_gunload 00000110
Cowboy_gunshot 0000010a
Cowboy_monsterDie 00000108
Cowboy_monsterDie 00000109
cowboy_monsterhit 00000112
cowboy_powerup 0000010f
Cowboy_Secret 00000107
crafting 00000024
crane 0000000e
crickets 00000075
cricketsAmbient 0000015a
crit 00000160
croak 0000008a
crow 00000144
crystal 0000008f
cut 00000006
daggerswipe 000000a3
death 00000046
debuffHit 00000097
debuffSpell 00000098
detector 00000025
dialogueCharacter 00000007
dialogueCharacterClose 00000008
dirtyHit 000000f3
dirtyHit 000000f4
discoverMineral 000000d0
distantTrain 000000dc
distantTrain 000000dd
dog_bark 0000014b
dog_pant 0000014a
dogs 000000e4
dogWhining 0000013c
doorClose 00000009
doorCreak 0000013f
doorCreakReverse 00000142
doorOpen 00000140
dropItemInWater 0000000a
drumkit0 0000006e
drumkit1 0000006f
drumkit2 0000006c
drumkit3 0000006b
drumkit4 0000006d
drumkit5 0000006a
drumkit6 00000069
Duck 000000e7
Duggy 0000003c
dustMeep 000000ba
DwarvishSentry 00000182
dwoop 00000022
dwop 000000ea
eat 00000019
explosion 00000023
fallDown 0000013e
fastReel 000000f8
fireball 00000047
fishBite 0000001a
fishBite_alternate_0 0000018e
fishBite_alternate_1 0000018d
fishBite_alternate_2 0000018c
fishEscape 000000fd
FishHit 000000fb
fishingRodBend 000000fe
fishingRodBend 000000ff
fishingRodBend 00000100
fishSlap 00000104
flameSpell 00000096
flameSpellHit 00000095
flute 00000070
flybuzzing 000000a4
frozen 0000018a
furnace 00000026
fuse 00000030
getNewSpecialItem 000000df
ghost 0000000b
give_gift 0000015c
glug 00000145
goat 0000004e
goat 0000004f
goldenWalnut 00000174
gorilla_intro 00000184
grunt 0000000c
gulp 000000ef
gulp 000000f0
hammer 00000086
harvest 00000146
healSound 000000c4
hitEnemy 00000038
hoeHit 0000000d
horse_flute 0000018b
horse_flute 00000191
horse_flute 00000192
jingle1 000000fc
junimoKart_coin 00000010
junimoMeep1 00000132
keyboardTyping 00000125
killAnimal 000000e9
leafrustle 0000008e
magma_sprite_die 0000017c
magma_sprite_hit 0000017b
magma_sprite_spot 0000017d
Meteorite 000000e1
Milking 000000e6
minecartLoop 000000bc
miniharp_note 00000005
money 0000003d
moneyDial 000000ed
monkey1 00000181
monsterdead 0000009e
mouseClick 00000126
newArtifact 000000d3
newRecipe 000000d6
newRecord 000000d5
objectiveComplete 00000084
openBox 0000000e
openChest 000000a1
Ostrich 0000016f
ow 0000003f
owl 000000e3
parrot 00000168
parrot_squawk 00000175
parry 000000ad
phone 00000071
Pickup_Coin15 00000111
pickUpItem 0000000f
pig 00000082
pig 00000083
potterySmash 00000093
powerup 00000027
pullItemFromWater 0000001c
purchase 00000091
purchase 00000092
purchase 000000f1
purchaseClick 00000092
purchaseRepeat 000000f1
qi_shop 0000018f
qi_shop_purchase 00000190
questcomplete 00000080
quickSlosh 00000122
quickSlosh 00000123
rabbit 0000004a
rainsound 00000087
rainsound 00000088
rainsound 00000089
reward 000000d4
robotBLASTOFF 0000011f
robotSoundEffects 0000011e
rockGolemDie 000000a6
rockGolemHit 000000a7
rockGolemSpawn 000000a5
rooster 00000149
scissors 000000e5
seagulls 000000b0
seagulls 000000b1
seagulls 000000b2
secret1 000000da
seeds 00000011
select 00000094
sell 000000f2
serpentDie 0000013b
serpentHit 0000013a
sewing_loop 0000000f
shadowDie 000000c2
shadowHit 000000c3
shadowpeep 00000012
sheep 000000e8
shiny4 00000013
Ship 00000060
Ship 00000061
shwip 0000013d
SinWave 000000f5
sipTea 000000c1
skeletonDie 000000b7
skeletonHit 000000b8
skeletonStep 000000b6
slime 00000039
slimedead 0000003b
slimedead 0000009c
slimedead 0000009d
slimeHit 000000b9
slingshot 000000cf
slosh 00000121
slosh 00000122
slosh 00000123
slowReel 000000f7
smallSelect 00000014
SpringBirds 00000056
SpringBirds 00000057
SpringBirds 00000058
SpringBirds 00000059
SpringBirds 0000005a
squid_bubble 00000188
squid_hit 00000189
squid_move 00000187
Stadium_cheer 00000163
stairsdown 00000139
stardrop 0000015f
steam 0000017a
stoneCrack 0000004b
stoneCrack 0000004c
stumpCrack 000000d9
submarine_landing 0000016d
swordswipe 0000003a
swordswipe 000000a2
telephone_buttonPush 00000171
telephone_dialtone 00000172
telephone_ringingInEar 00000170
throw 000000bb
throwDownITem 00000015
thunder 00000072
thunder_small 00000147
thunder_small 00000148
tinyWhip 000000f9
toolCharge 0000003e
toolSwap 0000001b
toyPiano 000000b5
trainLoop 000000de
trainWhistle 000000db
trashbear 00000019
trashbear_flute 00000018
trashcan 000000d1
trashcanlid 000000d2
treecrack 0000008c
treethud 0000008b
UFO 000000e2
wand 00000076
warrior 000000ce
wateringCan 00000099
wateringCan 0000009a
wateringCan 0000009b
waterSlosh 00000101
waterSlosh 00000102
waterSlosh 00000103
whistle 0000012a
woodchipper 00000012
woodchipper_occasional 00000013
woodWhack 00000137
woodWhack 00000138
woodyHit 0000004d
yoba 000000ca

Managing audio in Custom Music content packs

TODO

Managing audio in SMAPI

Playing client-side sounds

playSound
You can play a sound for the current player only, played from no specific location, by calling the Game1.playSound() method. For example:
// For UI elements, such as when the player crafts a new item.
Game1.playSound("crafting");

This is useful for playing sounds in user interfaces, such as menus, where you don't need to play the sound from any particular location on the map.

playSoundPitched
Only specific sounds are able to be pitch shifted. This function will not work at all on certain sounds, in which the game will play a sample at the same pitch or a random pitch, even if a pitch value is specified. Generally, with samples that can be pitch shifted, you can pitch shift a sound at intervals of 100 per half step, with 1200 being the pitch of the original sample. To play a sound at a higher or lower pitch, for the current player only with no specific location, you can call the Game1.playSoundPitched() method:
// The singleplayer code for Elliott's piano,
// located in his cabin.
switch (key)
{
  case 1:
    this.playSoundPitched("toyPiano", 1100);
    break;
  case 2:
    this.playSoundPitched("toyPiano", 1500);
    break;
  case 3:
    this.playSoundPitched("toyPiano", 1600);
    break;
  case 4:
    this.playSoundPitched("toyPiano", 1800);
    break;
}
playSoundAfterDelay
Sometimes, you need to play a sound after waiting a certain period of time, for the current player at no particular location. In this case, you can call the DelayedAction.playSoundAfterDelay() method:
// During a lightning storm, if the random chance is met,
// the screen will flash, and then
// a distant lightning strike sound will play after a
// randomly generated duration of time in milliseconds
if (Game1.random.NextDouble() < 0.5)
  DelayedAction.screenFlashAfterDelay((float) (0.3 + Game1.random.NextDouble()), Game1.random.Next(500, 1000));
DelayedAction.playSoundAfterDelay("thunder_small", Game1.random.Next(500, 1500));
// ...

You can also change the sound's pitch with this function, or call this function several times at once to call them in a predetermined order:

// When using the phone that is purchasable from the Carpenter's Shop,
// it will play a specific sequence of dial beeps at predetermined times:
private void playShopPhoneNumberSounds(string whichShop)
{
  Random random = new Random(whichShop.GetHashCode());
  DelayedAction.playSoundAfterDelay("telephone_dialtone", 495, pitch: 1200);
  DelayedAction.playSoundAfterDelay("telephone_buttonPush", 1200, pitch: (1200 + random.Next(-4, 5) * 100));
  DelayedAction.playSoundAfterDelay("telephone_buttonPush", 1370, pitch: (1200 + random.Next(-4, 5) * 100));
  DelayedAction.playSoundAfterDelay("telephone_buttonPush", 1600, pitch: (1200 + random.Next(-4, 5) * 100));
  DelayedAction.playSoundAfterDelay("telephone_buttonPush", 1850, pitch: (1200 + random.Next(-4, 5) * 100));
  DelayedAction.playSoundAfterDelay("telephone_buttonPush", 2030, pitch: (1200 + random.Next(-4, 5) * 100));
  DelayedAction.playSoundAfterDelay("telephone_buttonPush", 2250, pitch: (1200 + random.Next(-4, 5) * 100));
  DelayedAction.playSoundAfterDelay("telephone_buttonPush", 2410, pitch: (1200 + random.Next(-4, 5) * 100));
  DelayedAction.playSoundAfterDelay("telephone_ringingInEar", 3150);
}

See also