ï~~ ILMLI2 012NON-COCHLEAR SOUND ____LJUBLJANA _9.-14. SEPTEMBER sumLo = 0.0; } Each AudiomicroS class instance returns the generated audio data to the variable sumLo. When there are overlapping micro events inside a meso event, they will be summed together as indicated within the expression; sumLo = sumLo + AudiomicroS [ii]......; When the inner loop closes, each micro space audio data will be passed inside the update method of the AudiomesoS class instance. The meso events generate panning on their audio lines; hence the output of each AudiomesoS class instance becomes a double sized array called MesoSum[]. When there are overlapping meso events, they will be summed to the array sum[] as indicated within these lines; sum[O] = sum[O] + MesoSum[O]; sum[1] = sum[1] + MesoSum[1]; Then the sumLo variable will be initialized with value 0 before the outer for loop closes. Now the generated audio can be assigned to the *output variable, which carries the data to the system audio driver. Cosmosf fills 2 audio buffers, bufData and bufDataB with this output and they can be used in order to be reassigned as the input for the micro events. (Figure 5) 3.5. Generating audio events Now we will have an inside look to the AudiomicroS and the AudiomesoS Class. These objects not just generate the audio but also the modulation sources for the sonic attributes in audio rate inside this audio routine. double CosmosCellM::update(double *Audio, double* poi, float* CellFparam,int* Celllparam, float* Grnparam, float* Filtparam, double* LFOvalues, double* bufData, double* bufDataB) - *Audio is a pointer to the audio assigned for the current micro event input instance coming from the direct feedback connection of the Cosmosf output. - Pointer to the phasor value giving the current absolute time inside the Cosmosf cycle. - Pointers to the parameter arrays imported from the user interface via the main program. - DSP section parameters. - Pointer to the LFO values calculated in the main program. - Pointers to the recursive buffer content. The next significant code in the CosmosCellM.update method is the if-then conditional loop, which compares the current phasor value with the onset time of the micro event inside the cycle. When they match, then the micro event DSP routine starts and generates the event audio until the end of the relevant micro event. if (ulong(point) >= posS && ulong(point) < posL+posS+1) { DSP code } The posS variable here is the event start time and the posL is the event duration with the variable type ulong. There are various DSP routines and waveform generating functions inside the DSP code. For example to playback a loaded sample from the buffer with certain speed and start offset, we use the ofxMaxiSample object from the ofxMaxim addon with quadratic interpolation. The code expression below is for the calculation of the Sample Start point considering the values from modulation sources like LineGen and LFO. Likewise if Cosmosf is not in recursive buffer playing mode; the beatx.play method, being a member of the ofxMaxiSample class, plays the sample with the Speedindex value from the sample buffer dataBufB. smpstX = smpst*LineGenval[3]+LFOvalues[2]; d = beatx.playB4(Speedindex*sampleRate/sizeBN/(1 - smpstX),sizeBN*smpstX,sizeBN,dataBufB;} The expression Speedindex*sampleRate/sizeBN/(1 -smpstX) calculates the revised playback rate value according to the demanded start offset point considering the sampleRate and the size of the sample as given with the sizeBN variable. Hence according the code, the playback rate decreases when the performed chunk size of the sample data decreases too. 4. CONCLUSION Despite the difficulty of expressing/explaining such complex code structures, which is generally the case with C++, we had a simple overlook to the significant design features implemented in Cosmosf as a case study of audio application development in Openframeworks. More references of such these will encourage the composers to develop their own tools in such platforms. 5. REFERENCES [1] Bokesoy, S. "Feedback Implementation within a Complex Event Generation System for Synthesizing Sonic Structures", Proc. of Digital Audio Effects (DAFX'06), Montreal, Canada,pp. 199-203., 2006. [2] Grierson M. "Maximillian: A Cross Platform C++ Audio Synthesis Library for Artists Learning to Program", Proc. of International Computer Music Conference (ICMC'1O), New York, USA, 2010. [3] Lieberman Z., Watson T., Castro A. Online Openframeworks Documentation Source. http://www.openframeworks.cc/documentation, 2012. 143
Top of page Top of page