On 26/11/2015 at 04:30, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 17
Platform: Windows ;
Language(s) : C++ ;
---------
Hello;
I can't find any good example on BaseSound, or how to employ that class, or how MoGraph Sound and Loudspeaker are using it, or how to play a sound.
1. The help insists that only WAV files can be loaded. However, I have already loaded an MP3 successfully into a MoGraph Sound object, and it plays fine. (The help also insist that the Frequency Graph doesn't update dynamically but it does.)
2. BaseSound is directly derived from C4DAtom so it's not a base class for the OM objects. I assume it's stored in a Container? How do I extract the BaseSound? Is that even the correct class to pull from a Sound?
3. GetSampleEx() promises to get me a sample. A parameter for that is "i" - not a BaseTime, but an i. I suppose the samples are stored in a huge one-dimensional array, and this is the index to that, and if I want to have a sample at a certain time, I need to recalculate a Frame (or a BaseTime) into a sequence of i's that were sampled at the timespan of that frame... how?
4. The Init() function provides me with two questions even. There's a parameter sample_cnt which decides the number of samples... per what? Second, frame, overall runtime of the sound? So if the sound is three seconds long and I have 25 fps, if I want ten samples per frame that's 3*25*10 = 750 samples?
And then there is the frequency. So a BaseSound represents only one single frequency out of the whole frequency spectrum? At what sample density? If I want a sample for 10-12kHz, what do I use for this parameter? How do I sample different widths of the spectrum, like one sample with 10-12 and another with 8-15kHz?
And how does the MoGraph Sound handle that? Sound has a frequency graph and influences the clones in its cloner by frequency. So it has, like, one BaseSound for each frequency? Or maybe it's not working with BaseSound at all...
Sound is a three-dimensional thing with discretization along every axis. Time is one axis (samples per second being its discretization), frequency the second, and the third (result) axis is the intensity of that frequency at that time. BaseSound doesn't seem to represent that at all.
I'm afraid I don't get the sound functionality. Does anybody have actual code for me?