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());
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
            customCulture.NumberFormat.NumberDecimalSeparator = ".";

            System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

            var generator = new PianoGenerator();

            generator.Generate(@"D:\Projects\PianoGenerator\PianoGenerator\source2.txt");
            var wav = generator.GetWav();

            WavIO.Save("D:\\Projects\\PianoGenerator\\PianoGenerator\\bin\\Debug\\Resources\\1.wav", wav);
        }
Esempio n. 3
0
        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.");
            }
        }