Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Good quality sound using Microcontroller

Status
Not open for further replies.

shubham kumar

Member level 3
Member level 3
Joined
Sep 11, 2014
Messages
59
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Location
bangalore
Activity points
511
I am a hobbyist. Doing some experiments with sound quality. I'll pin point my problem and requirements.

1) Problem statement : I want to play audio files ( recorded in human voice, not music files, just some plain human speech files)

2) I have tried : a project with arduino microcontroller and MicroSD card but quality was not at all good from the link below
https://www.instructables.com/id/Audio-Player-Using-Arduino-With-Micro-SD-Card/
https://circuitdigest.com/microcontroller-projects/arduino-audio-music-player
It just used an arduino UNO board, microSD using SPI, a speaker and an LM386 Audio Amplifier.

I read about the details and got to know that I need a DAC for better quality (as PWM cannot serve the purpose), and a speaker also. But there are a number of things available and I dont understand which one to buy and start a project.

Can you share the details of some micro-controller board with a DAC or codec or something which suffice my purpose, memory to store audio, and a speaker project which I can follow and make one.
I am looking for a board based solution, after getting some results, I can go for separate micro-controller and DAC.

Thanks in advance.
 
Last edited:

Hi,

first check: is it a recording problem or a playback problem?

Give more technical informations.

recording:
* What is the sampling rate?
* what is the voltage resolution (like 16 bit linear)?
* are there any compressing methods used?

playback:
.. the same as with recording.

Klaus
 
Is your digitized audio in MP3 format? Then you must apply a decoding routine. When I convert digitized audio in Audacity (popular free sound processing software), it requires an encoding routine called LAME (free download, and there may be other MP3 converters).

Number of bits. Commonly 8-bit or 16-bit. 8 bit is good enough quality for speech. (If you want 16 bit then your processor needs to send it via 16 output pins to a 16 bit DAC.) Perhaps your processor has a routine to condense 16 bit to 8 bit? Then you can have 8 bit DAC. It's not hard to make an R-2R network to perform DAC. Filter out the carrier frequency with a capacitor. Then you have analog audio. It may require level shifting before you feed it into a 386 IC amplifier.
 
PWM can produce better quality than an ADC although both have their limitations. Note that some very high quality audio systems use class D amplifiers which are essentially PWM outputs. I doubt an Arduino has fast enough PWM to reproduce good quality though, you need a fast rate and more importantly, the ability to change the duty cycle as fast as the highest audio frequency you want to reproduce.

The other point already mentioned is whether compression is applied. The source data may not have linear steps, there are several compression systems in use and if your original sound file uses one of them, you have to expand the data in software of use a non-linear ADC to restore equal steps.

You may find it easier to use a dedicated audio DAC, for example the CS5330 family. You can use the Arduino to transfer the data in a way similar to SPI and the DAC does the rest for you.

Brian.
 

This project which I made to play human voices (speech data) works fine for me on hardware. You can try this on hardware.

This project I made for making door bells and for giving sound option for my Automatic Water Level Controller.

You can add a simple 2W amplifier to get loud sound.
 

Attachments

  • 1-Bit Wave Player - Update 3.rar
    1.6 MB · Views: 197
"There is somebody at the door" - I did something similar for a doorbell but I 'borrowed' the klaxon sound from Star Trek and added Captain Picard saying "Prepare to repel boarders". Far more appropriate for some of the visitors I get :)


Brian.
 
I used online free text to speech (MP3) converter tool to get the MP3 file.
 

A 555 timer IC is able to convert a signal to PWM. It's handy for making an experimental class D amplifier. Send the signal to Ctl pin 5. (Waveform conditioning may be needed.) As voltage rises and falls it affects the duty cycle at the output.

An LC second-order low-pass type is often used to filter out the carrier. Add a series capacitor to block DC so your speaker receives AC waveform.

555 class D amplifier LCC filter load 50 ohm gets AC.png
 
Thank you for the answer and the details. I am thinking that I'll record audio with 16 bits depth at 44.1KHz or 22KHz(thank you @Klaus for asking these things) and do some experiments with adafruit(thank you @bradtherad for telling about adafruit) for sound quality and store in SD card.
as the quality of output sound depends on the how I am going to record it.

Thank you @Betwixt for answer about PWM and DAC. @Baileychic I'll try the project you have sent today itself.

I am limited on number of pins so I think DAC won't be of much help. I'll try out the PWM and the ClassD amplifier and get back in a day or two with the results and more doubts.
Thanks for the help as I had very little knowledge in this signal processing things. I'll read more and come back
 

Hi,

16bit, 44.1kHz sampling rate is like CD quality.

This means high data rate, about 700kbit/s per channel.

Now I'm asking why you want to do this with a microcontroller? Does it make sense?
In my eyes it's a lot of effort for no benefit. Maybe you can tell us your idea behind it.
* there may be other, more simple solutions. Dedicated sound recording / playback ICs.
* maybe dedicated audio microcontrollers or DSPs
* microcontroller controlled MP3 solutions

I don't think that with PWM you come close to the CD sound quality - although I don't know which microcontroller you want to use.

If you want to stay with the microcontroller solution:
To get the best quality I also vote for an audio DAC. They have a serial interface called IIS or I2S, thus they don't need much pins. They are cheap and need only a few parts and do much of the reconstruction filtering for you ... almost perfect.

Klaus
 

I am making a home speaker solution.
Like when door opens.. it says "door is open".
if door is closed it says .. "door is closed".. similarly like.. "Refrigerator is open".... "Geyser is on" .. "Television is on" ...
these things I'd like to record and play on different cases.

For my other projects I have used Arduino Uno and PIC18F but those projects included stepper motor, line follower, obstacle avoider etc.. So, I have very little idea about this domain like sampling rate and frequency stuff.
I have worked on these two micro controllers so I can use them but if needed I can get a bit higher end with some DAC etc.

I read about this "16bit, 44.1kHz sampling rate is like CD quality." and I think for human speech 8 bit and 10k-16kHz rate will be more than sufficient.
I can record sound and make it to this level using audacity I think. Store it in SD card and play.

What should be my approach for this. How do I short list the components first before assembling them.
Any help would be of great use.

Regards,
Shubham
 

Hi,

Like when door opens.. it says "door is open".
if door is closed it says .. "door is closed".. similarly like.. "Refrigerator is open".... "Geyser is on" .. "Television is on" ...
these things I'd like to record and play on different cases.
instead of re inventing the wheel I´d do an internet search.

I assume there are some dedicated ICs doing this for you.

Klaus
 

This project which I made to play human voices (speech data) works fine for me on hardware. You can try this on hardware.

This project I made for making door bells and for giving sound option for my Automatic Water Level Controller.

You can add a simple 2W amplifier to get loud sound.

Hi , I am not able to extract the file you have attached. Please upload it again.
Thanks
 

Use Winrar 5.x to extract the file. Winrar 4.x will not work for that file.
 

I have found a mp3 player. It's called DFplayer, Its communicates with arduino using serial port and plays the audios from the SD card. It is good and cheap. Now I am trying to make schematic of that pcb.
thanks a lot guys. :)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top