Beispiel #1
0
        private void Update()
        {
            var processor = new ImpulsePresetProcessor(preset);
            var output    = processor.Process();

            outputIr = new[] { output[0].Select(x => (float)x).ToArray(), output[1].Select(x => (float)x).ToArray() };

            // convert final, commplete output back to Fft to show the final frequency response

            var fftTransform = new LowProfile.Fourier.Double.Transform(outputIr.Length);

            var timeDomainLeft = outputIr[0].Select(x => (Complex)x).ToArray();

            fftLeft = new Complex[timeDomainLeft.Length];
            fftTransform.FFT(timeDomainLeft, fftLeft);

            var timeDomainRight = outputIr[1].Select(x => (Complex)x).ToArray();

            fftRight = new Complex[timeDomainRight.Length];
            fftTransform.FFT(timeDomainRight, fftRight);

            UpdateMemoryMap();

            foreach (var vm in ImpulseConfig)
            {
                vm.ImpulseConfigOutputs = processor.StageOutputs;
            }

            UpdateFftPlot();
            UpdateTimePlot();
        }
Beispiel #2
0
        private static void Export(int length, int samplerate, string source, string dest, bool mono)
        {
            var presetFiles = Directory.GetFiles(source, "*.irw");

            foreach (var file in presetFiles)
            {
                var json   = File.ReadAllText(file);
                var preset = Serializer.PresetSerializer.DeserializePreset(json);
                preset.SamplerateTransformed    = samplerate;
                preset.ImpulseLengthTransformed = length;

                var processor = new ImpulsePresetProcessor(preset);
                var output    = processor.Process();

                var targetFile = Path.GetFileNameWithoutExtension(file) + ".wav";
                targetFile = Path.Combine(dest, targetFile);

                var targetLFile = Path.GetFileNameWithoutExtension(file) + "-L.wav";
                targetLFile = Path.Combine(dest, targetLFile);

                var targetRFile = Path.GetFileNameWithoutExtension(file) + "-R.wav";
                targetRFile = Path.Combine(dest, targetRFile);

                if (!Directory.Exists(dest))
                {
                    Directory.CreateDirectory(dest);
                }

                if (mono)
                {
                    WaveFiles.WriteWaveFile(new[] { output[0] }, WaveFiles.WaveFormat.PCM24Bit, preset.SamplerateTransformed, targetFile);
                }
                else
                {
                    WaveFiles.WriteWaveFile(output, WaveFiles.WaveFormat.PCM24Bit, preset.SamplerateTransformed, targetFile);
                    WaveFiles.WriteWaveFile(new[] { output[0] }, WaveFiles.WaveFormat.PCM24Bit, preset.SamplerateTransformed, targetLFile);
                    WaveFiles.WriteWaveFile(new[] { output[1] }, WaveFiles.WaveFormat.PCM24Bit, preset.SamplerateTransformed, targetRFile);
                }
            }
        }