code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
844 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
void reset(double grainSize,double randomness,double position,double timeStretchFactor,double pitchShiftFactor){ double randomTimeDiff = (Math.random() > 0.5 ? +1 : -1) * grainSize * randomness; double actualGrainSize = (grainSize + randomTimeDiff) /timeStretchFactor + 1; this.position = position - actualGrainSize; this.age = 0f; this.grainSize = actualGrainSize; this.active =true; }
Sets the given Grain to start immediately. @param g the g @param time the time
Grain::reset
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/granulator/Grain.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/granulator/Grain.java
Apache-2.0
public Granulator(float sampleRate,int bufferSize) { grains = new ArrayList<Grain>(); freeGrains = new ArrayList<Grain>(); deadGrains = new ArrayList<Grain>(); audioBuffer = new float[(int) (12*60*sampleRate)];//max 12 minutes of audio audioBufferWatermark = 0; pitchFactor = 1.0f; grainInterval = 40.0f; grainSize = 100.0f; grainRandomness = 0.1f; window = new be.tarsos.dsp.util.fft.CosineWindow().generateCurve(bufferSize); outputBuffer = new float[bufferSize]; msPerSample = 1000.0f/sampleRate; positionIncrement = msPerSample; }
Instantiates a new GranularSamplePlayer. @param sampleRate the sample rate. @param bufferSize the size of an output buffer.
Granulator::Granulator
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
Apache-2.0
private void firstGrain() { if(firstGrain) { Grain g = new Grain(); g.position = position; g.age = grainSize / 4f; g.grainSize = grainSize; grains.add(g); firstGrain = false; timeSinceLastGrain = grainInterval / 2f; } }
Instantiates a new GranularSamplePlayer. @param sampleRate the sample rate. @param bufferSize the size of an output buffer. public Granulator(float sampleRate,int bufferSize) { grains = new ArrayList<Grain>(); freeGrains = new ArrayList<Grain>(); deadGrains = new ArrayList<Grain>(); audioBuffer = new float[(int) (12*60*sampleRate)];//max 12 minutes of audio audioBufferWatermark = 0; pitchFactor = 1.0f; grainInterval = 40.0f; grainSize = 100.0f; grainRandomness = 0.1f; window = new be.tarsos.dsp.util.fft.CosineWindow().generateCurve(bufferSize); outputBuffer = new float[bufferSize]; msPerSample = 1000.0f/sampleRate; positionIncrement = msPerSample; } public void start() { timeSinceLastGrain = 0; } /** Flag to indicate special case for the first grain. private boolean firstGrain = true; /** Special case method for playing first grain.
Granulator::firstGrain
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
Apache-2.0
public double getFrameLinear(double posInMS) { double result = 0.0; double sampleNumber = msToSamples(posInMS); int sampleNumberFloor = (int) Math.floor(sampleNumber); if (sampleNumberFloor > 0 && sampleNumberFloor < audioBufferWatermark) { double sampleNumberFraction = sampleNumber - sampleNumberFloor; if (sampleNumberFloor == audioBufferWatermark - 1) { result = audioBuffer[sampleNumberFloor]; } else { // linear interpolation double current = audioBuffer[sampleNumberFloor]; double next = audioBuffer[sampleNumberFloor]; result = (float) ((1 - sampleNumberFraction) * current + sampleNumberFraction * next); } } return result; }
Retrieves a frame of audio using linear interpolation. If the frame is not in the sample range then zeros are returned. @param posInMS The frame to read -- can be fractional (e.g., 4.4). @return The framedata to fill.
Granulator::getFrameLinear
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
Apache-2.0
public float getFrameNoInterp(double posInMS) { double frame = msToSamples(posInMS); int frame_floor = (int) Math.floor(frame); return audioBuffer[frame_floor]; }
Retrieves a frame of audio using no interpolation. If the frame is not in the sample range then zeros are returned. @param posInMS The frame to read -- will take the last frame before this one.
Granulator::getFrameNoInterp
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
Apache-2.0
public float getFrameCubic(double posInMS) { float frame = (float) msToSamples(posInMS); float result = 0.0f; float a0, a1, a2, a3, mu2; float ym1, y0, y1, y2; int realCurrentSample = (int) Math.floor(frame); float fractionOffset = frame - realCurrentSample; if (realCurrentSample >= 0 && realCurrentSample < (audioBufferWatermark - 1)) { realCurrentSample--; if (realCurrentSample < 0) { ym1 = audioBuffer[0]; realCurrentSample = 0; } else { ym1 = audioBuffer[realCurrentSample++]; } y0 = audioBuffer[realCurrentSample++]; if (realCurrentSample >= audioBufferWatermark) { y1 = audioBuffer[audioBufferWatermark-1]; // ?? } else { y1 = audioBuffer[realCurrentSample++]; } if (realCurrentSample >= audioBufferWatermark) { y2 = audioBuffer[audioBufferWatermark-1]; } else { y2 = audioBuffer[realCurrentSample++]; } mu2 = fractionOffset * fractionOffset; a0 = y2 - y1 - ym1 + y0; a1 = ym1 - y0 - a0; a2 = y1 - ym1; a3 = y0; result = a0 * fractionOffset * mu2 + a1 * mu2 + a2 * fractionOffset + a3; } return result; }
Retrieves a frame of audio using cubic interpolation. If the frame is not in the sample range then zeros are returned. @param posInMS The frame to read -- can be fractional (e.g., 4.4).
Granulator::getFrameCubic
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
Apache-2.0
public float getValueFraction(float fraction) { float posInBuf = fraction * window.length; int lowerIndex = (int)posInBuf; float offset = posInBuf - lowerIndex; int upperIndex = (lowerIndex + 1) % window.length; return (1 - offset) * window[lowerIndex] + offset * window[upperIndex]; }
Returns the value of the buffer at the given fraction along its length (0 = start, 1 = end). Uses linear interpolation. @param fraction the point along the buffer to inspect. @return the value at that point.
Granulator::getValueFraction
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
Apache-2.0
private void calculateNextGrainPosition(Grain g) { int direction = timeStretchFactor >= 0 ? 1 : -1; //this is a bit odd in the case when controlling grain from positionEnvelope g.age += msPerSample; g.position += direction * positionIncrement * pitchFactor; }
Calculate next position for the given Grain. @param g the Grain.
Granulator::calculateNextGrainPosition
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
Apache-2.0
public void setPosition(float position) { this.position = position * 1000; }
@param position in seconds
Granulator::setPosition
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/granulator/Granulator.java
Apache-2.0
public PitchDetectionResult(PitchDetectionResult other){ this.pitch = other.pitch; this.probability = other.probability; this.pitched = other.pitched; }
A copy constructor. Since PitchDetectionResult objects are reused for performance reasons, creating a copy can be practical. @param other
PitchDetectionResult::PitchDetectionResult
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/PitchDetectionResult.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/PitchDetectionResult.java
Apache-2.0
public float getPitch() { return pitch; }
@return The pitch in Hertz.
PitchDetectionResult::getPitch
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/PitchDetectionResult.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/PitchDetectionResult.java
Apache-2.0
public PitchDetectionResult clone(){ return new PitchDetectionResult(this); }
@return The pitch in Hertz. public float getPitch() { return pitch; } public void setPitch(float pitch) { this.pitch = pitch; } /* (non-Javadoc) @see java.lang.Object#clone()
PitchDetectionResult::clone
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/PitchDetectionResult.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/PitchDetectionResult.java
Apache-2.0
public float getProbability() { return probability; }
@return A probability (noisiness, (a)periodicity, salience, voicedness or clarity measure) for the detected pitch. This is somewhat similar to the term voiced which is used in speech recognition. This probability should be calculated together with the pitch. The exact meaning of the value depends on the detector used.
PitchDetectionResult::getProbability
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/PitchDetectionResult.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/PitchDetectionResult.java
Apache-2.0
public boolean isPitched() { return pitched; }
@return Whether the algorithm thinks the block of audio is pitched. Keep in mind that an algorithm can come up with a best guess for a pitch even when isPitched() is false.
PitchDetectionResult::isPitched
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/PitchDetectionResult.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/PitchDetectionResult.java
Apache-2.0
public AMDF(float sampleRate, int bufferSize) { this(sampleRate,bufferSize,DEFAULT_MIN_FREQUENCY,DEFAULT_MAX_FREQUENCY); }
Construct a new Average Magnitude Difference pitch detector. @param sampleRate The audio sample rate @param bufferSize the buffer size of a block of samples
AMDF::AMDF
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/AMDF.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/AMDF.java
Apache-2.0
public AMDF(float sampleRate, int bufferSize,double minFrequency,double maxFrequency) { this.sampleRate = sampleRate; amd = new double[bufferSize]; this.ratio = DEFAULT_RATIO; this.sensitivity = DEFAULT_SENSITIVITY; this.maxPeriod = Math.round(sampleRate / minFrequency + 0.5); this.minPeriod = Math.round(sampleRate / maxFrequency + 0.5); result = new PitchDetectionResult(); }
Construct a new Average Magnitude Difference pitch detector. @param sampleRate The audio sample rate @param bufferSize the buffer size of a block of samples @param minFrequency The min frequency to detect in Hz @param maxFrequency The max frequency to detect in Hz
AMDF::AMDF
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/AMDF.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/AMDF.java
Apache-2.0
public GeneralizedGoertzel(final float audioSampleRate, final int bufferSize, double[] frequencies, FrequenciesDetectedHandler handler){ frequenciesToDetect = frequencies; indvec = new double[frequenciesToDetect.length]; for (int j = 0; j < frequenciesToDetect.length; j++) { indvec[j] = frequenciesToDetect[j]/(audioSampleRate/(float)bufferSize); } precalculatedCosines = new double[frequencies.length]; precalculatedWnk = new double[frequencies.length]; this.handler = handler; calculatedPowers = new double[frequencies.length]; calculatedComplex = new Complex[frequencies.length]; for (int i = 0; i < frequenciesToDetect.length; i++) { precalculatedCosines[i] = 2 * Math.cos(2 * Math.PI * frequenciesToDetect[i] / audioSampleRate); precalculatedWnk[i] = Math.exp(-2 * Math.PI * frequenciesToDetect[i] / audioSampleRate); } }
Create a new Generalized Goertzel processor. @param audioSampleRate The sample rate of the audio in Hz. @param bufferSize the size of the buffer. @param frequencies The list of frequencies to detect (in Hz). @param handler The handler used to handle the detected frequencies.
GeneralizedGoertzel::GeneralizedGoertzel
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/GeneralizedGoertzel.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/GeneralizedGoertzel.java
Apache-2.0
public DynamicWavelet(float sampleRate,int bufferSize){ this.sampleRate = sampleRate; distances = new int[bufferSize]; mins = new int[bufferSize]; maxs = new int[bufferSize]; result = new PitchDetectionResult(); }
create a new dynamic wavelet @param sampleRate the sample rate in hz @param bufferSize the size of the audio blocks
DynamicWavelet::DynamicWavelet
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/DynamicWavelet.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/DynamicWavelet.java
Apache-2.0
public McLeodPitchMethod(final float audioSampleRate) { this(audioSampleRate, DEFAULT_BUFFER_SIZE, DEFAULT_CUTOFF); }
Initializes the normalized square difference value array and stores the sample rate. @param audioSampleRate The sample rate of the audio to check.
McLeodPitchMethod::McLeodPitchMethod
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
Apache-2.0
public McLeodPitchMethod(final float audioSampleRate, final int audioBufferSize) { this(audioSampleRate, audioBufferSize, DEFAULT_CUTOFF); }
Create a new pitch detector. @param audioSampleRate The sample rate of the audio. @param audioBufferSize The size of one audio buffer 1024 samples is common.
McLeodPitchMethod::McLeodPitchMethod
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
Apache-2.0
public McLeodPitchMethod(final float audioSampleRate, final int audioBufferSize, final double cutoffMPM) { this.sampleRate = audioSampleRate; nsdf = new float[audioBufferSize]; this.cutoff = cutoffMPM; result = new PitchDetectionResult(); }
Create a new pitch detector. @param audioSampleRate The sample rate of the audio. @param audioBufferSize The size of one audio buffer 1024 samples is common. @param cutoffMPM The cutoff (similar to the YIN threshold). In the Tartini paper 0.93 is used.
McLeodPitchMethod::McLeodPitchMethod
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
Apache-2.0
private void normalizedSquareDifference(final float[] audioBuffer) { for (int tau = 0; tau < audioBuffer.length; tau++) { float acf = 0; float divisorM = 0; for (int i = 0; i < audioBuffer.length - tau; i++) { acf += audioBuffer[i] * audioBuffer[i + tau]; divisorM += audioBuffer[i] * audioBuffer[i] + audioBuffer[i + tau] * audioBuffer[i + tau]; } nsdf[tau] = 2 * acf / divisorM; } }
Implements the normalized square difference function. See section 4 (and the explanation before) in the MPM article. This calculation can be optimized by using an FFT. The results should remain the same. @param audioBuffer The buffer with audio information.
McLeodPitchMethod::normalizedSquareDifference
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
Apache-2.0
public PitchDetectionResult getPitch(final float[] audioBuffer) { final float pitch; // 0. Clear previous results (Is this faster than initializing a list // again and again?) maxPositions.clear(); periodEstimates.clear(); ampEstimates.clear(); // 1. Calculate the normalized square difference for each Tau value. normalizedSquareDifference(audioBuffer); // 2. Peak picking time: time to pick some peaks. peakPicking(); double highestAmplitude = Double.NEGATIVE_INFINITY; for (final Integer tau : maxPositions) { // make sure every annotation has a probability attached highestAmplitude = Math.max(highestAmplitude, nsdf[tau]); if (nsdf[tau] > SMALL_CUTOFF) { // calculates turningPointX and Y parabolicInterpolation(tau); // store the turning points ampEstimates.add(turningPointY); periodEstimates.add(turningPointX); // remember the highest amplitude highestAmplitude = Math.max(highestAmplitude, turningPointY); } } if (periodEstimates.isEmpty()) { pitch = -1; } else { // use the overall maximum to calculate a cutoff. // The cutoff value is based on the highest value and a relative // threshold. final double actualCutoff = cutoff * highestAmplitude; // find first period above or equal to cutoff int periodIndex = 0; for (int i = 0; i < ampEstimates.size(); i++) { if (ampEstimates.get(i) >= actualCutoff) { periodIndex = i; break; } } final double period = periodEstimates.get(periodIndex); final float pitchEstimate = (float) (sampleRate / period); if (pitchEstimate > LOWER_PITCH_CUTOFF) { pitch = pitchEstimate; } else { pitch = -1; } } result.setProbability((float) highestAmplitude); result.setPitch(pitch); result.setPitched(pitch != -1); return result; }
Implements the normalized square difference function. See section 4 (and the explanation before) in the MPM article. This calculation can be optimized by using an FFT. The results should remain the same. @param audioBuffer The buffer with audio information. private void normalizedSquareDifference(final float[] audioBuffer) { for (int tau = 0; tau < audioBuffer.length; tau++) { float acf = 0; float divisorM = 0; for (int i = 0; i < audioBuffer.length - tau; i++) { acf += audioBuffer[i] * audioBuffer[i + tau]; divisorM += audioBuffer[i] * audioBuffer[i] + audioBuffer[i + tau] * audioBuffer[i + tau]; } nsdf[tau] = 2 * acf / divisorM; } } /* (non-Javadoc) @see be.tarsos.pitch.pure.PurePitchDetector#getPitch(float[])
McLeodPitchMethod::getPitch
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
Apache-2.0
private void parabolicInterpolation(final int tau) { final float nsdfa = nsdf[tau - 1]; final float nsdfb = nsdf[tau]; final float nsdfc = nsdf[tau + 1]; final float bValue = tau; final float bottom = nsdfc + nsdfa - 2 * nsdfb; if (bottom == 0.0) { turningPointX = bValue; turningPointY = nsdfb; } else { final float delta = nsdfa - nsdfc; turningPointX = bValue + delta / (2 * bottom); turningPointY = nsdfb - delta * delta / (8 * bottom); } }
<p> Finds the x value corresponding with the peak of a parabola. </p> <p> a,b,c are three samples that follow each other. E.g. a is at 511, b at 512 and c at 513; f(a), f(b) and f(c) are the normalized square difference values for those samples; x is the peak of the parabola and is what we are looking for. Because the samples follow each other <code>b - a = 1</code> the formula for <a href="http://fizyka.umk.pl/nrbook/c10-2.pdf">parabolic interpolation</a> can be simplified a lot. </p> <p> The following ASCII ART shows it a bit more clear, imagine this to be a bit more curvaceous. </p> <pre> nsdf(x) ^ | f(x) |------ ^ f(b) | / |\ f(a) | / | \ | / | \ | / | \ f(c) | / | \ |_____________________> x a x b c </pre> @param tau The delay tau, b value in the drawing is the tau value.
McLeodPitchMethod::parabolicInterpolation
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
Apache-2.0
private void peakPicking() { int pos = 0; int curMaxPos = 0; // find the first negative zero crossing while (pos < (nsdf.length - 1) / 3 && nsdf[pos] > 0) { pos++; } // loop over all the values below zero while (pos < nsdf.length - 1 && nsdf[pos] <= 0.0) { pos++; } // can happen if output[0] is NAN if (pos == 0) { pos = 1; } while (pos < nsdf.length - 1) { assert nsdf[pos] >= 0; if (nsdf[pos] > nsdf[pos - 1] && nsdf[pos] >= nsdf[pos + 1]) { if (curMaxPos == 0) { // the first max (between zero crossings) curMaxPos = pos; } else if (nsdf[pos] > nsdf[curMaxPos]) { // a higher max (between the zero crossings) curMaxPos = pos; } } pos++; // a negative zero crossing if (pos < nsdf.length - 1 && nsdf[pos] <= 0) { // if there was a maximum add it to the list of maxima if (curMaxPos > 0) { maxPositions.add(curMaxPos); curMaxPos = 0; // clear the maximum position, so we start // looking for a new ones } while (pos < nsdf.length - 1 && nsdf[pos] <= 0.0f) { pos++; // loop over all the values below zero } } } if (curMaxPos > 0) { // if there was a maximum in the last part maxPositions.add(curMaxPos); // add it to the vector of maxima } }
<p> Implementation based on the GPL'ED code of <a href="http://tartini.net">Tartini</a> This code can be found in the file <code>general/mytransforms.cpp</code>. </p> <p> Finds the highest value between each pair of positive zero crossings. Including the highest value between the last positive zero crossing and the end (if any). Ignoring the first maximum (which is at zero). In this diagram the desired values are marked with a + </p> <pre> f(x) ^ | 1| + | \ + /\ + /\ 0| _\____/\____/__\/\__/\____/_______> x | \ / \ / \/ \ / -1| \/ \/ \/ | </pre> @param nsdf The array to look for maximum values in. It should contain values between -1 and 1 @author Phillip McLeod
McLeodPitchMethod::peakPicking
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/McLeodPitchMethod.java
Apache-2.0
public Yin(final float audioSampleRate, final int bufferSize) { this(audioSampleRate, bufferSize, DEFAULT_THRESHOLD); }
Create a new pitch detector for a stream with the defined sample rate. Processes the audio in blocks of the defined size. @param audioSampleRate The sample rate of the audio stream. E.g. 44.1 kHz. @param bufferSize The size of a buffer. E.g. 1024.
Yin::Yin
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/Yin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/Yin.java
Apache-2.0
public Yin(final float audioSampleRate, final int bufferSize, final double yinThreshold) { this.sampleRate = audioSampleRate; this.threshold = yinThreshold; yinBuffer = new float[bufferSize / 2]; result = new PitchDetectionResult(); }
Create a new pitch detector for a stream with the defined sample rate. Processes the audio in blocks of the defined size. @param audioSampleRate The sample rate of the audio stream. E.g. 44.1 kHz. @param bufferSize The size of a buffer. E.g. 1024. @param yinThreshold The parameter that defines which peaks are kept as possible pitch candidates. See the YIN paper for more details.
Yin::Yin
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/Yin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/Yin.java
Apache-2.0
public PitchDetectionResult getPitch(final float[] audioBuffer) { final int tauEstimate; final float pitchInHertz; // step 2 difference(audioBuffer); // step 3 cumulativeMeanNormalizedDifference(); // step 4 tauEstimate = absoluteThreshold(); // step 5 if (tauEstimate != -1) { final float betterTau = parabolicInterpolation(tauEstimate); // step 6 // TODO Implement optimization for the AUBIO_YIN algorithm. // 0.77% => 0.5% error rate, // using the data of the YIN paper // bestLocalEstimate() // conversion to Hz pitchInHertz = sampleRate / betterTau; } else{ // no pitch found pitchInHertz = -1; } result.setPitch(pitchInHertz); return result; }
The main flow of the YIN algorithm. Returns a pitch value in Hz or -1 if no pitch is detected. @return a pitch value in Hz or -1 if no pitch is detected.
Yin::getPitch
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/Yin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/Yin.java
Apache-2.0
private void difference(final float[] audioBuffer) { int index, tau; float delta; for (tau = 0; tau < yinBuffer.length; tau++) { yinBuffer[tau] = 0; } for (tau = 1; tau < yinBuffer.length; tau++) { for (index = 0; index < yinBuffer.length; index++) { delta = audioBuffer[index] - audioBuffer[index + tau]; yinBuffer[tau] += delta * delta; } } }
Implements the difference function as described in step 2 of the YIN paper.
Yin::difference
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/Yin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/Yin.java
Apache-2.0
private void cumulativeMeanNormalizedDifference() { int tau; yinBuffer[0] = 1; float runningSum = 0; for (tau = 1; tau < yinBuffer.length; tau++) { runningSum += yinBuffer[tau]; yinBuffer[tau] *= tau / runningSum; } }
The cumulative mean normalized difference function as described in step 3 of the YIN paper. <br> <code> yinBuffer[0] == yinBuffer[1] = 1 </code>
Yin::cumulativeMeanNormalizedDifference
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/Yin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/Yin.java
Apache-2.0
private int absoluteThreshold() { // Uses another loop construct // than the AUBIO implementation int tau; // first two positions in yinBuffer are always 1 // So start at the third (index 2) for (tau = 2; tau < yinBuffer.length; tau++) { if (yinBuffer[tau] < threshold) { while (tau + 1 < yinBuffer.length && yinBuffer[tau + 1] < yinBuffer[tau]) { tau++; } // found tau, exit loop and return // store the probability // From the YIN paper: The threshold determines the list of // candidates admitted to the set, and can be interpreted as the // proportion of aperiodic power tolerated // within a periodic signal. // // Since we want the periodicity and and not aperiodicity: // periodicity = 1 - aperiodicity result.setProbability(1 - yinBuffer[tau]); break; } } // if no pitch found, tau => -1 if (tau == yinBuffer.length || yinBuffer[tau] >= threshold) { tau = -1; result.setProbability(0); result.setPitched(false); } else { result.setPitched(true); } return tau; }
Implements step 4 of the AUBIO_YIN paper.
Yin::absoluteThreshold
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/Yin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/Yin.java
Apache-2.0
private float parabolicInterpolation(final int tauEstimate) { final float betterTau; final int x0; final int x2; if (tauEstimate < 1) { x0 = tauEstimate; } else { x0 = tauEstimate - 1; } if (tauEstimate + 1 < yinBuffer.length) { x2 = tauEstimate + 1; } else { x2 = tauEstimate; } if (x0 == tauEstimate) { if (yinBuffer[tauEstimate] <= yinBuffer[x2]) { betterTau = tauEstimate; } else { betterTau = x2; } } else if (x2 == tauEstimate) { if (yinBuffer[tauEstimate] <= yinBuffer[x0]) { betterTau = tauEstimate; } else { betterTau = x0; } } else { float s0, s1, s2; s0 = yinBuffer[x0]; s1 = yinBuffer[tauEstimate]; s2 = yinBuffer[x2]; // fixed AUBIO implementation, thanks to Karl Helgason: // (2.0f * s1 - s2 - s0) was incorrectly multiplied with -1 betterTau = tauEstimate + (s2 - s0) / (2 * (2 * s1 - s2 - s0)); } return betterTau; }
Implements step 5 of the AUBIO_YIN paper. It refines the estimated tau value using parabolic interpolation. This is needed to detect higher frequencies more precisely. See http://fizyka.umk.pl/nrbook/c10-2.pdf and for more background http://fedc.wiwi.hu-berlin.de/xplore/tutorials/xegbohtmlnode62.html @param tauEstimate The estimated tau value. @return A better, more precise tau value.
Yin::parabolicInterpolation
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/Yin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/Yin.java
Apache-2.0
public Goertzel(final float audioSampleRate, final int bufferSize, double[] frequencies, FrequenciesDetectedHandler handler) { frequenciesToDetect = frequencies; precalculatedCosines = new double[frequencies.length]; precalculatedWnk = new double[frequencies.length]; this.handler = handler; calculatedPowers = new double[frequencies.length]; for (int i = 0; i < frequenciesToDetect.length; i++) { precalculatedCosines[i] = 2 * Math.cos(2 * Math.PI * frequenciesToDetect[i] / audioSampleRate); precalculatedWnk[i] = Math.exp(-2 * Math.PI * frequenciesToDetect[i] / audioSampleRate); } }
Create a new Generalized Goertzel processor. @param audioSampleRate The sample rate of the audio in Hz. @param bufferSize the size of the buffer. @param frequencies The list of frequencies to detect (in Hz). @param handler The handler used to handle the detected frequencies.
Goertzel::Goertzel
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/Goertzel.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/Goertzel.java
Apache-2.0
public static float[] generateDTMFTone(char character){ double firstFrequency = -1; double secondFrequency = -1; for(int row = 0 ; row < DTMF_CHARACTERS.length ; row++){ for(int col = 0 ; col < DTMF_CHARACTERS[row].length ; col++){ if(DTMF_CHARACTERS[row][col] == character){ firstFrequency = DTMF_FREQUENCIES[row]; secondFrequency = DTMF_FREQUENCIES[col + 4]; } } } return DTMF.audioBufferDTMF(firstFrequency,secondFrequency,512*2*10); }
Generate a DTMF - tone for a valid DTMF character. @param character a valid DTMF character (present in DTMF_CHARACTERS} @return a float buffer of predefined length (7168 samples) with the correct DTMF tone representing the character.
DTMF::generateDTMFTone
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/DTMF.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/DTMF.java
Apache-2.0
public static boolean isDTMFCharacter(char character){ double firstFrequency = -1; double secondFrequency = -1; for(int row = 0 ; row < DTMF_CHARACTERS.length ; row++){ for(int col = 0 ; col < DTMF_CHARACTERS[row].length ; col++){ if(DTMF_CHARACTERS[row][col] == character){ firstFrequency = DTMF_FREQUENCIES[row]; secondFrequency = DTMF_FREQUENCIES[col + 4]; } } } return (firstFrequency!=-1 && secondFrequency!=-1); }
Checks if the given character is present in DTMF_CHARACTERS. @param character the character to check. @return True if the given character is present in DTMF_CHARACTERS, false otherwise.
DTMF::isDTMFCharacter
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/DTMF.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/DTMF.java
Apache-2.0
public static float[] audioBufferDTMF(final double f0, final double f1, int size) { final double sampleRate = 44100.0; final double amplitudeF0 = 0.4; final double amplitudeF1 = 0.4; final double twoPiF0 = 2 * Math.PI * f0; final double twoPiF1 = 2 * Math.PI * f1; final float[] buffer = new float[size]; for (int sample = 0; sample < buffer.length; sample++) { final double time = sample / sampleRate; double f0Component = amplitudeF0 * Math.sin(twoPiF0 * time); double f1Component = amplitudeF1 * Math.sin(twoPiF1 * time); buffer[sample] = (float) (f0Component + f1Component); } return buffer; }
Creates an audio buffer in a float array of the defined size. The sample rate is 44100Hz by default. It mixes the two given frequencies with an amplitude of 0.5. @param f0 The first fundamental frequency. @param f1 The second fundamental frequency. @param size The size of the float array (sample rate is 44.1kHz). @return An array of the defined size.
DTMF::audioBufferDTMF
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/DTMF.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/DTMF.java
Apache-2.0
public PitchDetector getDetector(float sampleRate,int bufferSize){ PitchDetector detector; if (this == MPM ) { detector = new McLeodPitchMethod(sampleRate, bufferSize); } else if(this == DYNAMIC_WAVELET ) { detector = new DynamicWavelet(sampleRate,bufferSize); } else if(this == FFT_YIN){ detector = new FastYin(sampleRate, bufferSize); } else if(this==AMDF){ detector = new AMDF(sampleRate, bufferSize); } else { detector = new Yin(sampleRate, bufferSize); } return detector; }
Returns a new instance of a pitch detector object based on the provided values. @param sampleRate The sample rate of the audio buffer. @param bufferSize The size (in samples) of the audio buffer. @return A new pitch detector object.
PitchEstimationAlgorithm::getDetector
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/PitchProcessor.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/PitchProcessor.java
Apache-2.0
public PitchProcessor(PitchEstimationAlgorithm algorithm, float sampleRate, int bufferSize, PitchDetectionHandler handler) { detector = algorithm.getDetector(sampleRate, bufferSize); this.handler = handler; }
Initialize a new pitch processor. @param algorithm An enum defining the algorithm. @param sampleRate The sample rate of the buffer (Hz). @param bufferSize The size of the buffer in samples. @param handler The handler handles detected pitch.
PitchEstimationAlgorithm::PitchProcessor
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/PitchProcessor.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/PitchProcessor.java
Apache-2.0
public FastYin(final float audioSampleRate, final int bufferSize) { this(audioSampleRate, bufferSize, DEFAULT_THRESHOLD); }
Create a new pitch detector for a stream with the defined sample rate. Processes the audio in blocks of the defined size. @param audioSampleRate The sample rate of the audio stream. E.g. 44.1 kHz. @param bufferSize The size of a buffer. E.g. 1024.
FastYin::FastYin
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
Apache-2.0
public FastYin(final float audioSampleRate, final int bufferSize, final double yinThreshold) { this.sampleRate = audioSampleRate; this.threshold = yinThreshold; yinBuffer = new float[bufferSize / 2]; //Initializations for FFT difference step audioBufferFFT = new float[2*bufferSize]; kernel = new float[2*bufferSize]; yinStyleACF = new float[2*bufferSize]; fft = new FloatFFT(bufferSize); result = new PitchDetectionResult(); }
Create a new pitch detector for a stream with the defined sample rate. Processes the audio in blocks of the defined size. @param audioSampleRate The sample rate of the audio stream. E.g. 44.1 kHz. @param bufferSize The size of a buffer. E.g. 1024. @param yinThreshold The parameter that defines which peaks are kept as possible pitch candidates. See the YIN paper for more details.
FastYin::FastYin
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
Apache-2.0
public PitchDetectionResult getPitch(final float[] audioBuffer) { final int tauEstimate; final float pitchInHertz; // step 2 difference(audioBuffer); // step 3 cumulativeMeanNormalizedDifference(); // step 4 tauEstimate = absoluteThreshold(); // step 5 if (tauEstimate != -1) { final float betterTau = parabolicInterpolation(tauEstimate); // step 6 // TODO Implement optimization for the AUBIO_YIN algorithm. // 0.77% => 0.5% error rate, // using the data of the YIN paper // bestLocalEstimate() // conversion to Hz pitchInHertz = sampleRate / betterTau; } else{ // no pitch found pitchInHertz = -1; } result.setPitch(pitchInHertz); return result; }
The main flow of the YIN algorithm. Returns a pitch value in Hz or -1 if no pitch is detected. @return a pitch value in Hz or -1 if no pitch is detected.
FastYin::getPitch
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
Apache-2.0
private void difference(final float[] audioBuffer) { // POWER TERM CALCULATION // ... for the power terms in equation (7) in the Yin paper float[] powerTerms = new float[yinBuffer.length]; for (int j = 0; j < yinBuffer.length; ++j) { powerTerms[0] += audioBuffer[j] * audioBuffer[j]; } // now iteratively calculate all others (saves a few multiplications) for (int tau = 1; tau < yinBuffer.length; ++tau) { powerTerms[tau] = powerTerms[tau-1] - audioBuffer[tau-1] * audioBuffer[tau-1] + audioBuffer[tau+yinBuffer.length] * audioBuffer[tau+yinBuffer.length]; } // YIN-STYLE AUTOCORRELATION via FFT // 1. data for (int j = 0; j < audioBuffer.length; ++j) { audioBufferFFT[2*j] = audioBuffer[j]; audioBufferFFT[2*j+1] = 0; } fft.complexForward(audioBufferFFT); // 2. half of the data, disguised as a convolution kernel for (int j = 0; j < yinBuffer.length; ++j) { kernel[2*j] = audioBuffer[(yinBuffer.length-1)-j]; kernel[2*j+1] = 0; kernel[2*j+audioBuffer.length] = 0; kernel[2*j+audioBuffer.length+1] = 0; } fft.complexForward(kernel); // 3. convolution via complex multiplication for (int j = 0; j < audioBuffer.length; ++j) { yinStyleACF[2*j] = audioBufferFFT[2*j]*kernel[2*j] - audioBufferFFT[2*j+1]*kernel[2*j+1]; // real yinStyleACF[2*j+1] = audioBufferFFT[2*j+1]*kernel[2*j] + audioBufferFFT[2*j]*kernel[2*j+1]; // imaginary } fft.complexInverse(yinStyleACF, true); // CALCULATION OF difference function // ... according to (7) in the Yin paper. for (int j = 0; j < yinBuffer.length; ++j) { // taking only the real part yinBuffer[j] = powerTerms[0] + powerTerms[j] - 2 * yinStyleACF[2 * (yinBuffer.length - 1 + j)]; } }
Implements the difference function as described in step 2 of the YIN paper with an FFT to reduce the number of operations.
FastYin::difference
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
Apache-2.0
private void cumulativeMeanNormalizedDifference() { int tau; yinBuffer[0] = 1; float runningSum = 0; for (tau = 1; tau < yinBuffer.length; tau++) { runningSum += yinBuffer[tau]; yinBuffer[tau] *= tau / runningSum; } }
The cumulative mean normalized difference function as described in step 3 of the YIN paper. <br> <code> yinBuffer[0] == yinBuffer[1] = 1 </code>
FastYin::cumulativeMeanNormalizedDifference
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
Apache-2.0
private int absoluteThreshold() { // Uses another loop construct // than the AUBIO implementation int tau; // first two positions in yinBuffer are always 1 // So start at the third (index 2) for (tau = 2; tau < yinBuffer.length; tau++) { if (yinBuffer[tau] < threshold) { while (tau + 1 < yinBuffer.length && yinBuffer[tau + 1] < yinBuffer[tau]) { tau++; } // found tau, exit loop and return // store the probability // From the YIN paper: The threshold determines the list of // candidates admitted to the set, and can be interpreted as the // proportion of aperiodic power tolerated // within a periodic signal. // // Since we want the periodicity and and not aperiodicity: // periodicity = 1 - aperiodicity result.setProbability(1 - yinBuffer[tau]); break; } } // if no pitch found, tau => -1 if (tau == yinBuffer.length || yinBuffer[tau] >= threshold || result.getProbability() > 1.0) { tau = -1; result.setProbability(0); result.setPitched(false); } else { result.setPitched(true); } return tau; }
Implements step 4 of the AUBIO_YIN paper.
FastYin::absoluteThreshold
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
Apache-2.0
private float parabolicInterpolation(final int tauEstimate) { final float betterTau; final int x0; final int x2; if (tauEstimate < 1) { x0 = tauEstimate; } else { x0 = tauEstimate - 1; } if (tauEstimate + 1 < yinBuffer.length) { x2 = tauEstimate + 1; } else { x2 = tauEstimate; } if (x0 == tauEstimate) { if (yinBuffer[tauEstimate] <= yinBuffer[x2]) { betterTau = tauEstimate; } else { betterTau = x2; } } else if (x2 == tauEstimate) { if (yinBuffer[tauEstimate] <= yinBuffer[x0]) { betterTau = tauEstimate; } else { betterTau = x0; } } else { float s0, s1, s2; s0 = yinBuffer[x0]; s1 = yinBuffer[tauEstimate]; s2 = yinBuffer[x2]; // fixed AUBIO implementation, thanks to Karl Helgason: // (2.0f * s1 - s2 - s0) was incorrectly multiplied with -1 betterTau = tauEstimate + (s2 - s0) / (2 * (2 * s1 - s2 - s0)); } return betterTau; }
Implements step 5 of the AUBIO_YIN paper. It refines the estimated tau value using parabolic interpolation. This is needed to detect higher frequencies more precisely. See http://fizyka.umk.pl/nrbook/c10-2.pdf and for more background http://fedc.wiwi.hu-berlin.de/xplore/tutorials/xegbohtmlnode62.html @param tauEstimate The estimated tau value. @return A better, more precise tau value.
FastYin::parabolicInterpolation
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/pitch/FastYin.java
Apache-2.0
public BeatRootSpectralFluxOnsetDetector(AudioDispatcher d,int fftSize, int hopSize){ this.hopSize = hopSize; this.hopTime = hopSize/d.getFormat().getSampleRate(); this.fftSize = fftSize; System.err.println("Please use the ComplexOnset detector: BeatRootSpectralFluxOnsetDetector does currenlty not support streaming"); //no overlap //FIXME: int durationInFrames = -1000; totalFrames = (durationInFrames / hopSize) + 4; energy = new double[totalFrames*energyOversampleFactor]; spectralFlux = new double[totalFrames]; reBuffer = new float[fftSize/2]; imBuffer = new float[fftSize/2]; prevFrame = new float[fftSize/2]; makeFreqMap(fftSize, d.getFormat().getSampleRate()); newFrame = new double[freqMapSize]; frames = new double[totalFrames][freqMapSize]; handler = new PrintOnsetHandler(); fft = new FFT(fftSize,new ScaledHammingWindow()); }
Create anew onset detector @param d the dispatcher @param fftSize The size of the fft @param hopSize the hop size of audio blocks.
BeatRootSpectralFluxOnsetDetector::BeatRootSpectralFluxOnsetDetector
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/onsets/BeatRootSpectralFluxOnsetDetector.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/onsets/BeatRootSpectralFluxOnsetDetector.java
Apache-2.0
protected void makeFreqMap(int fftSize, float sampleRate) { freqMap = new int[fftSize/2+1]; double binWidth = sampleRate / fftSize; int crossoverBin = (int)(2 / (Math.pow(2, 1/12.0) - 1)); int crossoverMidi = (int)Math.round(Math.log(crossoverBin*binWidth/440)/ Math.log(2) * 12 + 69); // freq = 440 * Math.pow(2, (midi-69)/12.0) / binWidth; int i = 0; while (i <= crossoverBin) freqMap[i++] = i; while (i <= fftSize/2) { double midi = Math.log(i*binWidth/440) / Math.log(2) * 12 + 69; if (midi > 127) midi = 127; freqMap[i++] = crossoverBin + (int)Math.round(midi) - crossoverMidi; } freqMapSize = freqMap[i-1] + 1; } // makeFreqMap()
Creates a map of FFT frequency bins to comparison bins. Where the spacing of FFT bins is less than 0.5 semitones, the mapping is one to one. Where the spacing is greater than 0.5 semitones, the FFT energy is mapped into semitone-wide bins. No scaling is performed; that is the energy is summed into the comparison bins. See also processFrame()
BeatRootSpectralFluxOnsetDetector::makeFreqMap
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/onsets/BeatRootSpectralFluxOnsetDetector.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/onsets/BeatRootSpectralFluxOnsetDetector.java
Apache-2.0
public ComplexOnsetDetector(int fftSize,double peakThreshold,double minimumInterOnsetInterval,double silenceThreshold){ fft = new FFT(fftSize,new HannWindow()); this.silenceThreshold = silenceThreshold; this.minimumInterOnsetInterval = minimumInterOnsetInterval; peakPicker = new PeakPicker(peakThreshold); int rsize = fftSize/2+1; oldmag = new float[rsize]; dev1 = new float[rsize]; theta1 = new float[rsize]; theta2 = new float[rsize]; handler = new PrintOnsetHandler(); }
@param fftSize The size of the fft to take (e.g. 512) @param peakThreshold A threshold used for peak picking. Values between 0.1 and 0.8. Default is 0.3, if too many onsets are detected adjust to 0.4 or 0.5. @param silenceThreshold The threshold that defines when a buffer is silent. Default is -70dBSPL. -90 is also used. @param minimumInterOnsetInterval The minimum inter-onset-interval in seconds. When two onsets are detected within this interval the last one does not count. Default is 0.004 seconds.
ComplexOnsetDetector::ComplexOnsetDetector
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/onsets/ComplexOnsetDetector.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/onsets/ComplexOnsetDetector.java
Apache-2.0
public ComplexOnsetDetector(int fftSize){ this(fftSize,0.3); }
Create a new detector @param fftSize the size of the fft should be related to the audio block size.
ComplexOnsetDetector::ComplexOnsetDetector
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/onsets/ComplexOnsetDetector.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/onsets/ComplexOnsetDetector.java
Apache-2.0
public ComplexOnsetDetector(int fftSize,double peakThreshold){ this(fftSize,peakThreshold,0.03); }
Create a new detector @param fftSize the size of the fft should be related to the audio block size. @param peakThreshold the threshold when a peak is accepted.
ComplexOnsetDetector::ComplexOnsetDetector
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/onsets/ComplexOnsetDetector.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/onsets/ComplexOnsetDetector.java
Apache-2.0
public ComplexOnsetDetector(int fftSize,double peakThreshold,double minimumInterOnsetInterval){ this(fftSize,peakThreshold,minimumInterOnsetInterval,-70.0); }
Create a new detector @param fftSize the size of the fft should be related to the audio block size. @param peakThreshold the threshold when a peak is accepted. @param minimumInterOnsetInterval The minimum interval between onsets in seconds.
ComplexOnsetDetector::ComplexOnsetDetector
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/onsets/ComplexOnsetDetector.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/onsets/ComplexOnsetDetector.java
Apache-2.0
public void setThreshold(double threshold){ this.peakPicker.setThreshold(threshold); }
Set a new threshold for detected peaks. @param threshold A new threshold.
ComplexOnsetDetector::setThreshold
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/onsets/ComplexOnsetDetector.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/onsets/ComplexOnsetDetector.java
Apache-2.0
public PercussionOnsetDetector(float sampleRate, int bufferSize, int bufferOverlap, OnsetHandler handler) { this(sampleRate, bufferSize, handler, DEFAULT_SENSITIVITY, DEFAULT_THRESHOLD); }
Create a new percussion onset detector. With a default sensitivity and threshold. @param sampleRate The sample rate in Hz (used to calculate timestamps) @param bufferSize The size of the buffer in samples. @param bufferOverlap The overlap of buffers in samples. @param handler An interface implementor to handle percussion onset events.
PercussionOnsetDetector::PercussionOnsetDetector
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/onsets/PercussionOnsetDetector.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/onsets/PercussionOnsetDetector.java
Apache-2.0
public PercussionOnsetDetector(float sampleRate, int bufferSize, OnsetHandler handler, double sensitivity, double threshold) { fft = new FFT(bufferSize / 2); this.threshold = threshold; this.sensitivity = sensitivity; priorMagnitudes = new float[bufferSize / 2]; currentMagnitudes = new float[bufferSize / 2]; this.handler = handler; this.sampleRate = sampleRate; }
Create a new percussion onset detector. @param sampleRate The sample rate in Hz (used to calculate timestamps) @param bufferSize The size of the buffer in samples. @param handler An interface implementor to handle percussion onset events. @param sensitivity Sensitivity of the peak detector applied to broadband detection function (%). In [0-100]. @param threshold Energy rise within a frequency bin necessary to count toward broadband total (dB). In [0-20].
PercussionOnsetDetector::PercussionOnsetDetector
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/onsets/PercussionOnsetDetector.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/onsets/PercussionOnsetDetector.java
Apache-2.0
public static TarsosDSPAudioFormat getTargetAudioFormat(int targetSampleRate) { TarsosDSPAudioFormat audioFormat = new TarsosDSPAudioFormat(TarsosDSPAudioFormat.Encoding.PCM_SIGNED, targetSampleRate, 2 * 8, 1, 2, targetSampleRate, ByteOrder.BIG_ENDIAN.equals(ByteOrder.nativeOrder())); return audioFormat; }
Constructs the target audio format. The audio format is one channel signed PCM of a given sample rate. @param targetSampleRate The sample rate to convert to. @return The audio format after conversion.
PipeDecoder::getTargetAudioFormat
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/PipeDecoder.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/PipeDecoder.java
Apache-2.0
public TarsosDSPAudioInputStream getMonoStream(int targetSampleRate,double startTimeOffset){ return getMonoStream(targetSampleRate, startTimeOffset,-1); }
Return a one channel, signed PCM stream of audio of a defined sample rate. @param targetSampleRate The target sample stream. @param startTimeOffset The start time offset. @return An audio stream which can be used to read samples from.
PipedAudioStream::getMonoStream
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/PipedAudioStream.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/PipedAudioStream.java
Apache-2.0
public TarsosDSPAudioInputStream getMonoStream(int targetSampleRate, double startTimeOffset, double numberOfSeconds) { InputStream stream = null; stream = decoder.getDecodedStream(resource, targetSampleRate,startTimeOffset,numberOfSeconds); return new UniversalAudioInputStream(stream, getTargetFormat(targetSampleRate)); }
Return a one channel, signed PCM stream of audio of a defined sample rate. @param targetSampleRate The target sample stream. @param startTimeOffset The start time offset. @param numberOfSeconds the number of seconds to pipe. If negative the stream is processed until end of stream. @return An audio stream which can be used to read samples from.
PipedAudioStream::getMonoStream
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/PipedAudioStream.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/PipedAudioStream.java
Apache-2.0
public TarsosDSPAudioFormat(Encoding encoding, float sampleRate, int sampleSizeInBits, int channels, int frameSize, float frameRate, boolean bigEndian) { this.encoding = encoding; this.sampleRate = sampleRate; this.sampleSizeInBits = sampleSizeInBits; this.channels = channels; this.frameSize = frameSize; this.frameRate = frameRate; this.bigEndian = bigEndian; this.properties = null; }
Constructs an <code>AudioFormat</code> with the given parameters. The encoding specifies the convention used to represent the data. The other parameters are further explained in the @param encoding the audio encoding technique @param sampleRate the number of samples per second @param sampleSizeInBits the number of bits in each sample @param channels the number of channels (1 for mono, 2 for stereo, and so on) @param frameSize the number of bytes in each frame @param frameRate the number of frames per second @param bigEndian indicates whether the data for a single sample is stored in big-endian byte order (<code>false</code> means little-endian)
TarsosDSPAudioFormat::TarsosDSPAudioFormat
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public TarsosDSPAudioFormat(Encoding encoding, float sampleRate, int sampleSizeInBits, int channels, int frameSize, float frameRate, boolean bigEndian, Map<String, Object> properties) { this(encoding, sampleRate, sampleSizeInBits, channels, frameSize, frameRate, bigEndian); this.properties = new HashMap<String, Object>(properties); }
Constructs an <code>AudioFormat</code> with the given parameters. The encoding specifies the convention used to represent the data. The other parameters are further explained in the @param encoding the audio encoding technique @param sampleRate the number of samples per second @param sampleSizeInBits the number of bits in each sample @param channels the number of channels (1 for mono, 2 for stereo, and so on) @param frameSize the number of bytes in each frame @param frameRate the number of frames per second @param bigEndian indicates whether the data for a single sample is stored in big-endian byte order (<code>false</code> means little-endian) @param properties a <code>Map&lt;String,Object&gt;</code> object containing format properties @since 1.5
TarsosDSPAudioFormat::TarsosDSPAudioFormat
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public TarsosDSPAudioFormat(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian) { this((signed ? Encoding.PCM_SIGNED : Encoding.PCM_UNSIGNED), sampleRate, sampleSizeInBits, channels, (channels == NOT_SPECIFIED || sampleSizeInBits == NOT_SPECIFIED)? NOT_SPECIFIED: ((sampleSizeInBits + 7) / 8) * channels, sampleRate, bigEndian); }
Constructs an <code>AudioFormat</code> with a linear PCM encoding and the given parameters. The frame size is set to the number of bytes required to contain one sample from each channel, and the frame rate is set to the sample rate. @param sampleRate the number of samples per second @param sampleSizeInBits the number of bits in each sample @param channels the number of channels (1 for mono, 2 for stereo, and so on) @param signed indicates whether the data is signed or unsigned @param bigEndian indicates whether the data for a single sample is stored in big-endian byte order (<code>false</code> means little-endian)
TarsosDSPAudioFormat::TarsosDSPAudioFormat
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public Encoding getEncoding() { return encoding; }
Obtains the type of encoding for sounds in this format. @return the encoding type @see Encoding#PCM_SIGNED @see Encoding#PCM_UNSIGNED @see Encoding#ULAW @see Encoding#ALAW
TarsosDSPAudioFormat::getEncoding
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public float getSampleRate() { return sampleRate; }
Obtains the sample rate. For compressed formats, the return value is the sample rate of the uncompressed audio data. When this AudioFormat is used for queries capabilities , a sample rate of <code>AudioSystem.NOT_SPECIFIED</code> means that any sample rate is acceptable. <code>AudioSystem.NOT_SPECIFIED</code> is also returned when the sample rate is not defined for this audio format. @return the number of samples per second, or <code>AudioSystem.NOT_SPECIFIED</code> @see #getFrameRate()
TarsosDSPAudioFormat::getSampleRate
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public int getSampleSizeInBits() { return sampleSizeInBits; }
Obtains the size of a sample. For compressed formats, the return value is the sample size of the uncompressed audio data. When this AudioFormat is used for queries or capabilities , a sample size of <code>AudioSystem.NOT_SPECIFIED</code> means that any sample size is acceptable. <code>AudioSystem.NOT_SPECIFIED</code> is also returned when the sample size is not defined for this audio format. @return the number of bits in each sample, or <code>AudioSystem.NOT_SPECIFIED</code> @see #getFrameSize()
TarsosDSPAudioFormat::getSampleSizeInBits
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public int getChannels() { return channels; }
Obtains the number of channels. When this AudioFormat is used for queries or capabilities , a return value of <code>AudioSystem.NOT_SPECIFIED</code> means that any (positive) number of channels is acceptable. @return The number of channels (1 for mono, 2 for stereo, etc.), or <code>AudioSystem.NOT_SPECIFIED</code>
TarsosDSPAudioFormat::getChannels
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public int getFrameSize() { return frameSize; }
Obtains the frame size in bytes. When this AudioFormat is used for queries or capabilities, a frame size of <code>AudioSystem.NOT_SPECIFIED</code> means that any frame size is acceptable. <code>AudioSystem.NOT_SPECIFIED</code> is also returned when the frame size is not defined for this audio format. @return the number of bytes per frame, or <code>AudioSystem.NOT_SPECIFIED</code> @see #getSampleSizeInBits()
TarsosDSPAudioFormat::getFrameSize
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public float getFrameRate() { return frameRate; }
Obtains the frame rate in frames per second. When this AudioFormat is used for queries or capabilities , a frame rate of <code>AudioSystem.NOT_SPECIFIED</code> means that any frame rate is acceptable. <code>AudioSystem.NOT_SPECIFIED</code> is also returned when the frame rate is not defined for this audio format. @return the number of frames per second, or <code>AudioSystem.NOT_SPECIFIED</code> @see #getSampleRate()
TarsosDSPAudioFormat::getFrameRate
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public boolean isBigEndian() { return bigEndian; }
Indicates whether the audio data is stored in big-endian or little-endian byte order. If the sample size is not more than one byte, the return value is irrelevant. @return <code>true</code> if the data is stored in big-endian byte order, <code>false</code> if little-endian
TarsosDSPAudioFormat::isBigEndian
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public Object getProperty(String key) { if (properties == null) { return null; } return properties.get(key); }
Obtain the property value specified by the key. The concept of properties is further explained in the. <p>If the specified property is not defined for a particular file format, this method returns <code>null</code>. @param key the key of the desired property @return the value of the property with the specified key, or <code>null</code> if the property does not exist. @see #properties() @since 1.5
TarsosDSPAudioFormat::getProperty
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public boolean matches(TarsosDSPAudioFormat format) { return format.getEncoding().equals(getEncoding()) && ((format.getSampleRate() == (float) NOT_SPECIFIED) || (format.getSampleRate() == getSampleRate())) && (format.getSampleSizeInBits() == getSampleSizeInBits()) && (format.getChannels() == getChannels() && (format.getFrameSize() == getFrameSize()) && ((format.getFrameRate() == (float) NOT_SPECIFIED) || (format.getFrameRate() == getFrameRate())) && ((format.getSampleSizeInBits() <= 8) || (format.isBigEndian() == isBigEndian()))); }
Indicates whether this format matches the one specified. To match, two formats must have the same encoding, the same number of channels, and the same number of bits per sample and bytes per frame. The two formats must also have the same sample rate, unless the specified format has the sample rate value <code>AudioSystem.NOT_SPECIFIED</code>, which any sample rate will match. The frame rates must similarly be equal, unless the specified format has the frame rate value <code>AudioSystem.NOT_SPECIFIED</code>. The byte order (big-endian or little-endian) must match if the sample size is greater than one byte. @param format format to test for match @return <code>true</code> if this format matches the one specified, <code>false</code> otherwise. /* $$kk: 04.20.99: i changed the semantics of this.
TarsosDSPAudioFormat::matches
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public String toString() { String sEncoding = ""; if (getEncoding() != null) { sEncoding = getEncoding().toString() + " "; } String sSampleRate; if (getSampleRate() == (float) NOT_SPECIFIED) { sSampleRate = "unknown sample rate, "; } else { sSampleRate = getSampleRate() + " Hz, "; } String sSampleSizeInBits; if (getSampleSizeInBits() == (float) NOT_SPECIFIED) { sSampleSizeInBits = "unknown bits per sample, "; } else { sSampleSizeInBits = getSampleSizeInBits() + " bit, "; } String sChannels; if (getChannels() == 1) { sChannels = "mono, "; } else if (getChannels() == 2) { sChannels = "stereo, "; } else { if (getChannels() == NOT_SPECIFIED) { sChannels = " unknown number of channels, "; } else { sChannels = getChannels()+" channels, "; } } String sFrameSize; if (getFrameSize() == (float) NOT_SPECIFIED) { sFrameSize = "unknown frame size, "; } else { sFrameSize = getFrameSize()+ " bytes/frame, "; } String sFrameRate = ""; if (Math.abs(getSampleRate() - getFrameRate()) > 0.00001) { if (getFrameRate() == (float) NOT_SPECIFIED) { sFrameRate = "unknown frame rate, "; } else { sFrameRate = getFrameRate() + " frames/second, "; } } String sEndian = ""; if ((getEncoding().equals(Encoding.PCM_SIGNED) || getEncoding().equals(Encoding.PCM_UNSIGNED)) && ((getSampleSizeInBits() > 8) || (getSampleSizeInBits() == NOT_SPECIFIED))) { if (isBigEndian()) { sEndian = "big-endian"; } else { sEndian = "little-endian"; } } return sEncoding + sSampleRate + sSampleSizeInBits + sChannels + sFrameSize + sFrameRate + sEndian; }
Returns a string that describes the format, such as: "PCM SIGNED 22050 Hz 16 bit mono big-endian". The contents of the string may vary between implementations of Java Sound. @return a string that describes the format parameters
TarsosDSPAudioFormat::toString
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public Encoding(String name) { this.name = name; }
Constructs a new encoding. @param name the name of the new type of encoding
Encoding::Encoding
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public final boolean equals(Object obj) { if (toString() == null) { return (obj != null) && (obj.toString() == null); } if (obj instanceof Encoding) { return toString().equals(obj.toString()); } return false; }
Finalizes the equals method
Encoding::equals
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public final int hashCode() { if (toString() == null) { return 0; } return toString().hashCode(); }
Finalizes the hashCode method
Encoding::hashCode
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public final String toString() { return name; }
Provides the <code>String</code> representation of the encoding. This <code>String</code> is the same name that was passed to the constructor. For the predefined encodings, the name is similar to the encoding's variable (field) name. For example, <code>PCM_SIGNED.toString()</code> returns the name "pcm_signed". @return the encoding name
Encoding::toString
java
ZTFtrue/MonsterMusic
app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/be/tarsos/dsp/io/TarsosDSPAudioFormat.java
Apache-2.0
public EmptyFrameException() { }
Creates a new EmptyFrameException datatype.
EmptyFrameException::EmptyFrameException
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/EmptyFrameException.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/EmptyFrameException.java
Apache-2.0
public EmptyFrameException(Throwable ex) { super(ex); }
Creates a new EmptyFrameException datatype. @param ex the cause.
EmptyFrameException::EmptyFrameException
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/EmptyFrameException.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/EmptyFrameException.java
Apache-2.0
public EmptyFrameException(String msg) { super(msg); }
Creates a new EmptyFrameException datatype. @param msg the detail message.
EmptyFrameException::EmptyFrameException
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/EmptyFrameException.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/EmptyFrameException.java
Apache-2.0
public EmptyFrameException(String msg, Throwable ex) { super(msg, ex); }
Creates a new EmptyFrameException datatype. @param msg the detail message. @param ex the cause.
EmptyFrameException::EmptyFrameException
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/EmptyFrameException.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/EmptyFrameException.java
Apache-2.0
private TagOptionSingleton() { setToDefault(); }
Creates a new TagOptions datatype. All Options are set to their default values
TagOptionSingleton::TagOptionSingleton
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public static TagOptionSingleton getInstance() { return getInstance(defaultOptions); }
@return
TagOptionSingleton::getInstance
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public static TagOptionSingleton getInstance(String instanceKey) { TagOptionSingleton tagOptions = tagOptionTable.get(instanceKey); if (tagOptions == null) { tagOptions = new TagOptionSingleton(); tagOptionTable.put(instanceKey, tagOptions); } return tagOptions; }
@param instanceKey @return
TagOptionSingleton::getInstance
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public void setFilenameTagSave(boolean filenameTagSave) { this.filenameTagSave = filenameTagSave; }
@param filenameTagSave
TagOptionSingleton::setFilenameTagSave
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public boolean isFilenameTagSave() { return filenameTagSave; }
@return
TagOptionSingleton::isFilenameTagSave
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public void setID3V2Version(ID3V2Version id3v2Version) { this.id3v2Version = id3v2Version; }
@param id3v2Version
TagOptionSingleton::setID3V2Version
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public ID3V2Version getID3V2Version() { return id3v2Version; }
@return
TagOptionSingleton::getID3V2Version
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public void setInstanceKey(String instanceKey) { TagOptionSingleton.defaultOptions = instanceKey; }
@param instanceKey
TagOptionSingleton::setInstanceKey
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public static String getInstanceKey() { return defaultOptions; }
@return
TagOptionSingleton::getInstanceKey
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public void setId3v1Save(boolean id3v1Save) { this.id3v1Save = id3v1Save; }
@param id3v1Save
TagOptionSingleton::setId3v1Save
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public boolean isId3v1Save() { return id3v1Save; }
@return
TagOptionSingleton::isId3v1Save
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public void setId3v1SaveAlbum(boolean id3v1SaveAlbum) { this.id3v1SaveAlbum = id3v1SaveAlbum; }
@param id3v1SaveAlbum
TagOptionSingleton::setId3v1SaveAlbum
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public boolean isId3v1SaveAlbum() { return id3v1SaveAlbum; }
@return
TagOptionSingleton::isId3v1SaveAlbum
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public void setId3v1SaveArtist(boolean id3v1SaveArtist) { this.id3v1SaveArtist = id3v1SaveArtist; }
@param id3v1SaveArtist
TagOptionSingleton::setId3v1SaveArtist
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public boolean isId3v1SaveArtist() { return id3v1SaveArtist; }
@return
TagOptionSingleton::isId3v1SaveArtist
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public void setId3v1SaveComment(boolean id3v1SaveComment) { this.id3v1SaveComment = id3v1SaveComment; }
@param id3v1SaveComment
TagOptionSingleton::setId3v1SaveComment
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public boolean isId3v1SaveComment() { return id3v1SaveComment; }
@return
TagOptionSingleton::isId3v1SaveComment
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public void setId3v1SaveGenre(boolean id3v1SaveGenre) { this.id3v1SaveGenre = id3v1SaveGenre; }
@param id3v1SaveGenre
TagOptionSingleton::setId3v1SaveGenre
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public boolean isId3v1SaveGenre() { return id3v1SaveGenre; }
@return
TagOptionSingleton::isId3v1SaveGenre
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public void setId3v1SaveTitle(boolean id3v1SaveTitle) { this.id3v1SaveTitle = id3v1SaveTitle; }
@param id3v1SaveTitle
TagOptionSingleton::setId3v1SaveTitle
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public boolean isId3v1SaveTitle() { return id3v1SaveTitle; }
@return
TagOptionSingleton::isId3v1SaveTitle
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0
public void setId3v1SaveTrack(boolean id3v1SaveTrack) { this.id3v1SaveTrack = id3v1SaveTrack; }
@param id3v1SaveTrack
TagOptionSingleton::setId3v1SaveTrack
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/TagOptionSingleton.java
Apache-2.0