Hiya, I registered for this question. So here we go with another oscilloscope question. I use FreeBASIC which many of you might not be familiar with, its syntax is pretty much that of Qbasic except extended for modern constructs. Anyway it should be pretty easy to follow.

So I have a media player I’m working on, and the oscilloscope eluded me for a long time. So here is the thing, I have the code to plot and convert the values, it is just GETTING the values. By accident I discovered the reading past the end of a certain variable revealed the values, except it is not consistent across different machines, sometimes it is just garbage data. Well, obviously reading past the end of arrays and things is not the best idea in the world. Anyway so here is a drastically shortened and squashed version of what I am up to, forgive me if I leave out some declarations that are shared or something.

‘up top
FSOUND_Init(44100, 8, 0)
‘in subroutine Visualize()
Dim As Single Ptr specbuf = FSOUND_DSP_GetSpectrum()
For i As Integer = 522 To 512+screenx
Line -((i-522),screeny/2-((specbuf[i])/192)), somecolor
‘Note two things here, #1 if you are not familiar in the line call here with
‘no origination point assumes the last line’s end as the start.
‘#2 somecolor is just a made up variable that I used to be able to
‘remove the code to compute the rainbow it makes.

Okay so from the doc I know that FSOUND_DSP_GetSpectrum returns 512 floating point numbers, and you will notice I start reading at 522, all the way to some amount + screenx(window x size variable). Yeah way outside the bounds. On this machine it does this(well, not all the blue stuff, that is a bit I removed):


But of course that as I have seen is not reliable and sometimes reads values that are obviously something else on other PC besides this one.

So basically my only question is how to get the values to plug in. I asked this on the FreeBasic forum itself too.

And the guy explained something and his example code renders a wave form for sure, but I am not sure if it is relevant or I am just not getting it or what.

The only answer I need is where to read these values from, the ones I am accidentally bumping into reading outside of where I should be. I have been trying to figure this out for a while, you’ll notice my post on that other forum is dated Nov 11. I have searched everywhere, including these forums. Is there some way to get these values and I am just not getting it in my head?


  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.