当前位置: 首页>>代码示例>>Java>>正文


Java PitchDetectionResult.getProbability方法代码示例

本文整理汇总了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);

	}
}
 
开发者ID:Scoutdrago3,项目名称:MusicToGraph,代码行数:23,代码来源:MyPitchDetector.java

示例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;
}
 
开发者ID:vocobox,项目名称:vocobox,代码行数:24,代码来源:VoiceFileRead.java

示例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;
    }
}
 
开发者ID:hcmlab,项目名称:ssj,代码行数:41,代码来源:Pitch.java


注:本文中的be.tarsos.dsp.pitch.PitchDetectionResult.getProbability方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。