本文整理汇总了Java中be.tarsos.dsp.pitch.PitchDetectionResult.getProbability方法的典型用法代码示例。如果您正苦于以下问题:Java PitchDetectionResult.getProbability方法的具体用法?Java PitchDetectionResult.getProbability怎么用?Java PitchDetectionResult.getProbability使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类be.tarsos.dsp.pitch.PitchDetectionResult
的用法示例。
在下文中一共展示了PitchDetectionResult.getProbability方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handlePitch
import be.tarsos.dsp.pitch.PitchDetectionResult; //导入方法依赖的package包/类
public void handlePitch(PitchDetectionResult pitchDetectionResult, AudioEvent audioEvent) {
if (pitchDetectionResult.getPitch() != -1) {
double timeStamp = audioEvent.getTimeStamp();
float pitch = pitchDetectionResult.getPitch();
float probability = pitchDetectionResult.getProbability();
double rms = audioEvent.getRMS() * 100;
String message = String.format("Pitch detected at %.2fs: %.2fHz ( %.2f probability, RMS: %.5f )\n",
timeStamp, pitch, probability, rms);
System.out.println(message);
String addMe1;
if (probability < 0.5 && Pitch.pitches.getItemCount() > 2) {
addMe1 = Pitch.pitches.getItem(Pitch.pitches.getItemCount() - 1);
} else {
addMe1 = String.valueOf(pitch);
}
String addMe2 = String.valueOf(timeStamp);
Pitch.pitches.add(addMe1);
Pitch.time.add(addMe2);
}
}
示例2: newPitchDetectionHandler
import be.tarsos.dsp.pitch.PitchDetectionResult; //导入方法依赖的package包/类
/**
* A pitch detection storing {@link SoundEvent}
*/
protected VoiceDetection newPitchDetectionHandler() {
VoiceDetection prs = new VoiceDetection(settings.format.getSampleRate(), settings) {
@Override
public void handlePitch(PitchDetectionResult pitchDetectionResult, AudioEvent audioEvent) {
// Process
float frequency = (float) computeFrequency(pitchDetectionResult);
float amplitude = computeAmplitude(audioEvent);
double timestamp = audioEvent.getTimeStamp();
// pitch
SoundEvent pitch = SoundEvent.pitch((float) timestamp, frequency);
pitch.confidence = pitchDetectionResult.getProbability();
pitchEvents.add(pitch);
// amplitude
ampliEvents.add(SoundEvent.amplitude((float) timestamp, amplitude));
}
};
return prs;
}
示例3: transform
import be.tarsos.dsp.pitch.PitchDetectionResult; //导入方法依赖的package包/类
@Override
public void transform(Stream[] stream_in, Stream stream_out) throws SSJFatalException
{
float[] data = stream_in[0].ptrF();
float[] out = stream_out.ptrF();
PitchDetectionResult result = _detector.getPitch(data);
float pitch = result.getPitch();
if (pitch > options.maxPitch.get() || pitch < options.minPitch.get())
{
pitch = -1;
}
int dim = 0;
if (options.computePitch.get())
{
out[dim++] = pitch;
}
if (options.computePitchEnvelope.get()) {
if (pitch < 0) {
out[dim++] = _lastPitch;
} else {
out[dim++] = pitch;
_lastPitch = pitch;
}
}
if (options.computeVoicedProb.get())
{
out[dim++] = result.getProbability();
}
if (options.computePitchedState.get())
{
out[dim++] = (result.isPitched() && pitch > 0) ? 1.0f : 0.0f;
}
}