Use MathGL to generate piano sound using OpenAL in Kolin
This article demonstrates how to use MathGL to generate a sine wave and modify it using a cosine envelope and transfer that data to the OpenAL
MathGL is a versatile matrix and array manipulation library, It can be used for stats, numerical methods, simulation, graphics, games etc.,
This article peculiarly uses it for creating an audio. Audio is simply a sequence by bytes sent an amplifier and a speaker.
Therefore it can be generated using any numerical methodology and set in an array of bytes.
Below code explains how it is done.
Full Kotlin code