Forum Replies Created
-
AuthorPosts
-
danespchaMember
Solved. Thank you so much, it was the 16 bit encode I didn’t think on decoding it, used the 8 bit record and it works.
I will not disturbe you anymore, thank you again!danespchaMemberYes, I’m sure, it’s only a kind of debug, I only want to see if the values are all different between themselves, because now, I only get one or two values, like 5 and 230 that are switching always like 0, 230, 0 230…
When I get all values different I’m going to send them with xbee to the PC and use them in a neural network.danespchaMemberOk, thank you… Is my code correct? I want to record until memory is full and then show the values in serial, is that correct?
danespchaMemberThank you michael, I have it working now.
One last question, I have a code in C that transforms a wav file in an array with 18000 elements, because of sample rate, there is any way to get that 18000 elements with the audio hack shield?
danespchaMemberI have another question, It seems like the ISR is not executed, because the monitor doesn’t show the address, how is the ISR executed?
#include
unsigned int sampleRate;
unsigned int timer1Start;
unsigned int address=0;
unsigned int chipAddress=0;
volatile int aux = 0;
void setup(){
Serial.begin(9600);
sampleRate=18000;
timer1Start = UINT16_MAX-(F_CPU/sampleRate);
AudioHacker.begin();
}
void loop(){
if(aux==1){
Serial.println("HOLA");
delay(3000);
}
}
ISR(TIMER1_OVF_vect){
TCNT1=timer1Start;
unsigned int signal;
signal=AudioHacker.readADC_8bit();
AudioHacker.writeSRAM(chipAddress,address,signal);
address++;
Serial.println(address);
if (address > 131071) {
if (chipAddress == 0) {
// proceed to the second SRAM chip
address = 0;
chipAddress = 1;
}
else {
aux=1;
}
}
}
pd: sorry for clumsiness, but I’m new to arduino and need to do this as fast as I can.
danespchaMemberOk, I’m trying to do this with the ISR.
I want to record 10s of audio aprox. (so I chose 18000hz sampleRate), and then use that audio in an artificial neural network.
#include
unsigned int sampleRate;
unsigned int timer1Start;
unsigned int address=0;
unsigned int chipAddress=0;
int aux=0;
void setup(){
Serial.begin(9600);
sampleRate=18000;
timer1Start = UINT16_MAX-(F_CPU/sampleRate);
AudioHacker.begin();
}
void loop(){
if(aux==1){
Serial.println("HOLA");
delay(3000);
}
}
ISR(TIMER1_OVF_vect){
TCNT1=timer1Start;
unsigned int signal;
signal=AudioHacker.readADC();
AudioHacker.writeSRAM(chipAddress,address,signal);
address++;
if (address > 131071) {
if (chipAddress == 0) {
// proceed to the second SRAM chip
address = 0;
chipAddress = 1;
}
else {
aux=1;
}
}
}
this is the code I have now, but it doesn’t work, it never shows ‘HOLA’ in the serial monitor.
Can you help me?
-
AuthorPosts