Go Down

Topic: Voice Recording: Too Much Noise (Read 422 times) previous topic - next topic

Azeez_Jimoh

Oct 15, 2018, 02:31 pm Last Edit: Oct 15, 2018, 10:23 pm by Coding Badly

RE: http://forum.arduino.cc/index.php?topic=573158.0

hello everyone i am having the same problem

here am using
Electret Mic Breakout Board;

Arduino uno


and

SD card adapter

what i noticed is that when i give a 3.3v to the mic i get a reasonable output put the noise is still present but when i give a 5v then i get the same output that was posted by MarkT

I searched online and i found "power supply noise rejection"

Power supply noise rejection - Technical Brief. ... PSNR is a measurement of how well a circuit rejects noise from various frequencies which get coupled into the power supply. In high speed analog and digital circuitry, power supply pins are vulnerable to random noise.

so i tried giving vcc and ground of the mic from a nodemcu(3.3v) i have with me but still getting the same output.


from the zip file
TEST 4 is when i give vcc to 5v
TEST 5 and 6 is with 3.3v

Grumpy_Mike

That noise is way too low to be caused by the power supply. It is not noise anyway, which in electronics is a specific thing which sounds like a hiss.

The clicking sounds like interference from another source, maybe clipping caused by too much input signal or an LED or something flashing.

Azeez_Jimoh

there no other input signal other than the sd card and and the mic and definitely for sure no led flashing

any other suggestions plz

MarkT

TEST4.WAV has this sort of spike on a sporadic basis (not every 512 samples, so not buffering probably):

[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Azeez_Jimoh

#4
Oct 17, 2018, 03:56 pm Last Edit: Oct 17, 2018, 06:04 pm by Azeez_Jimoh
Mark T

what can i do to get better recording am not understanding the graph

MarkT

Its a plot of sample value against sample number taken direct from the wav file - read a byte, plot it, just
a simple bit of python using matplotlib.

You have those noise spikes in your system, you have to troubleshoot this...  The more information you
give us the more likely we can help.  Without an oscilloscope problems like this are trickier to troubleshoot.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

MarkT

Here's the Python code if its useful to anyone...
Needs numpy and matplotlib.

Code: [Select]

import numpy as np
import matplotlib.pyplot as plt

content = None

with open ("TEST4.WAV", "rb") as f:
    content = f.read()

samplen = np.zeros ([len(content)], int)
samplev = np.zeros ([len(content)], int)

for i in range (len(content)):
    samplen[i] = i
    samplev[i] = content[i]

#START = 1000
#LIMIT = 15000

START = 13700
LIMIT = 14200

# plot and show that the difference of output complex amplitudes for high and low has constant amplitude
fig = plt.figure()
ax = fig.add_subplot (1,1,1)
ax.plot (samplen[START:LIMIT], samplev[START:LIMIT], 'r')
plt.show()

[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Grumpy_Mike

there no other input signal other than the sd card and and the mic and definitely for sure no led flashing

any other suggestions plz
Post all your code along with schematics and photographs of the wiring.

Azeez_Jimoh

#8
Oct 19, 2018, 09:23 am Last Edit: Oct 19, 2018, 09:24 am by Azeez_Jimoh
connections

Arduino  and  SD Card

https://hallroad.org/wp-content/uploads/2018/03/Micro-SD-Card-Reader-Module-In-Pakistan-3.jpg

arduino with mic

A0 to audio

3.3v to vcc

gnd to gnd


Code

Code: [Select]
#include <SD.h>
#include <SPI.h>
#include <TMRpcm.h>


#define SD_ChipSelectPin 4  //using digital pin 4 on arduino nano 328, can use other pins

TMRpcm audio;   // create an object for use in this sketch

void setup() {
 
  Serial.begin(115200);
 
  if (!SD.begin(SD_ChipSelectPin)) { 
    return;
  }else{
    Serial.println("SD OK");
  }
  // The audio library needs to know which CS pin to use for recording
  audio.CSPin = SD_ChipSelectPin;
}


void loop() {
 
    if(Serial.available()){                          //Send commands over serial to play
      switch(Serial.read()){
        case 'r': audio.startRecording("test.wav",16000,A0); break;    //Record at 16khz sample rate on pin A0
        case 'R': audio.startRecording("test.wav",16000,A0,1); break;  //Record, but with passthrough to speaker.
        case 't': audio.startRecording("test.wav",16000,A0,2); break;  //Do not record. Output direct to speaker
               //Note: If samples are dropped before writing, it
               //      will not be heard in passthrough mode
        case 's': audio.stopRecording("test.wav"); break;              //Stop recording
        case 'p': audio.play("test.wav"); break;                       //Play the recording
        case '=': audio.volume(1); break;                              //Increase volume by 1. Does not affect recording
        case '-': audio.volume(0); break;                              //Decrease volume by 1. Does not affect recording
        case 'S': audio.stopPlayback(); break;                         //Stop all playback
       
      }
    }
}

Grumpy_Mike

That link does not work, I get a page not found.

That description is not a schematic, at best it is incomplete.

Azeez_Jimoh

Sorry for that for the sd card

Arduino  to SD card

VCC to 5V in the Arduino.

GND of SD card to the ground of Arduino.

CS to pin 4

SCK to pin 13

MOSI to pin 11

MISO to pin 12

i gave different ground from the for both SD card and the mic from the UNO


Grumpy_Mike

Quote
i gave different ground from the for both SD card and the mic from the UNO
They should have the same ground.

Link still does not work, that is not a schematic, are you serious about getting help?

Azeez_Jimoh

A png of both connections

Grumpy_Mike

Blood -> stone  :(

The things I want to check is do you have level logic shifters on the SD card. A stupid Fritzing diagram is not going to tell me that, a schematic will because you will / should have labeled the SD card with the actual type it is.

Have you tried recording at a lower sample rate?
It is likely the dropouts you are seeing is a result of sporadic writing to the SD card.

Go Up