Skip to content

Commit

Permalink
MultEQ-X target curve filter set
Browse files Browse the repository at this point in the history
  • Loading branch information
VoidXH committed Dec 24, 2023
1 parent 2dde991 commit c353726
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ public override void Export(string path) {
fileNameBase = fileNameBase[..fileNameBase.LastIndexOf('.')];
for (int i = 0; i < Channels.Length; i++) {
EqualizerChannelData channelRef = (EqualizerChannelData)Channels[i];
channelRef.curve.Export(Path.Combine(folder, $"{fileNameBase} {Channels[i].name}.txt"),
channelRef.gain, optionalHeader);
channelRef.curve.Export(Path.Combine(folder, $"{fileNameBase} {Channels[i].name}.txt"), 0, optionalHeader);
}
}

Expand Down
117 changes: 7 additions & 110 deletions Cavern.QuickEQ.Format/FilterSet/BaseClasses/FilterSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ protected abstract class ChannelData {
/// </summary>
public int SampleRate { get; private set; }

/// <summary>
/// The number of channels to EQ.
/// </summary>
public int ChannelCount => Channels.Length;

/// <summary>
/// Extension of the root file or the single-file export. This should be displayed on export dialogs.
/// </summary>
Expand Down Expand Up @@ -85,6 +90,7 @@ public static FilterSet Create(FilterSetTarget device, int channels, int sampleR
FilterSetTarget.DiracLiveBassControl => new DiracLiveBassControlFilterSet(channels, sampleRate),
FilterSetTarget.MultEQX => new MultEQXFilterSet(channels, sampleRate),
FilterSetTarget.MultEQXRaw => new MultEQXRawFilterSet(channels, sampleRate),
FilterSetTarget.MultEQXTarget => new MultEQXTargetFilterSet(channels, sampleRate),
FilterSetTarget.YPAO => new YPAOFilterSet(channels, sampleRate),
_ => throw new NotSupportedException()
};
Expand Down Expand Up @@ -114,6 +120,7 @@ public static FilterSet Create(FilterSetTarget device, ReferenceChannel[] channe
FilterSetTarget.DiracLiveBassControl => new DiracLiveBassControlFilterSet(channels, sampleRate),
FilterSetTarget.MultEQX => new MultEQXFilterSet(channels, sampleRate),
FilterSetTarget.MultEQXRaw => new MultEQXRawFilterSet(channels, sampleRate),
FilterSetTarget.MultEQXTarget => new MultEQXTargetFilterSet(channels, sampleRate),
FilterSetTarget.YPAO => new YPAOFilterSet(channels, sampleRate),
_ => throw new NotSupportedException()
};
Expand Down Expand Up @@ -167,114 +174,4 @@ protected void CreateRootFile(string path, string filterFileExtension) {
}
}
}

/// <summary>
/// Supported software/hardware to export filters to.
/// </summary>
/// <remarks>Targets that need multiple passes (like MultEQ-X with its measure, load, measure, save process)
/// are not included as a single measurement can't be exported to them.</remarks>
public enum FilterSetTarget {
/// <summary>
/// IIR filter sets in a commonly accepted format for maximum compatibility.
/// </summary>
Generic,
/// <summary>
/// Equalization curve sets in a commonly accepted format for maximum compatibility.
/// </summary>
GenericEqualizer,

// -------------------------------------------------------------------------
// PC targets --------------------------------------------------------------
// -------------------------------------------------------------------------
/// <summary>
/// Equalizer APO for Windows using EQ curves.
/// </summary>
EqualizerAPO_EQ,
/// <summary>
/// Equalizer APO for Windows using convolution filters.
/// </summary>
EqualizerAPO_FIR,
/// <summary>
/// Equalizer APO for Windows using peaking EQs.
/// </summary>
EqualizerAPO_IIR,
/// <summary>
/// CamillaDSP for Windows/Mac/Linux.
/// </summary>
CamillaDSP,
/// <summary>
/// AU N-Band EQ for Mac.
/// </summary>
AUNBandEQ,

// -------------------------------------------------------------------------
// External DSP hardware ---------------------------------------------------
// -------------------------------------------------------------------------
/// <summary>
/// MiniDSP 2x4 Advanced plugin for the standard MiniDSP 2x4.
/// </summary>
MiniDSP2x4Advanced,
/// <summary>
/// MiniDSP 2x4 Advanced plugin for the standard MiniDSP 2x4, only using half the bands.
/// </summary>
MiniDSP2x4AdvancedLite,
/// <summary>
/// MiniDSP 2x4 HD hardware DSP.
/// </summary>
MiniDSP2x4HD,
/// <summary>
/// MiniDSP 2x4 HD hardware DSP, only using half the bands.
/// </summary>
MiniDSP2x4HDLite,
/// <summary>
/// MiniDSP DDRC-88A hardware DSP.
/// </summary>
MiniDSPDDRC88A,

// -------------------------------------------------------------------------
// AVRs and processors -----------------------------------------------------
// -------------------------------------------------------------------------
/// <summary>
/// Emotiva XMC processors.
/// </summary>
Emotiva,
/// <summary>
/// StormAudio ISP processors.
/// </summary>
StormAudio,

// -------------------------------------------------------------------------
// Amplifiers --------------------------------------------------------------
// -------------------------------------------------------------------------
/// <summary>
/// Behringer NX-series stereo amplifiers.
/// </summary>
BehringerNX,

// -------------------------------------------------------------------------
// Others ------------------------------------------------------------------
// -------------------------------------------------------------------------
/// <summary>
/// Processors supporting Dirac Live.
/// </summary>
/// <remarks>Dirac has no full override, only delta measurements are supported.</remarks>
DiracLive,
/// <summary>
/// Processors supporting Dirac Live Bass Control. DLBC requires some channels to be merged into groups.
/// </summary>
/// <remarks>Dirac has no full override, only delta measurements are supported.</remarks>
DiracLiveBassControl,
/// <summary>
/// Processors supporting Audyssey MultEQ-X, MultEQ-X config file.
/// </summary>
MultEQX,
/// <summary>
/// Processors supporting Audyssey MultEQ-X, PEQ files.
/// </summary>
MultEQXRaw,
/// <summary>
/// Processors supporting the latest YPAO with additional fine tuning PEQs.
/// </summary>
YPAO,
}
}
115 changes: 115 additions & 0 deletions Cavern.QuickEQ.Format/FilterSet/BaseClasses/FilterSetTarget.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
namespace Cavern.Format.FilterSet {
/// <summary>
/// Supported software/hardware to export filters to.
/// </summary>
/// <remarks>Targets that need multiple passes (like MultEQ-X with its measure, load, measure, save process)
/// are not included as a single measurement can't be exported to them.</remarks>
public enum FilterSetTarget {
/// <summary>
/// IIR filter sets in a commonly accepted format for maximum compatibility.
/// </summary>
Generic,
/// <summary>
/// Equalization curve sets in a commonly accepted format for maximum compatibility.
/// </summary>
GenericEqualizer,

// -------------------------------------------------------------------------
// PC targets --------------------------------------------------------------
// -------------------------------------------------------------------------
/// <summary>
/// Equalizer APO for Windows using EQ curves.
/// </summary>
EqualizerAPO_EQ,
/// <summary>
/// Equalizer APO for Windows using convolution filters.
/// </summary>
EqualizerAPO_FIR,
/// <summary>
/// Equalizer APO for Windows using peaking EQs.
/// </summary>
EqualizerAPO_IIR,
/// <summary>
/// CamillaDSP for Windows/Mac/Linux.
/// </summary>
CamillaDSP,
/// <summary>
/// AU N-Band EQ for Mac.
/// </summary>
AUNBandEQ,

// -------------------------------------------------------------------------
// External DSP hardware ---------------------------------------------------
// -------------------------------------------------------------------------
/// <summary>
/// MiniDSP 2x4 Advanced plugin for the standard MiniDSP 2x4.
/// </summary>
MiniDSP2x4Advanced,
/// <summary>
/// MiniDSP 2x4 Advanced plugin for the standard MiniDSP 2x4, only using half the bands.
/// </summary>
MiniDSP2x4AdvancedLite,
/// <summary>
/// MiniDSP 2x4 HD hardware DSP.
/// </summary>
MiniDSP2x4HD,
/// <summary>
/// MiniDSP 2x4 HD hardware DSP, only using half the bands.
/// </summary>
MiniDSP2x4HDLite,
/// <summary>
/// MiniDSP DDRC-88A hardware DSP.
/// </summary>
MiniDSPDDRC88A,

// -------------------------------------------------------------------------
// AVRs and processors -----------------------------------------------------
// -------------------------------------------------------------------------
/// <summary>
/// Emotiva XMC processors.
/// </summary>
Emotiva,
/// <summary>
/// StormAudio ISP processors.
/// </summary>
StormAudio,

// -------------------------------------------------------------------------
// Amplifiers --------------------------------------------------------------
// -------------------------------------------------------------------------
/// <summary>
/// Behringer NX-series stereo amplifiers.
/// </summary>
BehringerNX,

// -------------------------------------------------------------------------
// Others ------------------------------------------------------------------
// -------------------------------------------------------------------------
/// <summary>
/// Processors supporting Dirac Live.
/// </summary>
/// <remarks>Dirac has no full override, only delta measurements are supported.</remarks>
DiracLive,
/// <summary>
/// Processors supporting Dirac Live Bass Control. DLBC requires some channels to be merged into groups.
/// </summary>
/// <remarks>Dirac has no full override, only delta measurements are supported.</remarks>
DiracLiveBassControl,
/// <summary>
/// Processors supporting Audyssey MultEQ-X, MultEQ-X config file.
/// </summary>
MultEQX,
/// <summary>
/// Processors supporting Audyssey MultEQ-X, PEQ files.
/// </summary>
MultEQXRaw,
/// <summary>
/// Processors supporting Audyssey MultEQ-X, target curve files.
/// </summary>
MultEQXTarget,
/// <summary>
/// Processors supporting the latest YPAO with additional fine tuning PEQs.
/// </summary>
YPAO,
}
}
3 changes: 1 addition & 2 deletions Cavern.QuickEQ.Format/FilterSet/DiracLiveFilterSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public override void Export(string path) {
fileNameBase = fileNameBase[..fileNameBase.LastIndexOf('.')];
for (int i = 0; i < Channels.Length; i++) {
var channelRef = (EqualizerChannelData)Channels[i];
channelRef.curve.ExportToDirac(Path.Combine(folder, $"{fileNameBase} {channelRef.name}.txt"),
channelRef.gain, optionalHeader);
channelRef.curve.ExportToDirac(Path.Combine(folder, $"{fileNameBase} {channelRef.name}.txt"), 0, optionalHeader);
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions Cavern.QuickEQ.Format/FilterSet/MultEQXTargetFilterSet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Cavern.Channels;

namespace Cavern.Format.FilterSet {
/// <summary>
/// Target curve collection for MultEQ-X to be able to use its own EQ.
/// </summary>
public class MultEQXTargetFilterSet : EqualizerFilterSet {
/// <summary>
/// Target curve collection for MultEQ-X to be able to use its own EQ.
/// </summary>
public MultEQXTargetFilterSet(int channels, int sampleRate) : base(channels, sampleRate) { }

/// <summary>
/// Target curve collection for MultEQ-X to be able to use its own EQ.
/// </summary>
public MultEQXTargetFilterSet(ReferenceChannel[] channels, int sampleRate) : base(channels, sampleRate) { }
}
}
14 changes: 8 additions & 6 deletions Cavern.QuickEQ/Equalization/Equalizer.Visualization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public void Apply(Complex[] response, int sampleRate) {
/// Save this EQ to a file in the standard curve/calibration format.
/// </summary>
/// <param name="path">Export path of the file</param>
/// <param name="level">Gain at the center of the curve</param>
/// <param name="offset">Gain offset in decibels</param>
/// <param name="header">Extra text to be added to the first line of the file</param>
public void Export(string path, double level, string header = null) {
public void Export(string path, double offset, string header = null) {
int start = header != null ? 1 : 0, c = bands.Count;
string[] calFile = new string[bands.Count + start];
if (header != null) {
Expand All @@ -55,7 +55,8 @@ public void Export(string path, double level, string header = null) {

CultureInfo culture = CultureInfo.InvariantCulture;
for (int band = 0; band < c; band++) {
calFile[band + start] = $"{bands[band].Frequency.ToString(culture)} {bands[band].Gain.ToString(culture)}";
double level = bands[band].Gain + offset;
calFile[band + start] = $"{bands[band].Frequency.ToString(culture)} {level.ToString(culture)}";
}
File.WriteAllLines(path, calFile);
}
Expand All @@ -64,9 +65,9 @@ public void Export(string path, double level, string header = null) {
/// Save this EQ to a file in Dirac's curve format.
/// </summary>
/// <param name="path">Export path of the file</param>
/// <param name="level">Gain at the center of the curve</param>
/// <param name="offset">Gain offset in decibels</param>
/// <param name="header">Extra text to be added to the first line of the file</param>
public void ExportToDirac(string path, double level, string header = null) {
public void ExportToDirac(string path, double offset, string header = null) {
int start = header != null ? 2 : 1, c = bands.Count;
string[] calFile = new string[1 + diracFooter.Length + bands.Count + start];
if (header != null) {
Expand All @@ -76,7 +77,8 @@ public void ExportToDirac(string path, double level, string header = null) {

CultureInfo culture = CultureInfo.InvariantCulture;
for (int band = 0; band < c; band++) {
calFile[band + start] = $"{bands[band].Frequency.ToString(culture)} {bands[band].Gain.ToString(culture)}";
double level = bands[band].Gain + offset;
calFile[band + start] = $"{bands[band].Frequency.ToString(culture)} {level.ToString(culture)}";
}

Array.Copy(diracFooter, 0, calFile, start + c, diracFooter.Length);
Expand Down

0 comments on commit c353726

Please sign in to comment.