Пример #1
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            await AudioEffect.DoStuff();

            var p = new FilterRack.FilterRack(AudioEffect.Instance);

            p.Show();
        }
        private async void OpenEffectsRack_Click(object sender, RoutedEventArgs e)
        {
            await AudioEffect.Instance.SetSource(AudioEffect.CreateSource(AudioFiles.FirstOrDefault()?.InputFile.FullName));

            var p = new FilterRack.FilterRack(AudioEffect.Instance);

            p.Show();
            //AudioEffect.Instance.StartLivePlay();
            FilterRackOpen = true;
        }
Пример #3
0
        public async Task <AudioEffect> CopyFor(FileInfo audioFileInputFile)
        {
            var result = new AudioEffect();
            await result.SetSource(AudioEffect.CreateSource(audioFileInputFile.FullName));

            foreach (var filter in Filters)
            {
                result.Filters.Add(filter.Clone());
            }
            result.DoFilterFullPass();

            return(result);
        }
Пример #4
0
        public static async Task DoStuff()
        {
            var            test           = CodecFactory.SupportedFilesFilterEn;
            OpenFileDialog openFileDialog = new OpenFileDialog {
                Filter = CodecFactory.SupportedFilesFilterEn
            };

            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var effect = Instance;
            await effect.SetSource(AudioEffect.CreateSource(openFileDialog.FileName));

            effect.Filters.Add(new HighpassFilter(effect.SampleRate, 520));  // Console.WriteLine("HighpassFilter @4kHz");
            effect.Filters.Add(new LowpassFilter(effect.SampleRate, 1300));  // Console.WriteLine("LowpassFilter @1kHz");
            //effect.Filters.Add(new PeakFilter(effect.SampleRate, 2000, 15, 10)); // Console.WriteLine("PeakFilter @2kHz; bandWidth = 15; gain = 10dB");
            effect.Filters.Add(new FoldbackFilter());                        // Console.WriteLine("PeakFilter @2kHz; bandWidth = 15; gain = 10dB");
            effect.Filters.Add(new RingmodulationFilter(effect.SampleRate)); // Console.WriteLine("PeakFilter @2kHz; bandWidth = 15; gain = 10dB");
            //effect.StartLivePlay();
            //var outPath = TempFileManager.Instance.GetNewTempFileExt(".wav");
            //effect.source.ToWaveSource().WriteToFile(outPath);
            //
            //AudioEncoder encoder = new AudioEncoder();
            //
            //var queue = new ConcurrentQueue<AudioConversionItem>();
            //queue.Enqueue(new AudioConversionItem
            //{
            //    Bitrate = 192000,
            //    InputFile = new FileInfo(outPath),
            //    OutputPath = TempFileManager.Instance.GetNewTempFileExt(".ogg"),
            //    SampleRate = effect.SampleRate
            //});
            //
            //await encoder.AudioConvert(queue, CancellationToken.None);
        }
Пример #5
0
 public BiQuadFilterSource(ISampleSource source, AudioEffect effect) : base(source)
 {
     _effect = effect;
 }