Using Bungee with FMOD (Unity3D) #13
Replies: 11 comments 2 replies
-
Here's a video that shows what it sounds like at the moment. Screen.Recording.2024-11-29.133659.mp4 |
Beta Was this translation helpful? Give feedback.
-
I've never used C# but will try to help. How are you using this function? Are you calling this function only once per audio clip that you need processing? Or are you calling it repeatedly as you progress through an audio source? Either way, the most obvious issue is that |
Beta Was this translation helpful? Give feedback.
-
Thanks, I'll try using the input chunk after the weekend and see if it works. The function is called repeatedly by FMOD with 1024 samples from the audio buffer. It works as a live DSP effect. |
Beta Was this translation helpful? Give feedback.
-
In my case the if (inputChunk.begin < 0)
{
inputChunk.begin -= inputChunk.begin;
inputChunk.end -= inputChunk.begin;
}
I should probably also clarify that I'm only trying to change the pitch, and not the speed. |
Beta Was this translation helpful? Give feedback.
-
Yes you could offset in the same way as But it may make sense to use the Let me know how you get on! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
In your example, do you call |
Beta Was this translation helpful? Give feedback.
-
Yes, each time I get a 1024 segment from fmod, I call process with it and use the result for output. I was creating a new request with position 0 each time. I have now changed it to reuse the same request, and have also reworked the loops. static List<float> Process(ref Queue<float> inputSamples, int pushFrameCount, ref Push_InputBuffer inputBuffer, ref Bungee_Request request)
{
var concatenatedOutput = new List<float>();
// First get pushFrameCount frames of audio from the input
for (int i = 0; i < pushFrameCount; i++)
{
if (inputSamples.Count > 0)
inputBuffer.InputData()[i] = inputSamples.Dequeue();
else break;
}
// The following function and loop delivers pushFrameCount to Bungee
// Zero or more output audio chunks will be emitted and we concatenate these.
inputBuffer.Deliver(pushFrameCount);
while (concatenatedOutput.Count < 1024)
{
bungeeWrapper.AnalyseGrain(inputBuffer.OutputData(), new IntPtr());
var outputChunk = new Bungee_OutputChunk();
bungeeWrapper.SynthesiseGrain(ref outputChunk);
bungeeWrapper.Next(ref request);
var outputData = new float[outputChunk.frameCount];
Marshal.Copy(outputChunk.data, outputData, 0, outputChunk.frameCount);
var inputChunk = bungeeWrapper.SpecifyGrain(ref request);
inputBuffer.Grain(inputChunk);
concatenatedOutput.AddRange(outputData);
}
return concatenatedOutput;
} It seems that the segments I get now are shifted by 256. So the output starts with samples 256-512 (but fading in), followed by the second half of the segment (normal) and then 256 samples of silence to fill the rest. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Since the last post, I managed to get it to work and was satisfied with how it sounded given that it was Bungee Basic. But now I suspect there's another issue with my implementation, since it sounds very robotic compared to the demo page: Screen.Recording.2025-01-13.162012.mp4The first speech has a rate of 0.75 and the second has 0.6 Any ideas of what could cause this? |
Beta Was this translation helpful? Give feedback.
-
Here are some logs from the new bungee version. Playing the same audio, first at 1.0 and then 0.5 speed |
Beta Was this translation helpful? Give feedback.
-
I'm trying to integrate Bungee with FMOD inside a Unity project. I've managed to make a C# wrapper class and I am able to modify FMOD's audio buffer with it, but I must be doing something wrong, because the result sounds kind of like a robot filter, even with pitch and speed set to 1.
This is the code that modifies the buffer:
AnalyseGrain takes a channelStride parameter, but I'm working with a mono channel group, so I assume the value doesn't matter here.
I don't know what the log2SynthesisHopOverride value does, but I've kept it at 6 when instantiating the wrapper. Changing it seems to make it worse.
Beta Was this translation helpful? Give feedback.
All reactions