0 of 0

File information

Last updated

Original upload

Created by

Mushroomy

Uploaded by

Mushroomyx

Virus scan

Safe to use

About this mod

Makes the Dark Piano and the Upright Piano playable and makes it possible for Content Packs to add musical Instruments to the game.

Requirements
Permissions and credits
Changelogs
This Mod by allows you to play the Dark and the Upright Piano with your Keyboard and playback of MIDI files. Additionally allows Content Packs to add their own stationary and portable Instruments with custom Sound.

Install

How to use
Sit down at either Piano, and press a key on your keyboard, when using a portable Instrument hold the Item and left click.This will open up a menu where you can choose between the Freeplay Mode and the Midi Playback Mode.

Freeplay Mode
During Freeplay Mode simply press a Key on your Keyboard to play a sound.
The Keyboard layout emulates a piano, and can be seen in the image below.



By pressing Ctrl, Shift and Tab you can switch between lower, middle and upper pitches, giving you a total Pitch-range from C3 to C9. 

Midi Playback Mode
In Playback Mode you can automatically play MIDI Files (.mid) located in the Mods songs Folder ("Playable_Piano/assets/songs"). Simply click a File from the List and the Playback should start.

Note: If you used a previous Version of this mod, in Version 1.3.0 the songs folder has been moved and thus your songs might not show up.



Customizability
You can customize the mod by changing the sound of any Instrument added either by the mod itself, or other Content Packs.

Change sound

If you want to change the sound of the piano, or any other Instrument simply edit the config.json in the Mod"s Folder.
The line syntax is as follows

"<Instrument Name>": "<Sound Name>"

Simply replace <Instrument Name> with the name of the Instrument and <Sound name> with the name of the sound.
If you have a custom sound file add it to the assets/sounds folder (only .wav files are supported), and write the files name without the extension into the config. If you don't have custom sounds you can add any sound from the base game, those can be found on this Wiki Page.

If, for example, you wanted to turn your Dark Piano into a cat Piano, simply add the following line to the config:

"Dark Piano" : "cat"

Custom sound file
If you want to add a custom sound file, as was shown in the previous section, there are a few things to consider. In order for the Keyboard to align with a Piano Keyboard, the selected .wav file should have a Pitch of C, optimally C6 so the MIDI Playback Notes are correct.

Additionally adding only a single Sound will give you a limited octave range from C5 to C7. To get the full range of supported Pitches you have to add two additional soundfiles, one for low Pitches and one for high.

Adding a "<baseSoundFileName>Low.wav", pitched down two octaves, will give you two octaves below the base range .
Adding a "<baseSoundFileName>High.wav", pitched up two octaves, will give you two octaves above the base range.

You don't have to add both files, if you for example only wanted additional lower sounds, you can just add the low pitched sound file.
When adding these Files it is important, that Low and High are properly capitalized, as otherwise the Mod won't recognize them. For the extended ranges, no changes have to be made to the config besides adding the base sound.

Mod Authors
If you want to add an Instrument to your own Mod you can either use Content Patcher, or you can use the Mod's API. For more details check out the docs for mod author's on the mod's github repository.
Content Patcher
To add a custom Instrument using Content Patcher, you just have to add the TriggerAction Mushroomy.PlayablePiano_AddSound <Name/ItemId of your Instrument> <ID of your sound> to your content.json. This method works for Items and sittable furniture. An Example for a furniture based Instrument, can be found in my Toy Piano Mod. Examples for Item Instruments would be my Playable Ocarina or my Playable Kalimba Mod.
C# API
If you want to make an Instrument, which can't be added with Content Patcher, f.e. because it is part of the map like Elliott's Piano, you can use the provided API to directly open the Mod's UI. It contains a single method playInstrument and takes the name of the sound the Instrument should use as it's argument (e.g. toyPiano, Mushroomy.PlayablePiano_Piano, flute).
Sound Files
The Mod comes with its own Piano Sound Mushroomy.PlayablePiano_Piano and with additional files for extended pitch ranges for the base games toyPiano and flute sounds. You can use those, if you don't have or don't want to add your own Sounds.

Troubleshooting
if a custom Instrument Instrument doesn't seem to work even though it should, check the config.json in the Playable Piano Folder. There should be a line for every Instrument the Mod recognizes, with a corresponding sound. If the Instrument doesn't appear in the list, type reset_instrument_sounds into the SMAPI Console and check the config again. If it still doesn't show up, please contact the corresponding Mod author.

Compatibility
  • Works with Stardew Valley 1.6.15 on Linux/macOS/Windows.
  • Works in single player, and (mostly) in split-screen mode.
  • Works in Multiplayer, if both Players have the Mod installed, and the corresponding Soundfile for an Instrument


See also
Source Code