First time here? Check out the FAQ!
x

How to show all Smalltalk output in text file when compiling?

0 votes
998 views
My smalltalk program generates a large 3D array of data, in the text file it truncates the output with the message "...(more)...".

Ideally I would like to run the program in a parameter field in capytalk, but it gives the error message "out of real-time." It is only necessary to run the code once every 10-20 seconds to generate new data, but I can't figure out how to incorporate that into a Sound. Because of this issue, my back-up plan is to to access the output of the code and copy/paste the output into a parameter.  

Is there an object like constant that can take an array? My program requires that 8 voices receive the same randomly seeded 2D array. After the program runs, each of the 8 voices reads a different section of the larger array. I would like to store these arrays in global variables that any sound parameter can access, is this possible?
asked Jul 19, 2015 in Capytalk & Smalltalk by ucsc-electronic-music (130 points)
You say the new method uses a randomly seeded 2d array; are you using it as a source of random parameter values in the 8 voices?  There may be a way to generate the values you need within each parameter field where the value is used, rather than globally in a 3d array.  Which parameter fields are reading the data?  What is the algorithm you use for generating the 3d array (or the 2d array)?  Thanks!
This is for a "game of life" inspired CA sequencer. We start by seeding a 2D array, randomly with 1s and 0s. Then, as we iterate through the program, we put the 2D result of each iteration as a layer in a 3D Array. All of the voices need to see the same data, since they each simultaneously read through different portions of the 3D Array at the same time. We are currently using the 0s and 1s in a velocity parameter of a step sequencer.

We have tried hard-coding the random seed into the program in the parameter field, but it runs out of realtime, I'm guessing since it's running a lot of nested loops in multiple voices at 1000HZ... when really, we just need to run it once to get all of the data for all of the voices.

We have also tried generating all of the data in the smalltalk text file, but that's the output that gets truncated.

Ideally, we want to re-seed the algorithm while playing the sound, start the program over again with new randomly generated data, and not copy/paste into 8 different parameter fields while playing. Does this help? thanks in advance.
Which combination rule for the CA?  How should each voice index into the 3d Array (does each voice get a single 2d Array)?  Which dimension of the 2d Array should be used as the 1d Array of On/Off switches for the sequencer?
if cell == 1, and has < 2 neighbors == 1, cell = 0
if cell == 1, and has > 3 neighbors ==1, cell = 0
if cell == 1, and has 2 || 3 neighbors == 1, cell = 1
if cell == 0, and has 3 neighbors == 1, cell = 1
but we would like to be able to experiment with a variety of rules
Each voice would use 1D of each 2D array in sequence through the collected iterations layered in the 3D array. Choosing which path to read could happen at the voice level, or if there were a way to send the correct 1D Array to each voice from a "global" 3D Array? I would like to keep the parameter assignments as flexible as possible in order to experiment with the mapping... I would also like to use the cell's "number of neighbors" as a sound parameter. Thanks!

1 Answer

+1 vote

One approach would be to use a MIDIVoice script.  However, since you want to be able to interactively reinitialize the 3d array with random numbers, the best solution would be to do it in a Tool.

Here's an example of a Tool that does a 5X5X5 game of life cube.  One dimension becomes the on/off pattern for a sequencer, a Replicator creates clusters of 5 sequencers, and each cluster goes to one of 5 channels created by a second Replicator.

First play the Sound, then click Run on the Tool. (You may have to move the VCS out of the way to see the Tool controls).  The Tool has a button for Randomizing the whole cube and another one for computing the next generation of the game (we could modify it so the generations run sequentially without that button).  But it might be interesting to be able to stay on a generation for a while to listen to it and change Sound parameters.

Give it a try and let us know if you have questions about how it works or how to modify it.

Have fun!

answered Jul 21, 2015 by ssc (Savant) (128,080 points)
Thank you!!! This is everything we were looking for! Looking forward to Bozeman!
One more question:

We were able to edit the tool in order to suit our needs, and we were able to edit the Sound to a certain extent. However, it is still somewhat unclear how the Sound and the tool interact. How is data passed from the tool to the Sound?  How do they communicate? How can we get this tool to communicate to other Sounds?
In the InitialState onEntry response you'll see a code block definition:

--
UpdateSequencers := [
    0 to: 4 do: [:i |
        0 to: 4 do: [:j |
            0 to: 4 do: [:k |
                | eventValueName |
                eventValueName := ('Gate' & i, '_'& j, '_' & k) asSymbol.
     SignalProcessor postEventValueNamed: eventValueName dspValue: (Space at: i at: j at: k)]]]].

--

Each loop in the block creates the eventValueName algorithmically with string concatenation, changes it to a Symbol, and then asks the SignalProcessor to post a value from the array to that EventValue.
This assumes that a Sound containing that EventValue is currently playing.  So it is communicating with EventValues in the currently playing Sound (rather than communicating with individual Sounds).
...