public void TestPhaseVocoding() { //string baseFile = "Boston_HitchARide"; string baseFile = "000000"; WaveEncoding.LoadBGCSimple( filepath: DataManagement.PathForDataFile("Test", $"{baseFile}.wav"), simpleAudioClip: out SimpleAudioClip song); song = song.Window(10f).Cache(); //First, write unmodified WaveEncoding.SaveFile( filepath: DataManagement.PathForDataFile("Test", $"{baseFile}_Unmodified.wav"), channels: song.Channels, sampleRate: (int)song.SamplingRate, samples: song.Samples, overwrite: true); //Next, Slow it down 5% { SimpleAudioClip slowed_05 = song.PhaseVocode(0.95f).Cache(); //Next, write it slowed 5% WaveEncoding.SaveFile( filepath: DataManagement.PathForDataFile("Test", $"{baseFile}_Slowed_05.wav"), channels: slowed_05.Channels, sampleRate: (int)slowed_05.SamplingRate, samples: slowed_05.Samples, overwrite: true); } //Next, Slow it down 25% { SimpleAudioClip slowed_25 = song.PhaseVocode(0.75f).Cache(); //Next, write it slowed 5% WaveEncoding.SaveFile( filepath: DataManagement.PathForDataFile("Test", $"{baseFile}_Slowed_25.wav"), channels: slowed_25.Channels, sampleRate: (int)slowed_25.SamplingRate, samples: slowed_25.Samples, overwrite: true); } //Next, Slow it down 50% { SimpleAudioClip slowed_50 = song.PhaseVocode(0.5f).Cache(); //Next, write it slowed 5% WaveEncoding.SaveFile( filepath: DataManagement.PathForDataFile("Test", $"{baseFile}_Slowed_50.wav"), channels: slowed_50.Channels, sampleRate: (int)slowed_50.SamplingRate, samples: slowed_50.Samples, overwrite: true); } }
public void UpScalingTest() { float[] singleChannelSamples = CreateSineWave(1, 22050f); string upscaledFile = DataManagement.PathForDataFile("Test", "upscaled.wav"); IBGCStream stream = new SimpleAudioClip( samples: LinearInterpolation.FactorUpscaler( samples: singleChannelSamples, factor: 2, channels: 1), channels: 1); Assert.IsTrue(WaveEncoding.SaveStream( filepath: upscaledFile, stream: stream, overwrite: true)); }