Tuesday, July 17, 2012

Real-time signal drawing

I want to introduce simple Java program that performs real-time signal drawing. It based on Model-View-Controller (MVC) framework. I wrote a post about  MVC usage by very simple example.
 
At first, we create a Buffer class, where incoming samples (came from some abstract source) are stored. The idea of how Buffer handles data is shown on Fig.1. The iWrite (iW) index points to cell were new sample is stored. Denote this sample s[0]. The sample that has came before s[0] becomes s[-1], sample before it becomes s[-2] and so on. After new sample saved, the iRead (iR) index increments subsequently to read all samples from newest to oldest to redraw signal on screen. We increment iR to read from s[0] to s[-6]. Repeat that procedure we draw the signal that slide along the screen from right to left.

Thursday, July 12, 2012

FIR filter programming and testing

About FIR (finite impulse response) filter programming in C I have written in my old post. Now I want to show the object-oriented programming approach to solve this task using Java. 

Also there is some improvements: the cyclic buffer is used to convolve filter kernel with  input data samples. It reduces the number of calculations, because there is no need to shift all input data through array where data stored. You just have to put input sample in write place and shift array index (or "pointer" to element).