public static WavInfo GetNote(string note, int pressLevel, double duration) { var settings = PianoSettings.Instance(); return(WavEditor.Modify( WavIO.Load($"D:\\Projects\\PianoGenerator\\PianoGenerator\\bin\\Debug\\Resources\\Notes\\{settings.GetNoteName(note, pressLevel)}") ) .FreezeRegion(0, duration) .MultiplyWith((double x, double i) => Math.Max(0, 1 - settings.GetReleaseKeyK() * i), true) .GetWav()); }
static void CutNotes() { var files = Directory.EnumerateFiles(Directory.GetCurrentDirectory() + @"\\Resources\\Notes"); foreach (var filePath in files) { var fileName = Path.GetFileName(filePath); var wav = WavIO.Load(filePath); var nwav = WavEditor.Modify(wav).Cut(val => Math.Abs((int)val) > 20000, val => Math.Abs((int)val) > 20000, 0.3f, 2f); WavIO.Save("D:\\Projects\\PianoGenerator\\PianoGenerator\\bin\\Debug\\Resources\\Notes\\Cut\\" + fileName, nwav.GetWav()); Console.WriteLine($"'{fileName}' done."); } }