[jsyn] Pitch Detection using JSyn
jsyn at music.columbia.edu
jsyn at music.columbia.edu
Fri Oct 22 08:23:15 EDT 2010
Hello,
That code looks fine. I saw in that old thread that someone suggested
adding highpass and low pass filters in series between the input and the
detector. That reduces energy outside the range of interest. That will
help. Start with 40 Hz cutoff for the high pass and 1500 Hz for the
lowpass. Set Q=1.0.
Also reduce the confidence threshold to 0.1 and print the confidence
along with the frequency. That will give you a better idea of what is
happening.
Confidence is a measure of how accurate the period detector thinks its
answer is. It will always return a value for period but sometimes the
input is just noise or silence so the confidence in that value will be
very low. Or the input may be varying a lot from vibrato or enharmonic
partials. That will also reduce confidence.
Phil
On 10/22/10 5:17 AM, jsyn at music.columbia.edu wrote:
> Hello!
>
>
> I am fairly new to JSyn as well as the audio signal processing field so I hope
> that I will be able to learn eventually in the field. I am currently trying to
> implement a Pitch Detection module for a project using JSyn and so far, I was
> able to stumble upon this
> thread http://old.nabble.com/Pitch-Detection-From-LineIn-td3309520.html. As
> such, I implemented the code in the thread and tried to test it but I am not
> sure if it is working properly.
>
> Here is the code (I omitted the try catch since it takes up space):
> {
> Synth.requestVersion( 140 );
> Synth.startEngine(Synth.FLAG_ENABLE_INPUT);
>
> pitchDetector = new PitchDetector();
> lineIn = new LineIn();
> lineIn.output.connect(0, pitchDetector.input, 0);
> lineIn.start();
> pitchDetector.start();
>
> while (true)
> {
> double confidence = pitchDetector.confidence.get();
> double period = pitchDetector.period.get();
> double frequency = Synth.getFrameRate() / period;
>
> if (confidence> 0.99)
> System.out.println("F:"+frequency);
>
> Thread.sleep(200);
> }
> }
>
> I have a few questions. The setup that I am doing is that I attach a mic to my
> laptop and run the code. I then position the mic in front of my Casio Keyboard
> speakers and play a note. The result is sometimes, I am able to get a reading
> for the frequency and sometimes not.
>
> So I am confused: what does the confidence variable do? Also, is my setup ok?
>
> Hope you can help! Thank you!
>
>
> _______________________________________________
> JSyn mailing list
> JSyn at music.columbia.edu
> To change digest mode or to make other administrative changes visit:
> http://music.columbia.edu/mailman/listinfo/jsyn
>
>
More information about the JSyn
mailing list