First time here? Check out the FAQ!
x

How do I read through an array of VCS controls at 4000hz?

0 votes
396 views

I want to use a set of toggle buttons to turn on pulses and I want to read through this set at about 4000hz.

I tried using a SoundToGlobalController but the trigger in the value field is going to fast, I think.

Here's a picture of the STGC and the grid of toggle buttons.

 

 

 

Update:

I tried another experiment using an oscillator. I put the following expression in the frequency parameter:

and this doesn't work - meaning it doesn't vary the frequency of the oscillator. If I slow the tick down to 1/50 s then this works. The frequency parameter can take an audio rate input, so I'm presuming there's something about this expression that can't run at audio rates. Is it "tick" or "nextIndexMod:" or the look up into the array of VCS controls?

 

asked Oct 5, 2016 in General by alan-jackson (Virtuoso) (15,840 points)
edited Oct 5, 2016 by alan-jackson

1 Answer

+2 votes
 
Best answer

To scan at 4000 Hz, you could use an InputOutputCharacteristic.  The InputOutputCharacteristic maps an array of input values to an array of output values (inputs and outputs can be EventValues as well as constants).  Then you could use a TimeIndex or an Oscillator as the Input to scan through the values.

What is the end result you are going for?  What kind of Sound is the Frequency field from?

answered Oct 5, 2016 by ssc (Savant) (128,120 points)
selected Oct 5, 2016 by alan-jackson
The Frequency parameter is a red herring. I was just using that to test whether it was the parameter field itself that was forcing the control sample rate or something in the capytalk expression.

What I'm trying to do is create a pattern of "clicks" - short square wave pulses - using the pattern of buttons.

If every toggle button was "on" then there would be a train of pulses at 4000hz. If every other button was on then the pulses would effectively be at 2000hz.

Why? I was inspired reading the recent BBC article about the music made by the Ferranti Mark 1 and wanted to emulate making sounds in a similar way and trying different pulse patterns. 4000hz is the approximate clock frequency of the Mark 1.
Fun idea.  One possibility might be to start with the prototype called 'InputOutputCharacteristic to quantize an input to steps'.  You could change the Oscillator waveform to a fullRamp and change its frequency to 4000 hz.  Then change the Smalltalk in the OutValues field of the InputOutputCharacteristic to give you your Array of on/off buttons.
Brilliant, thanks! I'll give that a go tonight and post it up in the library if I get it to work.
...