Creating an Oscilloscope in C#

I’ve been wanting to create an oscilloscope by getting spectrum data from the FFT dsp, although I’m not sure if that’s possible or not. I can’t use Unity for this and I can’t use any external software or equipment, just Visual Studio, FMOD, and whatever libraries are available to use.
Any suggestions?

I can’t help on you the rendering part of an Oscilloscope, but FMOD should be able to give you access to info that you need regarding an audio signal.

If it’s purely the waveform display that you want for an oscilloscope, then all you’ll need to do is grab the sample data from the FMOD System as it plays. While it is a Unity example, I would recommend taking a look at our DSP Capture scripting example, which shows how to retrieve sample data from a DSP using DSP_READ_CALLBACK.

As for spectral data from the FFT DSP, our Unity Spectrum Analysis scripting example shows how to create an FFT DSP, place it on a ChannelGroup belonging to a bus, and then retrieve the FFT data from the DSP.

If you’re not using the Studio API, just the Core API, the process for the above is largely the same - you simply don’t need to navigate to the Core API objects via the Studio API.

Apart from this, you’re unsure on the process of creating and initializing an FMOD System in general, I would recommend taking a look at the Studio/Core API (depending on which you’re using) examples included with the FMOD Engine installer at ./api/core/examples and ./api/studio/examples. If you’re unfamiliar with C++, you can approximately read it using the following guidelines:

  • Ignore any *
  • Replace & with out
  • Replace :: or -> with a . operator
  • Replace nullptr with IntPtr.Zero

The Studio API Guide is also a helpful resource for any general interaction with the FMOD System.

Thank you so much! I think the read callback thing is what I’m looking for. I’m having trouble figuring out understanding the scripting example. This is what I have right now:


I wasn’t able to use all of the first method from the scripting example because I couldn’t find a reference to ScriptUsageDspCapture.

Nevermind, I feel quite embarrassed now :sweat_smile:

No problem, happy to hear that you figured it out.