Created EventInstance's ChannelGroup has 0 channels

I’m trying to make a thing in c# that displays the wave of a sound (like a sine/saw/square wave, idk if there’s a name for that type of thing). I’m working with Celeste’s game engine so I’m restricted to using FMOD version 1.10.00, and also cannot get debug information because Celeste initializes fmod in a place I can’t access easily.

I set up 4 events (for 4 different waves) and am playing them one after the other, with a 3 second delay. This is the code I’m using:

 private IEnumerator testWaves()
        {
            inRoutine = true;
            string[] waves = new string[] { "sine", "square", "tri", "saw" };
            string path = "event:/PianoBoy/Soundwaves/";
            for (int i = 0; i < waves.Length; i++)
            {
                SoundSource.Play(path + waves[i]);
                while (SoundSource.instance is null)
                {
                    yield return null;
                }
                SoundSource.instance.getChannelGroup(out ChannelGroup group);
                while (group is null)
                {
                    SoundSource.instance.getChannelGroup(out group);
                    yield return null;
                }
                group.getNumChannels(out int n);
                if (n == 0)
                {
                    Console.WriteLine("no channels in wave " + waves[i]);
                }
                else
                {
                    Console.WriteLine("-----------Looping through " + n + " channels in wave " + waves[i] + "------------");
                    for (int j = 0; j < n; j++)
                    {
                        group.getChannel(j, out Channel channel);

                        channel.getFrequency(out float f);
                        Console.WriteLine($"Playing {waves[i]} wave with frequency {f}.");
                    }
                }
                yield return 3;
            }
            yield return null;
            inRoutine = false;
        }

Just for context, I’m using this IEnumerator method as a “Coroutine”, which is a Component in Celeste which will wait x amount of time using “yield return x” before continuing through the method. “yield return null” makes it wait a single frame.
Also, “SoundSource” is another Component that handles creating the event instance and other stuff like the position and the status of the instance.
This is what is sent to the Console after the Coroutine runs:

"no channels in wave sine"
"no channels in wave square"
"no channels in wave tri"
"no channels in wave saw"

I’ve looked around for why this is happening but I can’t find any issue related to an instance having no channels in it’s channel group, what’s going on?

Hard to say given that you’re dealing with Celeste, not FMOD directly. Can you hear your sounds play? Does the ChannelGroup contain more sub-ChannelGroups which may contain the Channels you seek? That probably depends on what your Event looks like. Do some more exploring and see what you can find.

I’m able to hear the sounds in the game and in fmod studio fine. I looked into the sub-ChannelGroups you mentioned and after a bit of trial and error, I was able to find a channel that returned a frequency!
This was the output:
image
I’m curious as to why the frequency for each event is the same, do I need to do something more to these values, or is this all i need from these events to create that “wave visualizer” thing I mentioned earlier?

(i think i forgot to hit reply on the previous message, oops)

Ah ok, the frequency you’re getting is probably the frequency at which the channel is playing i.e. the sample rate. It doesn’t contain any information on what actual sample data is being played back at that rate. To dig into the actual sample data is a bit more involved. Fortunately, there’s plenty of other people who have trodden this path before. Try this to get started :

https://www.google.com/search?q=fmod+wave+visualizer