-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spectrum Analyser results look wrong #93
Comments
Try setting the That control is for linear vs logarithmic representation -- logarithmic being to the right and generally how a traditional audio spectrum analyzer would be configured Is this being used in this project? |
http://spotiamp.com/ also seems to have reimplemented this functionality in a way that looks convincing. I wonder if we could get some input from Ludvig Strigeus who was it's original developer. I don't have any contact for him. |
@arirusso We are not currently using any of your code, so we don't have any Thanks for taking a look for us. Our current code is very simple, you can see it here: https://github.com/captbaritone/winamp2-js/blob/master/visualizer.js#L145-L162 |
Looking at your project, I think I was misunderstanding what which axis you were talking about when you said "logarithmic representation". I was assuming it referred to the amplitude, but playing with your curve value, I see you were talking about the frequency, which would help us with the lopsided nature of what we are seeing. |
An oscilloscope measures amplitude vs time whereas a spectrum analyzer (spectrometer) measures amplitude vs frequency My understanding is that a basic spectrometer for electronic signals would most likely use a linear frequency curve. However, due to the exact problem that prompted you to start this thread, audio spectrometers use a logarithmic curve. I'm not sure why I didn't default to logarithmic at the time-- I didn't anticipate a lot of users and probably just thought it looked better for the example music |
My math is not good enough to grasp all of this stuff quickly, so it's taking me some time. I found this fantastic StackOverflow answer which does a great job of clearly explaining what the FFT outputs and how to process it: http://stackoverflow.com/questions/604453/analyze-audio-using-fast-fourier-transform?rq=1 Some of the answers in this StackOverflow answer touch on the log scaling that we are looking to implement: http://stackoverflow.com/questions/1997896/winamp-style-spectrum-analyzer |
Pinging @stevetjoa From his answer in the second link, it looks like he did some digging into how the Winamp visualizer works. Maybe he has some wisdom to share, or has an interest in helping. |
First up your loop is wrong, Im pretty sure its meant to be like this.... for (j=0,end=19;j<end;j+=1){
var pos =Math.ceil((this.bufferLength/(end-1))*j); // the end-1 determines how far to go through the fft, you might want to increase this so as to miss the end one as its hardly ever activated even on a fully amped wave
// console.debug(pos,j)
height = this.dataArray[pos] * (15 / 256);
printBar(j * 8, height);
} I say that because of this article.... |
Problems....more problems..... Also relates to... Oh, and if you want to have a better understanding of what min/maxDecibels does (which really didnt need tweaking it really is mainly the frequency range), this was very helpful... |
They seem to be biased toward the low end, and a bit too homogenous. It also seems like there must be some signal to the left which we are not seeing.
@PAEz pointed us toward https://github.com/arirusso/d3-audio-spectrum
I wonder if @arirusso would be interested in helping us?
The text was updated successfully, but these errors were encountered: