# Storing voice commands in Microcontroller

Status
Not open for further replies.

#### fubuaks

##### New Member
Hi.....I've made a project for control of home appliance thru mobile phone,using dtmf decoding.I've made that,but now i want to ,kind of, extend it by getting sound also as an output.Like when we call a customer care we get several audio commands.
Like that,when i call my cell phone to control any appliance i get voice commands like-Enter password,press '*'to switch on,'#'to switch off.....like that.
Right now i am using AT89s51.
I would be grateful if anybody can give me some start in this......

##### Banned
You'll need some external memory to store the clips you want to play back, uncompressed audio takes up a decent amount of space, and compressing it is not usually easy. You simply need a DAC connected to the micro controller and you feed that the individual byte samples of the audio clips you record. Since this is for a phone you may be able to abvoid using a DAC by using a PWM output of very high frequency and adjusting the duty cycle to represent the bytes. A simple lowpass filter will remove the high frequencies.

#### DirtyLude

##### Well-Known Member
I'm sure you can find them with some googling, but there are dedicated chips that do exactly this. Store a certain number is of audio phrases and play them back when queued.

Last edited:

##### Banned
He's already got an AVR. All he needs is memeory to store it, and a PWM output and filter or a discrete DAC to output the audio.

#### DirtyLude

##### Well-Known Member
He's already got an AVR. All he needs is memeory to store it, and a PWM output and filter or a discrete DAC to output the audio.
Yes, we all saw your post, it's fabulous. So, going with an easier prepacked solution isn't an option?

I googled them, and I thought there was some cheap ones that all they did was simple speech record and replay with everything built in, but all I found where more complex ones with text to speech and other speech synthesis, which would be overkill.

##### Banned
Dirty, price a cheap eeprom or flash memory and compare. For phone quality audio as long as they can do PWM over about 16khz and put a filter on it they can run the whole thing from a single I/O line and whatever is required for the memory. You can always add more memory or code to the AVR for functionality or voice space, if you use a pre-packaged voice module you're forever a slave to it's limits.

#### fubuaks

##### New Member
You'll need some external memory to store the clips you want to play back, uncompressed audio takes up a decent amount of space, and compressing it is not usually easy. You simply need a DAC connected to the micro controller and you feed that the individual byte samples of the audio clips you record. Since this is for a phone you may be able to abvoid using a DAC by using a PWM output of very high frequency and adjusting the duty cycle to represent the bytes. A simple lowpass filter will remove the high frequencies.

Ok i'l get some external memory,thats later part......But the first step i guess is to digitize the sound file.In which format should i store that sound file( i record in comp. via microphone)...? And do i need to pulse width modulate the same file(How do i do it??). I didn't get the following- 'Since this is for a phone you may be able to abvoid using a DAC by using a PWM output of very high frequency and adjusting the duty cycle to represent the bytes.'

#### DirtyLude

##### Well-Known Member
I understand the limitations. The benefit is that it's a simple solution with no programming other than the digital interface to trigger the sounds.

Yes, there is always limitations and benefits to using dedicated hardware blocks, but it's the designers decision based on the factors he/she knows about. Less cost and future expandability may mean nothing to the original poster compared to getting it out tomorrow.

Anyway, the point is moot, since I can't find the actual chip. I remember it from my robot days.

#### fubuaks

##### New Member
I understand the limitations. The benefit is that it's a simple solution with no programming other than the digital interface to trigger the sounds.

Yes, there is always limitations and benefits to using dedicated hardware blocks, but it's the designers decision based on the factors he/she knows about. Less cost and future expandability may mean nothing to the original poster compared to getting it out tomorrow.

Anyway, the point is moot, since I can't find the actual chip. I remember it from my robot days.
No i don't wanna buy a readymade thing. Wanna do it completely myself, from scratch, just need the right process......

#### DirtyLude

##### Well-Known Member
That's fine, just letting you know your options.

##### Banned
.wav files have a short header describing the data, if you're using a fixed format you don't need a header you just store raw audio samples, an audio sample is nothing more than the byte value of the ADC at a repeated fixed point in time.
If you have a PWM timer output on your PIC what you do is set it to it's highest possible frequency that will allow an 8 bit duty cycle, you may be able to get away with 4 bits for human voice and then you use a second timer at the sample rate of your audio file to set the duty cycle. Filtering out the main PWM's frequency is relativly easy if it's high enough. Depends on the capabilities of your pic.

#### fubuaks

##### New Member
I guess i have 2 study a lot of things before i start doing this project......thanks for your replies...i'l get back after a gaining some knowledge.....if you could suggest me some books on communication concerning this project.....?

#### jawed

##### New Member
I'm trying to do similar thing, i.e. use PC to record data on to micro and then playback it in the car. My aim is to keep the cost < $1. Thus I can't use those audio IC's since they cost more then$3 as far as those I have come across.

I hope we find someone who has done similar stuff.

#### Mr RB

##### Well-Known Member
Yep you just did.

Quite a few years back I developed free Windows software that turns audio wave files into 1bit sound, (thats the "easy" compression, Sceadwian) and you can play the sound back using just 1 digital output pin on a PIC or other micro.

Over the years I have continued updating my "PIC-Sound BTc 1-bit sound encoder" it is currently in version 2.0 which does some cool stuff like dynamic compression and resampling at ANY playback frequency you desire. This makes playback even easier as you can choose an even multiple of your microcontroller's timer inturrupt freq for each "bit" you play back.

I even developed a nice "1.5bit" algorithm that uses 1bit for storage still, (ie no additional memory cost) but produces a more filtered and better sound output than traditional 1bit sound. That's what I use on my "talking" projects.

v2.0 of BTc Sound Encoder is free on my website;

#### KUNAL KARIYA

##### New Member
I want to full details of ur priject

#### DerStrom8

##### Super Moderator
I want to full details of ur priject
KUNAL KARIYA, this thread is over 3 years old. It would probably be better to start your own thread. Just reference this one, with a link, in yours and I think it will help a lot.

Best wishes,
Der Strom

Status
Not open for further replies.