Here's how: Let's say the user likes a combination of tones that played from 3 seconds to 4 seconds. All samples that have already been played are stored in the global field of all sound samples. Therefore, there is no need to regenerate tones and their combination, just copy it. The start of copying is in time 3 seconds, that is, from sample 44100 * 3, the end is in time 4 seconds, that is to sample 44100 * 4. That global field of all samples is RawMusic field, see line 124 of the program source code, which output saves as WAV.