Hey there, fairly new to arduinos in general.
I'm trying to build a Mic/speaker setup that modulates my voice (maybe even adds a few sound blibs on top of it).
Right now I've got a small breakout-board mic connected to 5V, ground and an analog pin.
On the otherside I have a small LM386 board + a small speaker, the LM386 board is connected to 5V, a digital Pin and ground.
But for whatever reason I can't seem to figure out, what I'm actually doing wrong.
Here's snippet from my code:
//Microphone
const int micPinA = A7;
int micA;
int amplitudeA;
const int baseline = 337;
const int maxAmplitude = 150;
//Speaker
const int speakerPin = 8;
void setup()
{
Serial.begin(9600);
pinMode(micPinA, INPUT);
pinMode(speakerPin, OUTPUT);
//Test Noise
tone(speakerPin, 200, 2000);
//SD Card stuff
}
void loop()
{
micA = analogRead(micPinA);
amplitudeA = abs(micA - baseline);
//Cut down the 10Bit input to 8bit (I saw this online somewhere, but even without it, it wont work)
//Also even if I use either micA or amplitudeA I wont receive any noise from the speaker.
//The test tone from the Setup() Function works tho.
//If I use tone and then AmplitudeA as the frequency I can here a difference while
//speaking/making any type of noise
analogWrite(speakerPin, analogRead(micPinA)>>2);
}
Thanks in advance!
BTW I wanna use a microcontroller, because I want to do lots more with it, than just this, control LEDs (depending on the Voice Input) and a few other things. I also want to contain all of it in one system (so microcontroller + parts) and not multiple smaller sets of systems.
Any help is greatly appreciated!
Edit:
I'm basically trying to sample my Voice through a Microphone right now and than outputting that through a speaker.
After that I want to work on modulation of the voice + voice effects.
I'm fairly new to arduinos.
I've used Raspberry PIs for all sorts of stuff, one such use case was this exact project.
I want to move away from Raspberry PIs for this sorta' stuff.
Edit 2:
I'm using a Nano, but I'm not fixed to using a Nano.
I'm not super sure how large the others are, but that shouldn't be an issue inside my helmets. (Hopefully)