Hello, I would like to do a real time voice changer with my Arduino Uno, a microphone with both analog and digital outputs and a 8 ohms 1.5 watt speaker. Could anyone help me? I'm new in using Arduino.
Or do I need something else to do something like that?
Also, I tried using this code for my project, but it didn't work either.
int micPin = 2;
int speakerPin = 9;
void setup() {
pinMode(micPin, INPUT);
pinMode(speakerPin, OUTPUT);
}
void loop() {
// read the digital input from the microphone
int micValue = digitalRead(micPin);
// apply distortion effect to the signal
int distortedValue = micValue * 255;
// output the distorted signal to the speaker
analogWrite(speakerPin, distortedValue);
}
Arduino outputs are cannot be directly connected to speakers, and you may have damaged your Arduino if you did. Use an audio amplifier to drive the speaker.
What sort of microphone do you have that can be connected to a digital input? Most people use an analog input for audio signals.
I think you'd have to measure the incoming frequency and output it at a different frequency but for the same amount of time. I'm just speculating. Plus tone is always a 50% duty cycle. Thinking out loud, I'm not sure how well this work.
Do you want a cookie? I've met many people who wrote books and still had no idea what they're talking about. I was trying to stay within the parameters of what the OP asked, could you as well please.