The Freeverb based sketch below works fine with nothing in the loop(), but I get silence if I try to control the room size parameter in this manner.
The line "(float)analogRead(A1)/ 1023.0;" is from the Freeverb example in the IDE. The sketch produces sound without this line.
When there is no sound, nothing prints to the monitor for the variable 'room'. If i comment out the offending line above, I get 0.7 repeatedly, what 'room' was initialized as.
Can someone explain this please?
The line "(float)analogRead(A1)/ 1023.0;" is from the Freeverb example in the IDE. The sketch produces sound without this line.
When there is no sound, nothing prints to the monitor for the variable 'room'. If i comment out the offending line above, I get 0.7 repeatedly, what 'room' was initialized as.
Can someone explain this please?
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputAnalog adc1; //xy=416,313
AudioEffectFreeverb freeverb1; //xy=708,316
AudioOutputAnalog dac1; //xy=976,301
AudioConnection patchCord1(adc1, freeverb1);
AudioConnection patchCord2(freeverb1, dac1);
// GUItool: end automatically generated code
float room = 0.7;
void setup() {
Serial.begin(9600);
while(!Serial); // wait until serial window is open
Serial.print("ready...");
AudioMemory(100);
freeverb1.roomsize(0.7);
freeverb1.damping(0.2);
dac1.analogReference(INTERNAL);
}
void loop() {
room = (float)analogRead(A1)/ 1023.0;
Serial.print(room);
freeverb1.roomsize(room);
delay(25);
}