[Stk] Simple WaveMixer and Osciloscope

Stephen Sinclair sinclair at music.mcgill.ca
Tue Oct 20 07:14:10 PDT 2009


On Tue, Oct 20, 2009 at 9:25 AM, Ronzani Bruno <bruno.ronzani at utbm.fr> wrote:
> Hello everyone,
>
> I'm a newbie using STK so I apologize if the answer to my question is
> obvious. By the way I read all the documentation and I didn't find
> what I want.
>
> I've installed STK recently and everything - i mean the demo examples
> - works fine.
>
> I've started to make a program using the library and I realize that I
> have some difficulties though.
>
> Thus two main questions for that first post :)
>
>
> 1) The main idea of my program is to make a "mixer". It is very simple :
>
> I have made a class "Track" which reads a .wav file ( FileLoop ), and
> can tick it out.
>
> Then I have the Mixer class, which is mainly a vector of tracks.
>
> For the moment, i have a tick() method which just sum the ticks from
> all the tracks... Is that the way I should do this ?It works
> actually...
>
> Maybe I should use a StkFrame with the same number of channels than tracks ?
> But I've never managed to make that work...  is that possible ?

I would use your first method, summing the tick() calls from each
track.  You could then use the StkFrame representation to handle
multi-channel audio files for example.


> 2) My second question is more general... I used to think that a sound
> is no more than a 2 dimensions array... easy to draw for example, if
> you want to see the oscilations...
>
> actually I would like to draw them in my program. In order to "see"
> the sound in real time.

Since FileLoop doesn't provide you access to the raw sound data, I
would suggest either accessing the sound data independently from the
FileLoop (using FileRead for example), or collecting it from tick() in
real-time.

How to draw on the screen is off-topic here, though, since there are
many ways to accomplish that.


Steve



More information about the Stk mailing list