> Your computer’s sound card probably has a built-in MIDI library (like general MIDI) that will include a piano as an instrument.
> Note that I’m using the word “soundcard” very loosely here: in many cases sound hardware is onboard nowadays.
Mainstream computers haven't had "soundcards" or any kind of built-in hardware synthesis for many years. What you have for hardware is mostly just a digital to analog converter with some mixing features and possibly some basic DSP functions.
> The point is your computer will have sounds you need built in. > Whereas your computer’s sound hardware is likely to have a piano as a wave table instrument
They're going to be on the hard drive as files and synthesis is entirely in software, from which you have numerous options, including what comes with the OS.
Hardware wave table synthesis as a builtin is long obsolete.
You could use a sequencer (like the one built in to Reaper, which is free) to sequence the notes you need using your sound card as the MIDI device.
You can then export your track as a WAV file and chop it up into individual notes using Audacity. You can then export each individual note as a separate MP3, and load them into your game.
Note that I’m using the word “soundcard” very loosely here: in many cases sound hardware is onboard nowadays. The point is your computer will have sounds you need built in.
You could also take one piano note sample and simply play it at different pitches, but the issue here is it will only sound good within a smallish range of notes - maybe an octave maximum.
Whereas your computer’s sound hardware is likely to have a piano as a wave table instrument that uses multiple or many samples or fragments of samples for each note and will sound better, though possibly still a bit synthetic.