I generate this code from YouTube on Arduino++SC; I know that the ~ val controls Synthdef, but I want to know how I can create code in SC that with this particular Arduino code “Water and Soil sensor”, I can control a Pattern?
ARDUINO:
int value;
void setup() {
Serial.begin(115200);
}
void loop() {
value = analogRead(0);
Serial.print(value);
Serial.print("a");
delay(1);
}
I think that before considering using patterns you should think about the logical section of your code’s design.
You are using analogRead() which means that you serial port would be continuously sending values to the sclang. The most “commom” usage would be to map this continuous input directly to a synth parameter (pitch, cutoff frequency, pan, etc).
Therefore using a pattern for, let’s say, controlling the pitch values of a synth would be a little strange since most of the patterns are based on events, which are long term occurrences in discrete time.
So, a more “tipical” scenario would be processing the analogRead to generate triggers (e.g > threshold a finite duration pattern is played) or extract features like Onsets and use them as triggers.
I saw the YouTube material and in the Book of Eli Fieldsteel to construct this code, I see now it is more complex to trigger patterns, and I will review the Olofsson materials, to answer to you in the future, now I dont have the knowledge to understand you answer propperly.
Thanks.
I have an intermediate level in SC and the same in Arduino, thats why.