Real Time Voice Changer

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 do not think you actually looked at the documentation for analogWrite, did you. The MAXIMUM value of the parameter is 255. NOT 255 time some value.

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.

But totally wrong speculation.

I did publish an Arduino Voice changer in my book:-
Arduino Audio

But you need external hardware for both input and output to make it work.

2 Likes

Have you tried it?

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.

Thank you, I'll read you book and look for the appropiate hardware

He literally wrote the book. It's safe to assume the answer is "yes".

You literally wrote a single guess. It's safe to assume the answer for you is "no".

That would be a childish thinly veiled insult. Most certainly off topic.

I hope you spend your time away from the forum contemplating this final thought with the obvious inversion...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.