Skip to content

Commit

Permalink
* New: SF2, SFZ, MPC: Support for Pitch bend range settings.
Browse files Browse the repository at this point in the history
* New: SF2, SFZ, Decent Sampler, MPC: Support for filter settings (incl. filter envelope).
* New: SF2, SFZ, MPC: Support for Pitch envelope settings.
* Fixed: SFZ: Logging of unsupported opcodes did add up.
* Fixed: SFZ: Sample paths in metadata now always use forward slash.
* Fixed: Decent Sampler: Sample files from dslibrary could not be written.
* Fixed: Decent Sampler: Tuning was not read correctly (off by factor 100).
* Fixed: Decent Sampler: Round-robin was not read and not written correctly.
  • Loading branch information
git-moss committed Dec 26, 2021
1 parent 9216c0e commit 66af027
Show file tree
Hide file tree
Showing 49 changed files with 2,275 additions and 572 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,17 @@ Since the format supports only one layer of a multisample, multiple files are cr

# Changes

## 4.6

* New: SF2, SFZ, MPC: Support for Pitch bend range settings.
* New: SF2, SFZ, Decent Sampler, MPC: Support for filter settings (incl. filter envelope).
* New: SF2, SFZ, MPC: Support for Pitch envelope settings.
* Fixed: SFZ: Logging of unsupported opcodes did add up.
* Fixed: SFZ: Sample paths in metadata now always use forward slash.
* Fixed: Decent Sampler: Sample files from dslibrary could not be written.
* Fixed: Decent Sampler: Tuning was not read correctly (off by factor 100).
* Fixed: Decent Sampler: Round-robin was not read and not written correctly.

## 4.5

* New: Support for amplitude envelope: Decent Sampler, MPC Keygroups, SFZ: read/write; SF2: read
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<name>Jürgen Moßgraber</name>
<url>http://www.mossgrabers.de</url>
</organization>
<version>4.5.0</version>
<version>4.6.0</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

package de.mossgrabers.sampleconverter.core;

import de.mossgrabers.sampleconverter.core.model.IFilter;
import de.mossgrabers.sampleconverter.core.model.IVelocityLayer;

import java.io.File;
import java.util.List;
import java.util.Optional;


/**
Expand Down Expand Up @@ -135,4 +137,21 @@ public interface IMultisampleSource
* @return The name, usually the source file
*/
String getMappingName ();


/**
* Checks all samples in all layers for filter settings. Only if all samples contain the same
* filter settings a result is returned.
*
* @return The filter if a global filter setting is found
*/
Optional<IFilter> getGlobalFilter ();


/**
* Sets a filter on all samples in all layers.
*
* @param filter The filter to set
*/
void setGlobalFilter (IFilter filter);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.Set;
import java.util.zip.ZipEntry;
Expand Down Expand Up @@ -82,6 +83,19 @@ protected static String createSafeFilename (final String filename)
}


/**
* Format the path and filename replacing all slashes with forward slashes.
*
* @param path A path
* @param filename A filename
* @return The formatted path
*/
protected String formatFileName (final String path, final String filename)
{
return new StringBuilder ().append (path).append ('/').append (filename).toString ().replace ('\\', '/');
}


protected static int check (final int value, final int defaultValue)
{
return value < 0 ? defaultValue : value;
Expand Down Expand Up @@ -264,4 +278,18 @@ protected static double clamp (double value, double minimum, double maximum)
{
return Math.max (minimum, Math.min (value, maximum));
}


/**
* Format a double attribute with a dot as the fraction separator.
*
* @param value The value to format
* @param fractions The number of fractions to format
* @return The formatted value
*/
public static String formatDouble (final double value, final int fractions)
{
final String formatPattern = "%." + fractions + "f";
return String.format (Locale.US, formatPattern, Double.valueOf (value));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import de.mossgrabers.sampleconverter.core.IMultisampleSource;
import de.mossgrabers.sampleconverter.core.INotifier;
import de.mossgrabers.sampleconverter.core.model.DefaultSampleMetadata;
import de.mossgrabers.sampleconverter.core.model.implementation.DefaultSampleMetadata;
import de.mossgrabers.sampleconverter.exception.ParseException;
import de.mossgrabers.sampleconverter.file.wav.FormatChunk;
import de.mossgrabers.sampleconverter.file.wav.WaveFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
package de.mossgrabers.sampleconverter.core.detector;

import de.mossgrabers.sampleconverter.core.IMultisampleSource;
import de.mossgrabers.sampleconverter.core.model.IFilter;
import de.mossgrabers.sampleconverter.core.model.ISampleMetadata;
import de.mossgrabers.sampleconverter.core.model.IVelocityLayer;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;


/**
Expand All @@ -24,11 +27,11 @@ public class MultisampleSource implements IMultisampleSource
private final String [] subPath;
private String name;
private final String mappingName;
private String description = "";
private String creator = "";
private String category = "";
private String [] keywords = new String [0];
private List<IVelocityLayer> sampleMetadata = Collections.emptyList ();
private String description = "";
private String creator = "";
private String category = "";
private String [] keywords = new String [0];
private List<IVelocityLayer> layers = Collections.emptyList ();


/**
Expand Down Expand Up @@ -68,7 +71,7 @@ public File getFolder ()
@Override
public List<IVelocityLayer> getLayers ()
{
return this.sampleMetadata;
return this.layers;
}


Expand Down Expand Up @@ -155,9 +158,9 @@ public void setKeywords (final String [] keywords)

/** {@inheritDoc} */
@Override
public void setVelocityLayers (final List<IVelocityLayer> sampleMetadata)
public void setVelocityLayers (final List<IVelocityLayer> layers)
{
this.sampleMetadata = new ArrayList<> (sampleMetadata);
this.layers = new ArrayList<> (layers);
}


Expand All @@ -167,4 +170,40 @@ public String getMappingName ()
{
return this.mappingName;
}


/** {@inheritDoc} */
@Override
public Optional<IFilter> getGlobalFilter ()
{
IFilter globalFilter = null;
for (final IVelocityLayer layer: this.layers)
{
for (final ISampleMetadata sampleMetadata: layer.getSampleMetadata ())
{
final Optional<IFilter> optFilter = sampleMetadata.getFilter ();
if (optFilter.isEmpty ())
return Optional.empty ();

IFilter filter = optFilter.get ();
if (globalFilter == null)
globalFilter = filter;
else if (!globalFilter.equals (filter))
return Optional.empty ();
}
}
return Optional.ofNullable (globalFilter);
}


/** {@inheritDoc} */
@Override
public void setGlobalFilter (final IFilter filter)
{
for (final IVelocityLayer layer: this.layers)
{
for (final ISampleMetadata sampleMetadata: layer.getSampleMetadata ())
sampleMetadata.setFilter (filter);
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,28 @@ public interface IEnvelopeAccess
* @return The envelope
*/
IEnvelope getAmplitudeEnvelope ();


/**
* Get the pitch envelope.
*
* @return The envelope
*/
IEnvelope getPitchEnvelope ();


/**
* Set the modulation depth of the pitch envelope.
*
* @param depth The depth in the range of [-12000..12000] cents
*/
void setPitchEnvelopeDepth (int depth);


/**
* Get the modulation depth of the pitch envelope.
*
* @return The depth in the range of [-12000..12000] cents
*/
int getPitchEnvelopeDepth ();
}
Loading

0 comments on commit 66af027

Please sign in to comment.