void ProcessFile(string filePath) { string[] validExtensions = { ".fxp", ".fxb", ".h2p", ".xps" }; var fileInfo = new FileInfo(filePath); if (validExtensions.Contains(fileInfo.Extension)) { // read preset file var sylenth1 = new Sylenth1Preset(); if (sylenth1.Read(fileInfo.FullName)) { txtContent.AppendText(sylenth1.ToString()); } // read preset file var uadSSLChannel = new UADSSLChannel(); if (uadSSLChannel.Read(fileInfo.FullName)) { txtContent.AppendText(uadSSLChannel.ToString()); } #region Waves preset reading var ssl = new WavesSSLChannel(); var sslcomp = new WavesSSLComp(); using (var stringWriter = new StringWriter()) { if (ssl.ReadXps(fileInfo.FullName, stringWriter)) { txtContent.AppendText(stringWriter.ToString()); } if (sslcomp.ReadXps(fileInfo.FullName, stringWriter)) { txtContent.AppendText(stringWriter.ToString()); } } #endregion var zebra = new Zebra2Preset(); if (zebra.Read(fileInfo.FullName)) { txtContent.AppendText(zebra.GetReadableOscillatorInfo()); txtContent.AppendText(zebra.GetReadableEnvelopeInfo()); txtContent.AppendText(zebra.GetReadableLFOInfo()); txtContent.AppendText(zebra.GetReadableFilterInfo()); } } }
public static void Main(string[] args) { //Zebra2Preset.GenerateClassFields(@"C:\Users\perivar.nerseth\Documents\My Projects\AudioVSTToolbox\PresetConverter\_SharedResources\Zebra2-Default Sylenth1 Template.h2p", @"C:\Users\perivar.nerseth\Documents\My Projects\AudioVSTToolbox\PresetConverter\_SharedResources\properties.cs"); //Zebra2Preset.GenerateWriteMethod(@"C:\Users\perivar.nerseth\Documents\My Projects\AudioVSTToolbox\PresetConverter\_SharedResources\Zebra2-Default Sylenth1 Template.h2p", @"C:\Users\perivar.nerseth\Documents\My Projects\AudioVSTToolbox\PresetConverter\_SharedResources\getpreset.cs"); bool processDirectory = false; bool doProcessInitPresets = false; bool doOutputSylenthPresetTextDump = false; bool doDebug = false; // Command line parsing string presetInputFileOrDirectory = ""; string presetOutputFileDirectoryPath = ""; Arguments CommandLine = new Arguments(args); if (CommandLine["in"] != null) { presetInputFileOrDirectory = CommandLine["in"]; } if (CommandLine["out"] != null) { presetOutputFileDirectoryPath = CommandLine["out"]; } if (CommandLine["init"] != null) { doProcessInitPresets = true; } if (CommandLine["text"] != null) { doOutputSylenthPresetTextDump = true; } if (CommandLine["debug"] != null) { doDebug = true; } if (presetInputFileOrDirectory == "" || presetOutputFileDirectoryPath == "") { PrintUsage(); return; } // Build preset file paths string sylenthPresetDirString = ""; string sylenthPreset = ""; // check if input is file or directory if (IOUtils.IsDirectory(presetInputFileOrDirectory)) { sylenthPresetDirString = presetInputFileOrDirectory; processDirectory = true; } else { sylenthPreset = presetInputFileOrDirectory; processDirectory = false; } // define default sylenth template for Zebra2 string zebra2_Sylenth1_PresetTemplate = @"Zebra2-Default Sylenth1 Template.h2p"; IEnumerable <FileInfo> presetFiles; if (processDirectory) { // process directory DirectoryInfo sylenthPresetDir = new DirectoryInfo(sylenthPresetDirString); presetFiles = sylenthPresetDir.GetFilesByExtensions(".fxb", ".fxp"); Console.WriteLine("Processing {0} files in directory: '{1}' ...", presetFiles.Count(), sylenthPresetDir.Name); IOUtils.LogMessageToFile(outputStatusLog, String.Format("Processing {0} files in directory: '{1}' ...", presetFiles.Count(), sylenthPresetDir.Name)); } else { // process single preset FileInfo sylenthPresetFile = new FileInfo(sylenthPreset); presetFiles = new FileInfo[] { sylenthPresetFile }; Console.WriteLine("Processing preset file '{0}' ...", sylenthPresetFile.Name); IOUtils.LogMessageToFile(outputStatusLog, String.Format("Processing preset file '{0}' ...", sylenthPresetFile.Name)); } foreach (FileInfo presetFile in presetFiles) { // read preset file Sylenth1Preset sylenth1 = new Sylenth1Preset(); if (doDebug) { sylenth1.logLevel = Sylenth1Preset.LogLevel.Debug; } if (sylenth1.Read(presetFile.FullName)) { // Output a dump of the Sylenth1 Preset File if (doOutputSylenthPresetTextDump) { string outSylenthPresetTextDumpPath = Path.GetFileNameWithoutExtension(presetFile.Name) + "_Text.txt"; TextWriter tw = new StreamWriter(outSylenthPresetTextDumpPath); tw.WriteLine(sylenth1); tw.Close(); } // define output dir string outputDir = ""; if (presetFile.Name.EndsWith(".fxb")) { outputDir = Path.Combine(presetOutputFileDirectoryPath, Path.GetFileNameWithoutExtension(presetFile.Name)); if (!Directory.Exists(outputDir)) { Directory.CreateDirectory(outputDir); } } else { outputDir = presetOutputFileDirectoryPath; } // and convert to zebra 2 List <Zebra2Preset> zebra2ConvertedList = sylenth1.ToZebra2Preset(zebra2_Sylenth1_PresetTemplate, doProcessInitPresets); int count = 1; foreach (Zebra2Preset zebra2Converted in zebra2ConvertedList) { string presetName = StringUtils.MakeValidFileName(zebra2Converted.PresetName); string zebraGeneratedPreset = Path.Combine(outputDir, String.Format("{0:000}_{1}.h2p", zebra2Converted.BankIndex, presetName)); zebra2Converted.Write(zebraGeneratedPreset); count++; } } } }
private static void SetZebraArpeggiatorNoteFromSylenth(Zebra2Preset z2, float storedSylenthArpGateValue, Sylenth1Preset.ONOFF arpHoldValue, float storedSylenthArpTransposeValue, float storedSylenthArpVelocityValue, int index) { // TODO: use storedSylenthArpGateValue for something? // range: 0% - 100% float arpGatePercentage = MathUtils.ConvertAndMainainRatio(storedSylenthArpGateValue, 0, 1, 0, 100); // TODO: use storedSylenthArpVelocityValue for something? // range = 0 - 127 float arpGateVelocity = MathUtils.ConvertAndMainainRatio(storedSylenthArpVelocityValue, 0, 1, 0, 127); string arpGateFieldName = "VCC_Agte" + index; // Gate range: 0 - 5 (2 = Default) int arpGateFieldValue = 2; if (arpHoldValue == Sylenth1Preset.ONOFF.On) { arpGateFieldValue = 5; } // If the velocity is 0 - use the Sylenth1Preset.VOICES to "zero" this note // set Sylenth1Preset.VOICES to 0 as well if (arpGateVelocity == 0) { arpGateFieldValue = 0; } ObjectUtils.SetField(z2, arpGateFieldName, arpGateFieldValue); string arpTransposeFieldName = "VCC_Atrp" + index; // Transpose range: -12 - 0 - 12 (0 = Default) int arpTransposeFieldValue = 0; Sylenth1Preset.ARPTRANSPOSE transpose = Sylenth1Preset.ArpeggiatorTransposeFloatToEnum(storedSylenthArpTransposeValue); switch (transpose) { case Sylenth1Preset.ARPTRANSPOSE.MINUS_24: arpTransposeFieldValue = -12; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_23: arpTransposeFieldValue = -11; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_22: arpTransposeFieldValue = -10; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_21: arpTransposeFieldValue = -9; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_20: arpTransposeFieldValue = -8; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_19: arpTransposeFieldValue = -7; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_18: arpTransposeFieldValue = -6; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_17: arpTransposeFieldValue = -5; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_16: arpTransposeFieldValue = -4; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_15: arpTransposeFieldValue = -3; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_14: arpTransposeFieldValue = -2; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_13: arpTransposeFieldValue = -1; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_12: arpTransposeFieldValue = -12; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_11: arpTransposeFieldValue = -11; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_10: arpTransposeFieldValue = -10; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_9: arpTransposeFieldValue = -9; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_8: arpTransposeFieldValue = -8; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_7: arpTransposeFieldValue = -7; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_6: arpTransposeFieldValue = -6; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_5: arpTransposeFieldValue = -5; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_4: arpTransposeFieldValue = -4; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_3: arpTransposeFieldValue = -3; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_2: arpTransposeFieldValue = -2; break; case Sylenth1Preset.ARPTRANSPOSE.MINUS_1: arpTransposeFieldValue = -1; break; case Sylenth1Preset.ARPTRANSPOSE.ZERO: arpTransposeFieldValue = 0; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_1: arpTransposeFieldValue = 1; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_2: arpTransposeFieldValue = 2; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_3: arpTransposeFieldValue = 3; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_4: arpTransposeFieldValue = 4; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_5: arpTransposeFieldValue = 5; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_6: arpTransposeFieldValue = 6; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_7: arpTransposeFieldValue = 7; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_8: arpTransposeFieldValue = 8; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_9: arpTransposeFieldValue = 9; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_10: arpTransposeFieldValue = 10; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_11: arpTransposeFieldValue = 11; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_12: arpTransposeFieldValue = 12; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_13: arpTransposeFieldValue = 1; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_14: arpTransposeFieldValue = 2; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_15: arpTransposeFieldValue = 3; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_16: arpTransposeFieldValue = 4; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_17: arpTransposeFieldValue = 5; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_18: arpTransposeFieldValue = 6; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_19: arpTransposeFieldValue = 7; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_20: arpTransposeFieldValue = 8; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_21: arpTransposeFieldValue = 9; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_22: arpTransposeFieldValue = 10; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_23: arpTransposeFieldValue = 11; break; case Sylenth1Preset.ARPTRANSPOSE.PLUSS_24: arpTransposeFieldValue = 12; break; } ObjectUtils.SetField(z2, arpTransposeFieldName, arpTransposeFieldValue); string arpVoicesFieldName = "VCC_Avoc" + index; // Sylenth1Preset.VOICES range: 0 - 6 (1 = Default) int arpVoicesFieldValue = 6; // If the velocity is 0 - use the Sylenth1Preset.VOICES to "zero" this note if (arpGateVelocity == 0) { arpVoicesFieldValue = 0; } ObjectUtils.SetField(z2, arpVoicesFieldName, arpVoicesFieldValue); string arpDurationFieldName = "VCC_Amul" + index; // Duration range: 1 - 4 (1 = Default) // 4 = quarter // 3 = eigth dotted // 2 = eigth // 1 = sixteenth const int arpDurationFieldValue = (int)Zebra2Preset.ArpNoteDuration.Sixteenth; ObjectUtils.SetField(z2, arpDurationFieldName, arpDurationFieldValue); string arpStepControlFieldName = "VCC_Amod" + index; // Step range: // Next = 0, // Same = 1, // First = 2, // Last = 3 const int arpStepControlFieldValue = (int) Zebra2Preset.ArpNoteStep.Next; ObjectUtils.SetField(z2, arpStepControlFieldName, arpStepControlFieldValue); string arpStepModAFieldName = "VCC_AMDpt" + index; const float arpStepModAFieldValue = 00.00f; ObjectUtils.SetField(z2, arpStepModAFieldName, arpStepModAFieldValue); string arpStepModBFieldName = "VCC_AMDpB" + index; const float arpStepModBFieldValue = 00.00f; ObjectUtils.SetField(z2, arpStepModBFieldName, arpStepModBFieldValue); }
private void SetZebraModSourcesFromSylenth(Sylenth1Preset.Syl1PresetContent s1, Zebra2Preset z2, Sylenth1Preset.XMODSOURCE sylenthModSource, Sylenth1Preset.YMODDEST sylenthModDestination, float sylenthXModDestAm, Dictionary<string,List<string>> processedModulationSourceAndDest) { if (sylenthModSource != Sylenth1Preset.XMODSOURCE.SOURCE_None && sylenthModDestination != Sylenth1Preset.YMODDEST.None) { Logger.DoDebug(String.Format("Processing Sylenth1 Modulation Source: {0}, Destination: {1}, Preset-file Depth: {2}", sylenthModSource, sylenthModDestination, sylenthXModDestAm)); Zebra2Preset.ModulationSource zebraModSource = ConvertSylenthModSourceToZebra(sylenthModSource); string zebraModSourceFieldName = null; Object zebraModSourceFieldValue = null; string zebraModDepthFieldName = null; Object zebraModDepthFieldValue = null; // use List to store modulation pairs var modPairs = new List<ZebraModulationPair>(); // Filters have real range is -150 to 150) // Increase the Cutoff modulation depth values slightly (20% seem to work better) //float CutoffModDepthValue = (float) (ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -150, 150) * 1.20); float CutoffModDepthValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -150, 150); switch (sylenthModDestination) { case Sylenth1Preset.YMODDEST.None: // should never get here break; // Oscillators case Sylenth1Preset.YMODDEST.Volume_A: // Volume A: zebraModSourceFieldName = "OSC1_VolSc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC1_VolDt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC2_VolSc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC2_VolDt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.Volume_B: // Volume B: zebraModSourceFieldName = "OSC3_VolSc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC3_VolDt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC4_VolSc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC4_VolDt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.VolumeAB: // Volume A: zebraModSourceFieldName = "OSC1_VolSc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC1_VolDt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC2_VolSc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC2_VolDt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); // Volume B: zebraModSourceFieldName = "OSC3_VolSc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC3_VolDt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC4_VolSc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC4_VolDt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.Pitch_A: // TMSrc = Tune Modulation Source // TMDpt = Tune Modulation Depth zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldValue = ConvertSylenthModDepthPitchValueToZebra(sylenthXModDestAm); zebraModSourceFieldName = "OSC1_TMSrc"; zebraModDepthFieldName = "OSC1_TMDpt"; modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC2_TMSrc"; zebraModDepthFieldName = "OSC2_TMDpt"; modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.Pitch_B: // TMSrc = Tune Modulation Source // TMDpt = Tune Modulation Depth zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldValue = ConvertSylenthModDepthPitchValueToZebra(sylenthXModDestAm); zebraModSourceFieldName = "OSC3_TMSrc"; zebraModDepthFieldName = "OSC3_TMDpt"; modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC4_TMSrc"; zebraModDepthFieldName = "OSC4_TMDpt"; modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.Pitch_AB: zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldValue = ConvertSylenthModDepthPitchValueToZebra(sylenthXModDestAm); zebraModSourceFieldName = "OSC1_TMSrc"; zebraModDepthFieldName = "OSC1_TMDpt"; modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC2_TMSrc"; zebraModDepthFieldName = "OSC2_TMDpt"; modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC3_TMSrc"; zebraModDepthFieldName = "OSC3_TMDpt"; modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC4_TMSrc"; zebraModDepthFieldName = "OSC4_TMDpt"; modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.Phase_A: // PhsMSrc = PhaseModSrc // PhsMDpt = PhaseModDepth zebraModSourceFieldName = "OSC1_PhsMSrc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC1_PhsMDpt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -50, 50); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC2_PhsMSrc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC2_PhsMDpt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -50, 50); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.Phase_B: // PhsMSrc = PhaseModSrc // PhsMDpt = PhaseModDepth zebraModSourceFieldName = "OSC3_PhsMSrc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC3_PhsMDpt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -50, 50); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC4_PhsMSrc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC4_PhsMDpt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -50, 50); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.Phase_AB: // PhsMSrc = PhaseModSrc // PhsMDpt = PhaseModDepth zebraModSourceFieldName = "OSC1_PhsMSrc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC1_PhsMDpt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -50, 50); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC2_PhsMSrc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC2_PhsMDpt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -50, 50); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC3_PhsMSrc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC3_PhsMDpt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -50, 50); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "OSC4_PhsMSrc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "OSC4_PhsMDpt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -50, 50); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.Pan_A: // Pan A: zebraModSourceFieldName = "VCA1_PanMS1"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "VCA1_PanMD1"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); // Pan Mod Dpt1 modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.Pan_B: // Pan B: zebraModSourceFieldName = "VCA1_PanMS2"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "VCA1_PanMD2"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); // Pan Mod Dpt2 modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.Pan_AB: // Pan A and B: zebraModSourceFieldName = "VCA1_PanMS1"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "VCA1_PanMD1"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); // Pan Mod Dpt1 modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "VCA1_PanMS2"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "VCA1_PanMD2"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); // Pan Mod Dpt2 modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; // Filters // The target for a '...' knob is usually the parameter to its immediate left. // The two filter modules (VCF and XMF) are exceptions to the above rule. // By all appearances, the two unlabeled knobs should affect Resonance // – in fact they both modulate Cutoff. // FS1 = Modsource1 // FM1 = ModDepth1 (-150 - 150) // FS2 = Modsource2 // FM2 = ModDepth2 (-150 - 150) case Sylenth1Preset.YMODDEST.Cutoff_A: zebraModSourceFieldName = "VCF1_FS1"; zebraModDepthFieldName = "VCF1_FM1"; if (_zebraUsedModSources.Contains(zebraModSourceFieldName)) { // already used the first cutoff knob zebraModSourceFieldName = "VCF1_FS2"; zebraModDepthFieldName = "VCF1_FM2"; } zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldValue = CutoffModDepthValue; modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.Cutoff_B: zebraModSourceFieldName = "VCF2_FS1"; zebraModDepthFieldName = "VCF2_FM1"; if (_zebraUsedModSources.Contains(zebraModSourceFieldName)) { // already used the first cutoff knob zebraModSourceFieldName = "VCF2_FS2"; zebraModDepthFieldName = "VCF2_FM2"; } zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldValue = CutoffModDepthValue; modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.CutoffAB: zebraModSourceFieldName = "VCF1_FS1"; zebraModDepthFieldName = "VCF1_FM1"; if (_zebraUsedModSources.Contains(zebraModSourceFieldName)) { // already used the first cutoff knob zebraModSourceFieldName = "VCF1_FS2"; zebraModDepthFieldName = "VCF1_FM2"; } zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldValue = CutoffModDepthValue; modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); zebraModSourceFieldName = "VCF2_FS1"; zebraModDepthFieldName = "VCF2_FM1"; if (_zebraUsedModSources.Contains(zebraModSourceFieldName)) { // already used the first cutoff knob zebraModSourceFieldName = "VCF2_FS2"; zebraModDepthFieldName = "VCF2_FM2"; } zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldValue = CutoffModDepthValue; modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.Reso_A: zebraModSourceFieldName = "VCF1_FS2"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "VCF1_FM2"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -150, 150); // Force using the Mod Matrix since resonance cannot be modulated by any other means modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue, true)); break; case Sylenth1Preset.YMODDEST.Reso_B: zebraModSourceFieldName = "VCF2_FS2"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "VCF2_FM2"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -150, 150); // Force using the Mod Matrix since resonance cannot be modulated by any other means modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue, true)); break; case Sylenth1Preset.YMODDEST.Reso_AB: zebraModSourceFieldName = "VCF1_FS2"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "VCF1_FM2"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -150, 150); // Force using the Mod Matrix since resonance cannot be modulated by any other means modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue, true)); zebraModSourceFieldName = "VCF2_FS2"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "VCF2_FM2"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -150, 150); // Force using the Mod Matrix since resonance cannot be modulated by any other means modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue, true)); break; // Misc case Sylenth1Preset.YMODDEST.PhsrFreq: zebraModSourceFieldName = "ModFX1_Sped"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "DUMMY"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -150, 150); // Force using the Mod Matrix since the phaser cannot be modulated by any other means modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue, true)); break; case Sylenth1Preset.YMODDEST.Mix_A: // Volume A: zebraModSourceFieldName = "VCA1_ModSrc1"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "VCA1_ModDpt1"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); // Force using the Mod Matrix since volume cannot be modulated by any other means _zebraUsedModSources.Add(zebraModSourceFieldName); break; case Sylenth1Preset.YMODDEST.Mix_B: // Volume B: zebraModSourceFieldName = "VCA1_ModSrc2"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "VCA1_ModDpt2"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); // Mod Depth2 modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); // Force using the Mod Matrix since volume cannot be modulated by any other means _zebraUsedModSources.Add(zebraModSourceFieldName); break; case Sylenth1Preset.YMODDEST.Mix_AB: // Volume A and B: zebraModSourceFieldName = "VCA1_ModSrc1"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "VCA1_ModDpt1"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); // Mod Depth1 modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); // Force using the Mod Matrix since volume cannot be modulated by any other means _zebraUsedModSources.Add(zebraModSourceFieldName); zebraModSourceFieldName = "VCA1_ModSrc2"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "VCA1_ModDpt2"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); // Mod Depth2 modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); // Force using the Mod Matrix since volume cannot be modulated by any other means _zebraUsedModSources.Add(zebraModSourceFieldName); break; case Sylenth1Preset.YMODDEST.LFO1Rate: // FMS = FreqMod Src1=none // FMD = FreqMod Dpt (-100.00 - 100.00) zebraModSourceFieldName = "LFO1_FMS1"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "LFO1_FMD1"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); // Force using the Mod Matrix since e.g. LFO1 rate or gain cannot be modulated by any other LFO modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue, true)); break; case Sylenth1Preset.YMODDEST.LFO1Gain: // DMS = DepthMod Src1=none // DMD = DepthMod Dpt1 (0.00 - 100.00) zebraModSourceFieldName = "LFO1_DMS1"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "LFO1_DMD1"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, 0, 100); // Force using the Mod Matrix since e.g. LFO1 rate or gain cannot be modulated by any other LFO modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue, true)); break; case Sylenth1Preset.YMODDEST.LFO2Rate: // FMS = FreqMod Src1=none // FMD = FreqMod Dpt (-100.00 - 100.00) zebraModSourceFieldName = "LFO2_FMS1"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "LFO2_FMD1"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.LFO2Gain: // DMS = DepthMod Src1=none // DMD = DepthMod Dpt1 (0.00 - 100.00) zebraModSourceFieldName = "LFO2_DMS1"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "LFO2_DMD1"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, 0, 100); modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue)); break; case Sylenth1Preset.YMODDEST.DistAmnt: // DMSrc = D_ModSrc=none // DMDpt = D_ModDepth zebraModSourceFieldName = "Dist3_DMSrc"; zebraModSourceFieldValue = (int) zebraModSource; zebraModDepthFieldName = "Dist3_DMDpt"; zebraModDepthFieldValue = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); // Force using the Mod Matrix since it's impossible to modulate distortion directly on the distortion channel modPairs.Add(new ZebraModulationPair(zebraModSourceFieldName, zebraModSourceFieldValue, zebraModDepthFieldName, zebraModDepthFieldValue, true)); break; } // Use var keyword to enumerate dictionary foreach (ZebraModulationPair modElement in modPairs) { SetZebraModSourceFromSylenth(s1, z2, modElement.ZebraModSourceFieldName, modElement.ZebraModSourceFieldValue, modElement.ZebraModDepthFieldName, modElement.ZebraModDepthFieldValue, modElement.DoForceModMatrix, sylenthModSource, sylenthModDestination, sylenthXModDestAm, processedModulationSourceAndDest); } } }
private static Zebra2Preset.FilterType ConvertSylenthFilterToZebra(Sylenth1Preset.FILTERTYPE filterType, Sylenth1Preset.FILTERDB filterDb, Sylenth1Preset.ONOFF filterCtlWarmDrive) { Zebra2Preset.FilterType zebraFilter = Zebra2Preset.FilterType.LP_12dB; switch (filterType) { case Sylenth1Preset.FILTERTYPE.Lowpass: // LP Xcite: 24dB lowpass, with a frequency-dependent exciter as Drive, adding high frequencies. // LP Allround: CPU-friendly 24dB lowpass, with a strong resonance and smooth coloration via Drive. // LP MidDrive: Boosts mid-range frequencies via Drive, good for leads that can cut through the mix. // LP OldDrive: Adds even-numbered harmonics, for a vintage sound bordering on 'cheesy'! // LP Vintage: CPU-friendly analogue-modeled transistor ladder with 24dB rolloff. Sounds nice and old // LP 12dB: A 12dB version of LP Allround // LP 6dB: A simple lowpass with a very shallow rolloff, non-resonant // LP Vintage2: More CPU-intensive version of LP Vintage, capable of self-oscillation. // LP TN6SVF* TyrellN6's state variable lowpass // LP MS2035* Early version of Diva's rev1 BITE lowpass // LP MS20SK* Early version of Diva's rev2 BITE lowpass if (filterDb == Sylenth1Preset.FILTERDB.DB12) { zebraFilter = Zebra2Preset.FilterType.LP_12dB; } else { if (filterCtlWarmDrive == Sylenth1Preset.ONOFF.On) { //zebraFilter = Zebra2Preset.FilterType.LP_Xcite; //zebraFilter = Zebra2Preset.FilterType.LP_Allround; //zebraFilter = Zebra2Preset.FilterType.LP_OldDrive; zebraFilter = Zebra2Preset.FilterType.LP_TN6SVF; } else { //zebraFilter = Zebra2Preset.FilterType.LP_Vintage; zebraFilter = Zebra2Preset.FilterType.LP_Vintage2; } } break; case Sylenth1Preset.FILTERTYPE.Highpass: if (filterDb == Sylenth1Preset.FILTERDB.DB12) { // HP 12dB: 12dB version of the HP 24dB Resonant 24dB highpass zebraFilter = Zebra2Preset.FilterType.HP_12dB; } else { // HP 24dB: Resonant 24dB highpass zebraFilter = Zebra2Preset.FilterType.HP_24dB; } break; case Sylenth1Preset.FILTERTYPE.Bandpass: if (filterDb == Sylenth1Preset.FILTERDB.DB12) { // BP RezBand: A resonant 12dB bandpass model zebraFilter = Zebra2Preset.FilterType.BP_RezBand; } else { // BP QBand Another resonant bandpass, with a different character //zebraFilter = Zebra2Preset.FilterType.BP_QBand; zebraFilter = Zebra2Preset.FilterType.BP_RezBand; } break; } return zebraFilter; }
private static void SetZebraLFOFromSylenth(Zebra2Preset z2, Sylenth1Preset.LFOWAVE sylenthLFOWave, Sylenth1Preset.ONOFF sylenthLFOFree, float sylenthLFORate, float sylenthLFOGain, string LFOWaveFieldName, string LFOSyncFieldName, string LFORateFieldName, string LFOTrigFieldName, string LFOPhseFieldName, string LFOAmpFieldName, string LFOSlewFieldName, int bpm=120) { Zebra2Preset.LFOWave zebraLFOWave = Zebra2Preset.LFOWave.sine; switch (sylenthLFOWave) { case Sylenth1Preset.LFOWAVE.LFO_HPulse: zebraLFOWave = Zebra2Preset.LFOWave.sqr_hi_lo; break; case Sylenth1Preset.LFOWAVE.LFO_Lorenz: zebraLFOWave = Zebra2Preset.LFOWave.sine; break; case Sylenth1Preset.LFOWAVE.LFO_Pulse: zebraLFOWave = Zebra2Preset.LFOWave.sqr_hi_lo; break; case Sylenth1Preset.LFOWAVE.LFO_QPulse: zebraLFOWave = Zebra2Preset.LFOWave.sqr_hi_lo; break; case Sylenth1Preset.LFOWAVE.LFO_Ramp: zebraLFOWave = Zebra2Preset.LFOWave.saw_down; break; case Sylenth1Preset.LFOWAVE.LFO_Random: zebraLFOWave = Zebra2Preset.LFOWave.rand_glide; break; case Sylenth1Preset.LFOWAVE.LFO_Saw: zebraLFOWave = Zebra2Preset.LFOWave.saw_down; break; case Sylenth1Preset.LFOWAVE.LFO_Sine: zebraLFOWave = Zebra2Preset.LFOWave.sine; break; case Sylenth1Preset.LFOWAVE.LFO_SmpHold: zebraLFOWave = Zebra2Preset.LFOWave.rand_hold; break; case Sylenth1Preset.LFOWAVE.LFO_Triangle: zebraLFOWave = Zebra2Preset.LFOWave.triangle; break; case Sylenth1Preset.LFOWAVE.LFO_TriSaw: zebraLFOWave = Zebra2Preset.LFOWave.saw_up; break; } ObjectUtils.SetField(z2, LFOWaveFieldName, (int) zebraLFOWave); if (sylenthLFOFree == Sylenth1Preset.ONOFF.On) { // use free LFO = hz (0.04 - 192 Hz) float lfo1RateHz = Sylenth1Preset.ValueToHz( sylenthLFORate, Sylenth1Preset.FloatToHz.LFORateFree); // hz = 1 / s float msValue = (float) 1 / lfo1RateHz * 1000; Zebra2Preset.LFOSync lfoSync = Zebra2Preset.LFOSync.SYNC_0_1s; int lfoValue = 0; Zebra2Preset.MillisecondsToLFOSyncAndValue(msValue, out lfoSync, out lfoValue); ObjectUtils.SetField(z2, LFOSyncFieldName, (int) lfoSync); ObjectUtils.SetField(z2, LFORateFieldName, lfoValue); } else { // use LFO preset Sylenth1Preset.LFOTIMING timing = Sylenth1Preset.LFOTimeFloatToEnum( sylenthLFORate ); // Rate (0.00 - 200.00) const float rateNormal = 100.00f; const float rateDotted = 87.00f; // =8*((50/I15)^3) (87 is the closest) const float rateTriple = 114.00f; // =8*((50/I13)^3) (114 is the closest) float zebraLFORate = rateNormal; double msValue = 0; int rate = 0; Zebra2Preset.LFOSync zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_4; switch (timing) { case Sylenth1Preset.LFOTIMING.LFO_UNKNOWN: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_4; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_8_1D: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_8_1; zebraLFORate = rateDotted; break; case Sylenth1Preset.LFOTIMING.LFO_8_1: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_8_1; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_4_1D: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_4_1; zebraLFORate = rateDotted; break; case Sylenth1Preset.LFOTIMING.LFO_8_1T: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_8_1; zebraLFORate = rateTriple; break; case Sylenth1Preset.LFOTIMING.LFO_4_1: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_4_1; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_2_1D: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_2_1; zebraLFORate = rateDotted; break; case Sylenth1Preset.LFOTIMING.LFO_4_1T: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_4_1; zebraLFORate = rateTriple; break; case Sylenth1Preset.LFOTIMING.LFO_2_1: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_2_1; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_1D: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_1; zebraLFORate = rateDotted; break; case Sylenth1Preset.LFOTIMING.LFO_2_1T: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_2_1; zebraLFORate = rateTriple; break; case Sylenth1Preset.LFOTIMING.LFO_1_1: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_1; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_2D: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_2_dot; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_1T: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_1_trip; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_2: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_2; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_4D: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_4_dot; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_2T: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_2_trip; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_4: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_4; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_8D: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_8_dot; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_4T: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_4_trip; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_8: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_8; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_16D: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_16_dot; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_8T: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_8_trip; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_16: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_16; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_32D: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_32_dot; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_16T: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_16_trip; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_32: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_32; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_64D: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_64; zebraLFORate = rateDotted; break; case Sylenth1Preset.LFOTIMING.LFO_1_32T: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_32; zebraLFORate = rateTriple; break; case Sylenth1Preset.LFOTIMING.LFO_1_64: zebraLFOSync = Zebra2Preset.LFOSync.SYNC_1_64; zebraLFORate = rateNormal; break; case Sylenth1Preset.LFOTIMING.LFO_1_128D: msValue = AudioUtils.LFOOrDelayToMilliseconds(AudioUtils.LFOTIMING.LFO_1_128D, bpm); Zebra2Preset.MillisecondsToLFOSyncAndValue((float)msValue, out zebraLFOSync, out rate); zebraLFORate = rate; break; case Sylenth1Preset.LFOTIMING.LFO_1_64T: msValue = AudioUtils.LFOOrDelayToMilliseconds(AudioUtils.LFOTIMING.LFO_1_64T, bpm); Zebra2Preset.MillisecondsToLFOSyncAndValue((float)msValue, out zebraLFOSync, out rate); zebraLFORate = rate; break; case Sylenth1Preset.LFOTIMING.LFO_1_128: msValue = AudioUtils.LFOOrDelayToMilliseconds(AudioUtils.LFOTIMING.LFO_1_128, bpm); Zebra2Preset.MillisecondsToLFOSyncAndValue((float)msValue, out zebraLFOSync, out rate); zebraLFORate = rate; break; // Zebra 2 does not support values lower than 12.5 ms case Sylenth1Preset.LFOTIMING.LFO_1_256D: msValue = AudioUtils.LFOOrDelayToMilliseconds(AudioUtils.LFOTIMING.LFO_1_256D, bpm); Zebra2Preset.MillisecondsToLFOSyncAndValue((float)msValue, out zebraLFOSync, out rate); zebraLFORate = rate; break; case Sylenth1Preset.LFOTIMING.LFO_1_128T: msValue = AudioUtils.LFOOrDelayToMilliseconds(AudioUtils.LFOTIMING.LFO_1_128T, bpm); Zebra2Preset.MillisecondsToLFOSyncAndValue((float)msValue, out zebraLFOSync, out rate); zebraLFORate = rate; break; case Sylenth1Preset.LFOTIMING.LFO_1_256: msValue = AudioUtils.LFOOrDelayToMilliseconds(AudioUtils.LFOTIMING.LFO_1_256, bpm); Zebra2Preset.MillisecondsToLFOSyncAndValue((float)msValue, out zebraLFOSync, out rate); zebraLFORate = rate; break; case Sylenth1Preset.LFOTIMING.LFO_1_256T: msValue = AudioUtils.LFOOrDelayToMilliseconds(AudioUtils.LFOTIMING.LFO_1_256T, bpm); Zebra2Preset.MillisecondsToLFOSyncAndValue((float)msValue, out zebraLFOSync, out rate); zebraLFORate = rate; break; } ObjectUtils.SetField(z2, LFOSyncFieldName, (int) zebraLFOSync); ObjectUtils.SetField(z2, LFORateFieldName, zebraLFORate); } ObjectUtils.SetField(z2, LFOTrigFieldName, (int) Zebra2Preset.LFOGlobalTriggering.Trig_off); ObjectUtils.SetField(z2, LFOPhseFieldName, 0.0f); // Get LFO Amp/Gain float lfoAmpGain = ConvertSylenthValueToZebra(sylenthLFOGain, 0, 10, 0, 100); // TODO: Amp value can never be zero - add a little (2.5 seems best for some sounds like 006 Hardwell from 'Top 100 DJs Sylenth Presets.fxb') if (lfoAmpGain == 0) lfoAmpGain = 2.5f; ObjectUtils.SetField(z2, LFOAmpFieldName, lfoAmpGain); ObjectUtils.SetField(z2, LFOSlewFieldName, (int) Zebra2Preset.LFOSlew.fast); // LFO Slew (Slew=1) }
private static float ConvertSylenthFrequencyToZebra(float filterFrequency, float filterControlFrequency, Sylenth1Preset.FloatToHz mode) { float actualFrequencyHertz = Sylenth1Preset.ConvertSylenthFrequencyToHertz(filterFrequency, filterControlFrequency, mode); int midiNote = Zebra2Preset.FilterFrequencyToMidiNote(actualFrequencyHertz); // TODO: adjust with two to be on the safe side?! return midiNote + 2; }
private static Zebra2Preset.ModulationSource ConvertSylenthModSourceToZebra(Sylenth1Preset.XMODSOURCE sylenthModSource) { Zebra2Preset.ModulationSource zebraModSource = Zebra2Preset.ModulationSource.ModWhl; switch (sylenthModSource) { case Sylenth1Preset.XMODSOURCE.SOURCE_None: // should never get here break; case Sylenth1Preset.XMODSOURCE.SOURCE_Velocity: zebraModSource = Zebra2Preset.ModulationSource.Velocity; break; case Sylenth1Preset.XMODSOURCE.SOURCE_ModWheel: zebraModSource = Zebra2Preset.ModulationSource.ModWhl; break; case Sylenth1Preset.XMODSOURCE.SOURCE_KeyTrack: zebraModSource = Zebra2Preset.ModulationSource.KeyFol; break; case Sylenth1Preset.XMODSOURCE.SOURCE_AmpEnv_A: zebraModSource = Zebra2Preset.ModulationSource.Env1; break; case Sylenth1Preset.XMODSOURCE.SOURCE_AmpEnv_B: zebraModSource = Zebra2Preset.ModulationSource.Env2; break; case Sylenth1Preset.XMODSOURCE.SOURCE_ModEnv_1: zebraModSource = Zebra2Preset.ModulationSource.Env3; break; case Sylenth1Preset.XMODSOURCE.SOURCE_ModEnv_2: zebraModSource = Zebra2Preset.ModulationSource.Env4; break; case Sylenth1Preset.XMODSOURCE.SOURCE_LFO_1: zebraModSource = Zebra2Preset.ModulationSource.Lfo1; break; case Sylenth1Preset.XMODSOURCE.SOURCE_LFO_2: zebraModSource = Zebra2Preset.ModulationSource.Lfo2; break; case Sylenth1Preset.XMODSOURCE.SOURCE_Aftertch: zebraModSource = Zebra2Preset.ModulationSource.ATouch; break; case Sylenth1Preset.XMODSOURCE.SOURCE_StepVlty: zebraModSource = Zebra2Preset.ModulationSource.Xpress; break; } return zebraModSource; }
private static int ConvertSylenthVoicesToZebra(Sylenth1Preset.VOICES numberOfVoices) { int zebraVoices = (int) Zebra2Preset.OscillatorPoly.single; switch (numberOfVoices) { case Sylenth1Preset.VOICES.VOICES_1: zebraVoices = (int) Zebra2Preset.OscillatorPoly.single; break; case Sylenth1Preset.VOICES.VOICES_2: case Sylenth1Preset.VOICES.VOICES_3: zebraVoices = (int) Zebra2Preset.OscillatorPoly.dual; break; case Sylenth1Preset.VOICES.VOICES_4: case Sylenth1Preset.VOICES.VOICES_5: case Sylenth1Preset.VOICES.VOICES_6: zebraVoices = (int) Zebra2Preset.OscillatorPoly.quad; break; case Sylenth1Preset.VOICES.VOICES_7: case Sylenth1Preset.VOICES.VOICES_8: zebraVoices = (int) Zebra2Preset.OscillatorPoly.eleven; break; } return zebraVoices; }
private static int ConvertSylenthWaveToZebra(Sylenth1Preset.OSCWAVE wave, Sylenth1Preset.ONOFF invert) { int zebraWave = 1; switch (wave) { case Sylenth1Preset.OSCWAVE.OSC_Sine: zebraWave = 1; break; case Sylenth1Preset.OSCWAVE.OSC_Saw: if (invert == Sylenth1Preset.ONOFF.On) { zebraWave = 3; } else { zebraWave = 2; } break; case Sylenth1Preset.OSCWAVE.OSC_Triangle: zebraWave = 4; break; case Sylenth1Preset.OSCWAVE.OSC_Pulse: zebraWave = 5; break; case Sylenth1Preset.OSCWAVE.OSC_HPulse: zebraWave = 6; break; case Sylenth1Preset.OSCWAVE.OSC_QPulse: zebraWave = 7; break; case Sylenth1Preset.OSCWAVE.OSC_TriSaw: zebraWave = 8; break; case Sylenth1Preset.OSCWAVE.OSC_Noise: // TODO: special case - noise is not a waveform in zebra but a seperate unit zebraWave = 1; break; } return zebraWave; }
public Sylenth1ToZebra2PresetAdapter(Sylenth1Preset sylenth1Preset) { this._sylenth1Preset = sylenth1Preset; }
private void SetZebraModMatrixElementFromSylenth(Zebra2Preset z2, Sylenth1Preset.XMODSOURCE sylenthModSource, Sylenth1Preset.YMODDEST sylenthModDestination, string fieldNamePrefix, int startMatrixSlot, int slotIndex, Object fieldValue, List<string> zebraUsedModMatrixSlots) { int fieldIndex = startMatrixSlot + slotIndex -1; string fieldName = String.Format("{0}{1}", fieldNamePrefix, fieldIndex); if (fieldIndex > 12) { Console.Out.WriteLine("Warning! Not enough matrix slots available. Discarding matrix slot: {0}={1} !", fieldName, fieldValue); Logger.DoDebug(String.Format("Warning! Not enough matrix slots available. Discarding matrix slot: {0}={1} !", fieldName, fieldValue)); return; } Logger.DoDebug(String.Format("Setting Zebra2 Mod Matrix Element: {0}->{1} {2}={3}" , sylenthModSource, sylenthModDestination, fieldName, fieldValue)); ObjectUtils.SetField(z2, fieldName, fieldValue); // store Zebra mod matrix field information zebraUsedModMatrixSlots.Add(fieldName); }
private void SetZebraModMatrixFromSylenth(Sylenth1Preset.Syl1PresetContent s1, Zebra2Preset z2, Sylenth1Preset.XMODSOURCE sylenthModSource, Sylenth1Preset.YMODDEST sylenthModDestination, float sylenthXModDestAm, IDictionary<string, List<string>> processedModulationSourceAndDest) { // check if we have already processed this exact Sylenth1Preset.XMODSOURCE and Sylenth1Preset.YMODDEST string currentSylenthModSourceAndDest = String.Format("{0}_{1}", sylenthModSource, sylenthModDestination); var zebraUsedModMatrixSlots = new List<string>(); if (processedModulationSourceAndDest.ContainsKey(currentSylenthModSourceAndDest)) { // TODO: Sometimes "double booking" of source and destination is used to increase the effect of a destination // so increase the depth ?! // example: 4 BASS Fidget from "Adam Van Baker Sylenth1 Soundset Part 2.fxb" if ( (s1.YModLFO1Dest1 != Sylenth1Preset.YMODDEST.None && s1.YModLFO1Dest1 == s1.YModLFO1Dest2) || (s1.YModLFO2Dest1 != Sylenth1Preset.YMODDEST.None && s1.YModLFO2Dest1 == s1.YModLFO2Dest2) || (s1.YModEnv1Dest1 != Sylenth1Preset.YMODDEST.None && s1.YModEnv1Dest1 == s1.YModEnv1Dest2) || (s1.YModEnv2Dest1 != Sylenth1Preset.YMODDEST.None && s1.YModEnv2Dest1 == s1.YModEnv2Dest2) ) { Logger.DoDebug(String.Format("It seems like two modulation sources are duplicated. Increasing the zebra modulation depth to encompass this.")); List<string> myList = processedModulationSourceAndDest[currentSylenthModSourceAndDest]; foreach(string fieldName in myList) { if(fieldName.StartsWith("PCore_MMD")) { // increase the value ObjectUtils.SetField(z2, fieldName, ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, 90, 90)); } } return; } else { Logger.DoDebug(String.Format("Sylenth1 Modulation Source has already been set in the Mod Matrix. Skipping! {0}_{1}!", sylenthModSource, sylenthModDestination)); return; } } else { processedModulationSourceAndDest.Add(currentSylenthModSourceAndDest, zebraUsedModMatrixSlots); } // use the _zebraNextFreeModMatrixSlot to keep track of the slot usage if (_zebraNextFreeModMatrixSlot > 12) return; int zebraNumberOfSlotsUsed = 0; if (sylenthModSource != Sylenth1Preset.XMODSOURCE.SOURCE_None && sylenthModDestination != Sylenth1Preset.YMODDEST.None) { const string zebraModMatrixDepthPrefix = "PCore_MMD"; const string zebraModMatrixSourcePrefix = "PCore_MMS"; const string zebraModMatrixTargetPrefix = "PCore_MMT"; const string zebraModMatrixViaSourcePrefix = "PCore_MMVS"; // not used const string zebraModMatrixViaSourceDepthPrefix = "PCore_MMVD"; // not used switch (sylenthModDestination) { case Sylenth1Preset.YMODDEST.None: // should never get here break; // Oscillators case Sylenth1Preset.YMODDEST.Volume_A: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "OSC1:Vol", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "OSC2:Vol", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 2; break; case Sylenth1Preset.YMODDEST.Volume_B: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "OSC3:Vol", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "OSC4:Vol", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 2; break; case Sylenth1Preset.YMODDEST.VolumeAB: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "OSC1:Vol", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "OSC2:Vol", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 3, "OSC3:Vol", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 4, "OSC4:Vol", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 4; break; case Sylenth1Preset.YMODDEST.Pitch_A: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "OSC1:Tune", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "OSC2:Tune", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 2; break; case Sylenth1Preset.YMODDEST.Pitch_B: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "OSC3:Tune", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "OSC4:Tune", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 2; break; case Sylenth1Preset.YMODDEST.Pitch_AB: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "OSC1:Tune", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "OSC2:Tune", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 3, "OSC3:Tune", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 4, "OSC4:Tune", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 4; break; case Sylenth1Preset.YMODDEST.Phase_A: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "OSC1:Phse", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "OSC2:Phse", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 2; break; case Sylenth1Preset.YMODDEST.Phase_B: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "OSC3:Phse", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "OSC4:Phse", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 2; break; case Sylenth1Preset.YMODDEST.Phase_AB: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "OSC1:Phse", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "OSC2:Phse", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 3, "OSC3:Phse", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 4, "OSC4:Phse", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 4; break; case Sylenth1Preset.YMODDEST.Pan_A: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "VCA1:Pan1", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.Pan_B: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "VCA1:Pan2", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.Pan_AB: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "VCA1:Pan1", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "VCA1:Pan2", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 2; break; // Filters case Sylenth1Preset.YMODDEST.Cutoff_A: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "VCF1:Cut", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.Cutoff_B: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "VCF2:Cut", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.CutoffAB: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "VCF1:Cut", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "VCF2:Cut", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 2; break; case Sylenth1Preset.YMODDEST.Reso_A: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "VCF1:Res", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.Reso_B: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "VCF2:Res", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.Reso_AB: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "VCF1:Res", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "VCF2:Res", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 2; break; // Misc case Sylenth1Preset.YMODDEST.PhsrFreq: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "ModFX1:Sped", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.Mix_A: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "VCA1:Vol1", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.Mix_B: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "VCA1:Vol2", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.Mix_AB: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "VCA1:Vol1", zebraUsedModMatrixSlots); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 2, "VCA1:Vol2", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 2; break; case Sylenth1Preset.YMODDEST.LFO1Rate: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "LFO1:Rate", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.LFO1Gain: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "LFO1:Amp", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.LFO2Rate: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "LFO2:Rate", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.LFO2Gain: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "LFO2:Amp", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; case Sylenth1Preset.YMODDEST.DistAmnt: // TODO: should we use Dist3:Input or Dist3:Output ? SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixTargetPrefix, _zebraNextFreeModMatrixSlot, 1, "Dist3:Input", zebraUsedModMatrixSlots); zebraNumberOfSlotsUsed = 1; break; } for (int i = 1; i <= zebraNumberOfSlotsUsed; i++) { switch (sylenthModSource) { case Sylenth1Preset.XMODSOURCE.SOURCE_None: // should never get here break; case Sylenth1Preset.XMODSOURCE.SOURCE_Velocity: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixSourcePrefix, _zebraNextFreeModMatrixSlot, i, (int) Zebra2Preset.ModulationSource.Velocity, zebraUsedModMatrixSlots); break; case Sylenth1Preset.XMODSOURCE.SOURCE_ModWheel: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixSourcePrefix, _zebraNextFreeModMatrixSlot, i, (int) Zebra2Preset.ModulationSource.ModWhl, zebraUsedModMatrixSlots); break; case Sylenth1Preset.XMODSOURCE.SOURCE_KeyTrack: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixSourcePrefix, _zebraNextFreeModMatrixSlot, i, (int) Zebra2Preset.ModulationSource.KeyFol, zebraUsedModMatrixSlots); break; case Sylenth1Preset.XMODSOURCE.SOURCE_AmpEnv_A: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixSourcePrefix, _zebraNextFreeModMatrixSlot, i, (int) Zebra2Preset.ModulationSource.Env1, zebraUsedModMatrixSlots); break; case Sylenth1Preset.XMODSOURCE.SOURCE_AmpEnv_B: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixSourcePrefix, _zebraNextFreeModMatrixSlot, i, (int) Zebra2Preset.ModulationSource.Env2, zebraUsedModMatrixSlots); break; case Sylenth1Preset.XMODSOURCE.SOURCE_ModEnv_1: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixSourcePrefix, _zebraNextFreeModMatrixSlot, i, (int) Zebra2Preset.ModulationSource.Env3, zebraUsedModMatrixSlots); break; case Sylenth1Preset.XMODSOURCE.SOURCE_ModEnv_2: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixSourcePrefix, _zebraNextFreeModMatrixSlot, i, (int) Zebra2Preset.ModulationSource.Env4, zebraUsedModMatrixSlots); break; case Sylenth1Preset.XMODSOURCE.SOURCE_LFO_1: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixSourcePrefix, _zebraNextFreeModMatrixSlot, i, (int) Zebra2Preset.ModulationSource.Lfo1, zebraUsedModMatrixSlots); break; case Sylenth1Preset.XMODSOURCE.SOURCE_LFO_2: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixSourcePrefix, _zebraNextFreeModMatrixSlot, i, (int) Zebra2Preset.ModulationSource.Lfo2, zebraUsedModMatrixSlots); break; case Sylenth1Preset.XMODSOURCE.SOURCE_Aftertch: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixSourcePrefix, _zebraNextFreeModMatrixSlot, i, (int) Zebra2Preset.ModulationSource.ATouch, zebraUsedModMatrixSlots); break; case Sylenth1Preset.XMODSOURCE.SOURCE_StepVlty: SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixSourcePrefix, _zebraNextFreeModMatrixSlot, i, (int) Zebra2Preset.ModulationSource.Velocity, zebraUsedModMatrixSlots); break; } // set the modulation depth amount // have to constrain the amount due to too high converstion (real zebra range is 0 - 100) float matrixDepth = ConvertSylenthValueToZebra(sylenthXModDestAm, -10, 10, -100, 100); SetZebraModMatrixElementFromSylenth(z2, sylenthModSource, sylenthModDestination, zebraModMatrixDepthPrefix, _zebraNextFreeModMatrixSlot, i, matrixDepth, zebraUsedModMatrixSlots ); } _zebraNextFreeModMatrixSlot += zebraNumberOfSlotsUsed; } }
private void SetZebraModSourceFromSylenth(Sylenth1Preset.Syl1PresetContent s1, Zebra2Preset z2, string zebraModSourceFieldName, Object zebraModSourceFieldValue, string zebraModDepthFieldName, Object zebraModDepthFieldValue, bool doForceModMatrix, Sylenth1Preset.XMODSOURCE sylenthModSource, Sylenth1Preset.YMODDEST sylenthModDestination, float sylenthXModDestAm, Dictionary<string,List<string>> processedModulationSourceAndDest) { if (zebraModSourceFieldName == null || zebraModDepthFieldName == null) { return; } if (!doForceModMatrix && !_zebraUsedModSources.Contains(zebraModSourceFieldName)) { // setting modulation source directly on the source (not via the mod matrix) Logger.DoDebug(String.Format("Using the Zebra2 Modulation Source Slot: {0}={1} {2}={3}", zebraModSourceFieldName, Enum.GetName(typeof(Zebra2Preset.ModulationSource), zebraModSourceFieldValue), zebraModDepthFieldName, zebraModDepthFieldValue)); _zebraUsedModSources.Add(zebraModSourceFieldName); ObjectUtils.SetField(z2, zebraModSourceFieldName, zebraModSourceFieldValue); ObjectUtils.SetField(z2, zebraModDepthFieldName, zebraModDepthFieldValue); } else { if (doForceModMatrix) { // Force use mod matrix Logger.DoDebug(String.Format("Forcing the usage of the mod matrix. {0}={1} {2}={3}", zebraModSourceFieldName, Enum.GetName(typeof(Zebra2Preset.ModulationSource), zebraModSourceFieldValue), zebraModDepthFieldName, zebraModDepthFieldValue)); } else { // Already used the mod source, must revert to using the mod matrix Logger.DoDebug(String.Format("Already used up the Zebra2 Modulation Source Slot ({0}). Trying to use the Mod Matrix instead. {0}={1} {2}={3}", zebraModSourceFieldName, Enum.GetName(typeof(Zebra2Preset.ModulationSource), zebraModSourceFieldValue), zebraModDepthFieldName, zebraModDepthFieldValue)); } SetZebraModMatrixFromSylenth(s1, z2, sylenthModSource, sylenthModDestination, sylenthXModDestAm, processedModulationSourceAndDest); } }
public static void Main(string[] args) { //Zebra2Preset.GenerateClassFields(@"C:\Users\perivar.nerseth\Documents\My Projects\AudioVSTToolbox\PresetConverter\_SharedResources\Zebra2-Default Sylenth1 Template.h2p", @"C:\Users\perivar.nerseth\Documents\My Projects\AudioVSTToolbox\PresetConverter\_SharedResources\properties.cs"); //Zebra2Preset.GenerateWriteMethod(@"C:\Users\perivar.nerseth\Documents\My Projects\AudioVSTToolbox\PresetConverter\_SharedResources\Zebra2-Default Sylenth1 Template.h2p", @"C:\Users\perivar.nerseth\Documents\My Projects\AudioVSTToolbox\PresetConverter\_SharedResources\getpreset.cs"); bool processDirectory = false; bool doProcessInitPresets = false; bool doOutputSylenthPresetTextDump = false; bool doDebug = false; // Command line parsing string presetInputFileOrDirectory = ""; string presetOutputFileDirectoryPath = ""; Arguments CommandLine = new Arguments(args); if(CommandLine["in"] != null) { presetInputFileOrDirectory = CommandLine["in"]; } if(CommandLine["out"] != null) { presetOutputFileDirectoryPath = CommandLine["out"]; } if(CommandLine["init"] != null) { doProcessInitPresets = true; } if(CommandLine["text"] != null) { doOutputSylenthPresetTextDump = true; } if(CommandLine["debug"] != null) { doDebug = true; } if (presetInputFileOrDirectory == "" || presetOutputFileDirectoryPath == "") { PrintUsage(); return; } // Build preset file paths string sylenthPresetDirString = ""; string sylenthPreset = ""; // check if input is file or directory if (IOUtils.IsDirectory(presetInputFileOrDirectory)) { sylenthPresetDirString = presetInputFileOrDirectory; processDirectory = true; } else { sylenthPreset = presetInputFileOrDirectory; processDirectory = false; } // define default sylenth template for Zebra2 string zebra2_Sylenth1_PresetTemplate = @"Zebra2-Default Sylenth1 Template.h2p"; IEnumerable<FileInfo> presetFiles; if (processDirectory) { // process directory DirectoryInfo sylenthPresetDir = new DirectoryInfo(sylenthPresetDirString); presetFiles = sylenthPresetDir.GetFilesByExtensions(".fxb", ".fxp"); Console.WriteLine("Processing {0} files in directory: '{1}' ...", presetFiles.Count(), sylenthPresetDir.Name); IOUtils.LogMessageToFile(outputStatusLog, String.Format("Processing {0} files in directory: '{1}' ...", presetFiles.Count(), sylenthPresetDir.Name)); } else { // process single preset FileInfo sylenthPresetFile = new FileInfo(sylenthPreset); presetFiles = new FileInfo[] { sylenthPresetFile }; Console.WriteLine("Processing preset file '{0}' ...", sylenthPresetFile.Name); IOUtils.LogMessageToFile(outputStatusLog, String.Format("Processing preset file '{0}' ...", sylenthPresetFile.Name)); } foreach (FileInfo presetFile in presetFiles) { // read preset file Sylenth1Preset sylenth1 = new Sylenth1Preset(); if (doDebug) sylenth1.logLevel = Sylenth1Preset.LogLevel.Debug; if (sylenth1.Read(presetFile.FullName)) { // Output a dump of the Sylenth1 Preset File if (doOutputSylenthPresetTextDump) { string outSylenthPresetTextDumpPath = Path.GetFileNameWithoutExtension(presetFile.Name) + "_Text.txt"; TextWriter tw = new StreamWriter(outSylenthPresetTextDumpPath); tw.WriteLine(sylenth1); tw.Close(); } // define output dir string outputDir = ""; if (presetFile.Name.EndsWith(".fxb")) { outputDir = Path.Combine(presetOutputFileDirectoryPath, Path.GetFileNameWithoutExtension(presetFile.Name)); if (!Directory.Exists(outputDir)) { Directory.CreateDirectory(outputDir); } } else { outputDir = presetOutputFileDirectoryPath; } // and convert to zebra 2 List<Zebra2Preset> zebra2ConvertedList = sylenth1.ToZebra2Preset(zebra2_Sylenth1_PresetTemplate, doProcessInitPresets); int count = 1; foreach (Zebra2Preset zebra2Converted in zebra2ConvertedList) { string presetName = StringUtils.MakeValidFileName(zebra2Converted.PresetName); string zebraGeneratedPreset = Path.Combine(outputDir, String.Format("{0:000}_{1}.h2p", zebra2Converted.BankIndex, presetName)); zebra2Converted.Write(zebraGeneratedPreset); count++; } } } }