I'm a Belgian engineering student currently in the proces of writing an java application that transforms the line input of a soundcard into an osciloscope. For everything input related i'm using Processing and Minim as a component in the application.
I've got the drawing of the signal working, but i'm currently experiencing problems with determining the frequency of the input signal (i'm using an ipod with a 1k Hz MP3 file on it).
I've tried two seperate things:
I've tried to use timers to determine the period of the signal, but this returns rubbish values which start large and slowly converge to zero. I suppose this is due to noise.
public void draw()
{
background(255);
stroke(0);
line(0,300,800,300);
// draws waveform and calculates the period in real time by measuring the time it takes to complete one cycle in milliseconds
I'm currently trying to use FFT to determine the frequency of the signal, but i'm having troubles getting both the drawing and the FFT in the same loop. The way i see it i need to have two For() loops running at the same time iterating over two different things. i'm currently reading up on multithreading in java but i doubt this will solve my problem.