public void BuildKeySound()
        {
            Task.Run(() =>
            {
                isWorking = true;
                NotifyOfPropertyChange(() => CanListenDemo);
                NotifyOfPropertyChange(() => CanBuildKeySound);
                NotifyOfPropertyChange(() => CanOpenSoundfont2);

                if (NeedParseDir && !string.IsNullOrEmpty(ParseDir))
                {
                    DirectoryInfo parseDirInfo = new DirectoryInfo(ParseDir);
                    if (!parseDirInfo.Exists)
                    {
                        MessageBox.Show("Can't find parse dir");
                        goto clean;
                    }
                    foreach (var files in parseDirInfo.GetFiles())
                    {
                        if (files.Extension == ".wav" ||
                            files.Extension == ".ogg" ||
                            files.Extension == ".mp3")
                        {
                            string ksFile           = files.Name;
                            string ksFileWithoutExt = ksFile.Substring(0, ksFile.LastIndexOf('.'));
                            string[] ksArg          = ksFileWithoutExt.Split('_');
                            int instrVal            = int.Parse(ksArg[0]);
                            int pitchIdxVal         = 0;
                            int OctaveIdxVal        = 0;
                            if (ksArg[1].Contains("#"))
                            {
                                pitchIdxVal  = PitchName.IndexOf(ksArg[1].Substring(0, 2));
                                OctaveIdxVal = int.Parse(ksArg[1].Substring(2, ksArg[1].Length - 2));
                            }
                            else
                            {
                                pitchIdxVal  = PitchName.IndexOf(ksArg[1].Substring(0, 1));
                                OctaveIdxVal = int.Parse(ksArg[1].Substring(1, ksArg[1].Length - 1));
                            }
                            int keyVal       = pitchIdxVal + (OctaveIdxVal + 2) * 12;
                            int bpmVal       = int.Parse(ksArg[2]);
                            double lengthVal = double.Parse(ksArg[3]) / 480;

                            string tmpDir = Path.GetTempPath();
                            if (BuildTypeMid)
                            {
                                string midiFilename = $"{OutputDir}\\{ksFileWithoutExt}.mid";
                                maker.GenKeySoundMidi(midiFilename, instrVal, keyVal, bpmVal, lengthVal, 115, false);
                                OutputFilename = midiFilename;
                            }
                            else
                            {
                                string midiFilename = $"{tmpDir}\\{ksFileWithoutExt}.mid";
                                maker.GenKeySoundMidi(midiFilename, instrVal, keyVal, bpmVal, lengthVal, 115, false);
                                if (BuildTypeWav)
                                {
                                    string wavFilename = $"{OutputDir}\\{ksFileWithoutExt}.wav";
                                    maker.SetOutputFilename(wavFilename);
                                    maker.RenderMiditoWav(midiFilename);
                                    OutputFilename = wavFilename;
                                }
                                else
                                {
                                    string wavFilename = $"{tmpDir}\\{ksFileWithoutExt}.wav";
                                    maker.SetOutputFilename(wavFilename);
                                    maker.RenderMiditoWav(midiFilename);
                                    string mp3Filename = $"{OutputDir}\\{ksFileWithoutExt}.mp3";
                                    maker.EncodeWavtoMp3(wavFilename, mp3Filename);
                                    OutputFilename = mp3Filename;
                                }
                            }
                        }
                    }
                    goto clean;
                }

                int instrument;
                int key;
                if (!IsDrum)
                {
                    key        = PitchIdx + (OctaveIdx + 1) * 12;
                    instrument = InstTypeIdx * 8 + InstNameIdx;
                }
                else
                {
                    instrument = 0;
                    key        = 35 + InstNameIdx;
                }
                if (key > 127)
                {
                    MessageBox.Show("No such key");
                }
                else
                {
                    int tick        = (int)(480 * Length);
                    string filename = MusicTheory.GetFileName(instrument, key, (int)Bpm, (int)tick, Volume, IsDrum);
                    string tmpDir   = System.IO.Path.GetTempPath();
                    if (BuildTypeMid)
                    {
                        string midiFilename = $"{OutputDir}\\{filename}.mid";
                        maker.GenKeySoundMidi(midiFilename, instrument, key, Bpm, Length, Volume, IsDrum);
                        OutputFilename = midiFilename;
                    }
                    else
                    {
                        string midiFilename = $"{tmpDir}\\{filename}.mid";
                        maker.GenKeySoundMidi(midiFilename, instrument, key, Bpm, Length, Volume, IsDrum);
                        if (BuildTypeWav)
                        {
                            string wavFilename = $"{OutputDir}\\{filename}.wav";
                            maker.SetOutputFilename(wavFilename);
                            maker.RenderMiditoWav(midiFilename);
                            OutputFilename = wavFilename;
                        }
                        else
                        {
                            string wavFilename = $"{tmpDir}\\{filename}.wav";
                            maker.SetOutputFilename(wavFilename);
                            maker.RenderMiditoWav(midiFilename);
                            string mp3Filename = $"{OutputDir}\\{filename}.mp3";
                            maker.EncodeWavtoMp3(wavFilename, mp3Filename);
                            OutputFilename = mp3Filename;
                        }
                    }
                }

                clean: isWorking = false;
                NotifyOfPropertyChange(() => CanListenDemo);
                NotifyOfPropertyChange(() => CanBuildKeySound);
                NotifyOfPropertyChange(() => CanOpenSoundfont2);
            });
        }