i’m trying to write a live-beatdetection-app that sends values over OSC to any other application…
but… right now im stuck, i get a nullpointer.
i think that the problem lies with the in-class-instance of minim… am i right?
i once used processing in eclipse and learned by passing "this" through the constructor that this should be possible.
or i’m just missing something?
small overview:
i wanted to create a class that combines the complete audioanalysispart –
AudioAnalyzer the values of the bins are updated in every draw –
AudioAnalyzer.update(), instanced as
aa.update() the values of the bins are stored in a float-array inside the class –
AudioAnalyzer.m_frequencyBins[]
// should draw the freq-144 bands for (int index = 0; index < aa.m_frequencyBins.length; index++) { rect(index*binwidth, 0, index*binwidth+binwidth, aa.m_frequencyBins[index]*3); } }
// instance all the audio-libs m_minim = new Minim(p_parent); m_audio = m_minim.getLineIn(Minim.STEREO, 2048); m_fft = new FFT(m_audio.bufferSize(), m_audio.sampleRate());
// set the logarithmic fft up m_fft.logAverages(50, 16);
// empty array for the bins float[] m_frequencyBins = new float[m_fft.avgSize()];
for (int i = 0; i < m_frequencyBins.length; i++ ) { m_frequencyBins[i] = 0.0; println(m_fft.getAvg(i)); }
// write the freq-bins into an array for (int i = 0; i < m_frequencyBins.length; i++ ) { println(i); m_frequencyBins[i] = m_fft.getAvg(i); // <<<<<<<< NULLPOINTER :( } } }