will20fitz
Member
Hi there, can anyone help with the below code?
How can i reduce the draw on RAM?
I get the following error msgs:
Arduino: 1.8.5 (Windows 10), TD: 1.41, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Debug, US English"
c:/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\famil\AppData\Local\Temp\arduino_build_600525/Granular.ino.elf section `.bss' will not fit in region `RAM'
c:/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 49648 bytes
collect2.exe: error: ld returned 1 exit status
Error compiling for board Teensy 3.2 / 3.1.
___________________________________________
Here is the code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <Bounce.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=144,131
AudioEffectDelay delay1; //xy=330,203
AudioEffectGranular granular1; //xy=337,114
AudioEffectReverb reverb1; //xy=490,47
AudioMixer4 mixer1; //xy=685,122
AudioOutputI2S i2s2; //xy=840,126
AudioConnection patchCord1(i2s1, 0, granular1, 0);
AudioConnection patchCord2(i2s1, 1, delay1, 0);
AudioConnection patchCord3(delay1, 0, mixer1, 2);
AudioConnection patchCord4(granular1, reverb1);
AudioConnection patchCord5(reverb1, 0, mixer1, 0);
AudioConnection patchCord6(mixer1, 0, i2s2, 0);
AudioConnection patchCord7(mixer1, 0, i2s2, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=171,34
// GUItool: end automatically generated code
// GUItool: end automatically generated code
Bounce button1 = Bounce(0, 15);
Bounce button2 = Bounce(1, 15);
Bounce button3 = Bounce(2, 15);
#define GRANULAR_MEMORY_SIZE 12800
int16_t granularMemory[GRANULAR_MEMORY_SIZE];
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14
int speed1 = 0;
float speed2 = 0;
float pitchshift = 0;
float freeze = 0;
void setup() {
Serial.begin(9600);
AudioMemory(160);
sgtl5000_1.enable();
sgtl5000_1.volume(0.6);
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
sgtl5000_1.micGain(36);
mixer1.gain(0, 0.2);
mixer1.gain(1, 0.2);
mixer1.gain(2, 0.2);
mixer1.gain(3, 0.2);
delay1.delay(0, 400);
delay1.delay(1, 400);
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
granular1.begin(granularMemory, GRANULAR_MEMORY_SIZE);
delay(1000);
}
void loop() {
Serial.println("Press button 1 to enter normal mode");
Serial.println("Press button 2 to enter random mode");
button1.update();
button2.update();
button3.update();
if (button1.fallingEdge()){
Serial.println("normal mode, values relate directly to Pot values");
Serial.println("Pot1 controls Speed");
Serial.println("Pot2 controls Freeze");
Serial.println("Pot3 controls Pitch Shift");
speed1 = analogRead(A0);
if (speed1 >= 512){
speed2 = speed1*0.015; }
if (speed1 < 512){
speed2 = speed1 * 0.00170;}
freeze = 100.0 + (analogRead(A1) * 190.0);
pitchshift = 25.0 + (analogRead(A2) * 75.0);
Serial.print("speed is ");
Serial.print(speed2);
Serial.print("granular freeze using ");
Serial.print(freeze);
Serial.println(" grains");
Serial.print("granular pitch phift using ");
Serial.print(pitchshift);
Serial.println(" grains");
}
if (button2.fallingEdge()){
Serial.println("random mode");
Serial.println("random mode, Pot values relate to level of randomness");
Serial.println("Pot1 controls Speed");
Serial.println("Pot2 controls Freeze");
Serial.println("Pot3 controls Pitch Shift");
speed1 = analogRead(A0);
if (speed1 >= 512){
speed2 = speed1*0.015; }
if (speed1 < 512){
speed2 = speed1 * 0.00170;}
freeze = random(0, (100.0 + (analogRead(A1) * 190.0)));
pitchshift = random (0, 25.0 + (analogRead(A2) * 75.0));
Serial.print("speed is ");
Serial.print(speed2);
Serial.print("granular freeze using ");
Serial.print(freeze);
Serial.println(" grains");
Serial.print("granular pitch phift using ");
Serial.print(pitchshift);
Serial.println(" grains");
}
}
How can i reduce the draw on RAM?
I get the following error msgs:
Arduino: 1.8.5 (Windows 10), TD: 1.41, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Debug, US English"
c:/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\famil\AppData\Local\Temp\arduino_build_600525/Granular.ino.elf section `.bss' will not fit in region `RAM'
c:/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 49648 bytes
collect2.exe: error: ld returned 1 exit status
Error compiling for board Teensy 3.2 / 3.1.
___________________________________________
Here is the code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <Bounce.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=144,131
AudioEffectDelay delay1; //xy=330,203
AudioEffectGranular granular1; //xy=337,114
AudioEffectReverb reverb1; //xy=490,47
AudioMixer4 mixer1; //xy=685,122
AudioOutputI2S i2s2; //xy=840,126
AudioConnection patchCord1(i2s1, 0, granular1, 0);
AudioConnection patchCord2(i2s1, 1, delay1, 0);
AudioConnection patchCord3(delay1, 0, mixer1, 2);
AudioConnection patchCord4(granular1, reverb1);
AudioConnection patchCord5(reverb1, 0, mixer1, 0);
AudioConnection patchCord6(mixer1, 0, i2s2, 0);
AudioConnection patchCord7(mixer1, 0, i2s2, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=171,34
// GUItool: end automatically generated code
// GUItool: end automatically generated code
Bounce button1 = Bounce(0, 15);
Bounce button2 = Bounce(1, 15);
Bounce button3 = Bounce(2, 15);
#define GRANULAR_MEMORY_SIZE 12800
int16_t granularMemory[GRANULAR_MEMORY_SIZE];
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14
int speed1 = 0;
float speed2 = 0;
float pitchshift = 0;
float freeze = 0;
void setup() {
Serial.begin(9600);
AudioMemory(160);
sgtl5000_1.enable();
sgtl5000_1.volume(0.6);
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
sgtl5000_1.micGain(36);
mixer1.gain(0, 0.2);
mixer1.gain(1, 0.2);
mixer1.gain(2, 0.2);
mixer1.gain(3, 0.2);
delay1.delay(0, 400);
delay1.delay(1, 400);
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
granular1.begin(granularMemory, GRANULAR_MEMORY_SIZE);
delay(1000);
}
void loop() {
Serial.println("Press button 1 to enter normal mode");
Serial.println("Press button 2 to enter random mode");
button1.update();
button2.update();
button3.update();
if (button1.fallingEdge()){
Serial.println("normal mode, values relate directly to Pot values");
Serial.println("Pot1 controls Speed");
Serial.println("Pot2 controls Freeze");
Serial.println("Pot3 controls Pitch Shift");
speed1 = analogRead(A0);
if (speed1 >= 512){
speed2 = speed1*0.015; }
if (speed1 < 512){
speed2 = speed1 * 0.00170;}
freeze = 100.0 + (analogRead(A1) * 190.0);
pitchshift = 25.0 + (analogRead(A2) * 75.0);
Serial.print("speed is ");
Serial.print(speed2);
Serial.print("granular freeze using ");
Serial.print(freeze);
Serial.println(" grains");
Serial.print("granular pitch phift using ");
Serial.print(pitchshift);
Serial.println(" grains");
}
if (button2.fallingEdge()){
Serial.println("random mode");
Serial.println("random mode, Pot values relate to level of randomness");
Serial.println("Pot1 controls Speed");
Serial.println("Pot2 controls Freeze");
Serial.println("Pot3 controls Pitch Shift");
speed1 = analogRead(A0);
if (speed1 >= 512){
speed2 = speed1*0.015; }
if (speed1 < 512){
speed2 = speed1 * 0.00170;}
freeze = random(0, (100.0 + (analogRead(A1) * 190.0)));
pitchshift = random (0, 25.0 + (analogRead(A2) * 75.0));
Serial.print("speed is ");
Serial.print(speed2);
Serial.print("granular freeze using ");
Serial.print(freeze);
Serial.println(" grains");
Serial.print("granular pitch phift using ");
Serial.print(pitchshift);
Serial.println(" grains");
}
}