PDA

View Full Version : Wanted: Sound chip interfaced with pic



xnihilo
- 6th June 2008, 15:10
Hi there,

Does anyone know about a cheap sound chip that does not need an expensive programmer and that can hold good quality digital sound of about a few seconds ( and that can be output at high volume without distortion, in mp3 or pcm or whatever) AND that can be interfaced to a pic. Something like ISD maybe?

I need to add loud and *good* quality/realistic gunshot sound to my lasergame equipment project. i have implemented all features but the sound. using a Cracker is lame and unsafe but digital sound often sounds crappy and lame too!

Does anyone have a sggestion? It would be really cool.

Thanks in advance for any idea.

skimask
- 6th June 2008, 15:48
I need to add loud and *good* quality/realistic gunshot sound to my lasergame equipment project. i have implemented all features but the sound. using a Cracker is lame and unsafe but digital sound often sounds crappy and lame too!
Looks in the manual for SOUND. You want white noise to make that sort of sound.
Worst case you end up with a dedicated, pin triggered PIC (might even run on a 10F200) making sound connected to an amplifier.

xnihilo
- 6th June 2008, 16:42
Looks in the manual for SOUND. You want white noise to make that sort of sound.
Worst case you end up with a dedicated, pin triggered PIC (might even run on a 10F200) making sound connected to an amplifier.

no. white noise sucks.
i need good quality audio chip.
there is somrting called quickvoice...

skimask
- 6th June 2008, 16:52
no. white noise sucks.
i need good quality audio chip.
there is somrting called quickvoice...

Gunshot noise IS white noise! It's all in how you manipulate the envelope.

whatever...

tenaja
- 6th June 2008, 17:11
But it is a laser gunshot...those are typically more melodious than white noise.

skimask
- 6th June 2008, 17:27
But it is a laser gunshot...those are typically more melodious than white noise.

Yep, I smell what you're cooking. All that 'white' noise from the SOUND command has a LOAD of harmonics in it being square waves and all. Could probably roll that pitch value up and down fairly nicely to get that sort of sound.

PJALM
- 6th June 2008, 18:44
If you do it right you can even use the internal DAC to generate just about any sound.

skimask
- 6th June 2008, 19:32
If you do it right you can even use the internal DAC to generate just about any sound.

Internal DAC? Which PIC has one of those?

xnihilo
- 7th June 2008, 00:14
Quikvoice from eletech.com is an audio chip that van be connected to EPROM (and what about EEPROM) which contains the data. Triggering the right pin will run the play sequence.
It could be easily interfaced with a pic.
Problem is it is a proprietary format that needs special software and hardware.
I need a stuff like the sound chip found in audio greeting cards...

xnihilo
- 7th June 2008, 01:20
Hi,

I found an MP3 sound chip, VS1001.
It can be interfaced with a pic.
Does someone have Picbasic code for this?

Thanks anyway

skimask
- 7th June 2008, 01:24
I found an MP3 sound chip, VS1001.
It can be interfaced with a pic.
Does someone have Picbasic code for this?

That's an older MP3 chip, been around for quite awhile. Loads, literally hundreds of examples of how to drive the VS1001 chip around the internet. Just a matter of shifting data from one point to the other.
Question is... do you know how to get an MP3 sound into an eeprom, an external eeprom? 'cause a decent sound bite surely won't fit in any PIC internal eeprom.
And have you downloaded the datasheet for it yet?
And have you even tried the SOUND command yet?

jderson
- 7th June 2008, 02:27
I have a Winbond ISD4002 I intend to hook to a PIC (someday!). This has SPI interface, and can have multipule messages. It is available with different recording times. All you have to do is connect a microphone and a speaker, so they say!

Dave

PJALM
- 7th June 2008, 12:58
Internal DAC? Which PIC has one of those?

Sorry, was thinking of the dsPICs, I use quite a few that have internal 16bit Audio DACs.

Normnet
- 7th June 2008, 19:07
See M25P32 PIC Audio (http://www.picbasic.org/forum/showthread.php?t=6870)
Warning "Other Compiler"

8 bit or 16 bit mono up to 44k.

Norm

skimask
- 7th June 2008, 22:14
Wanting to get high quality sound out of something that is most likely going to be used in a noisy environment anyways with, most likely, a speaker with dubious quality, an amplifier that's going to be simple with minimal parts count...and so on... Almost sounds like trying to soak a turd in perfume! :D
Not dogging you or your project at all here (believe it or not).
I'm just wondering how much quality you'd actually need for a 'gunshot' sound if you're out and about, playing this laser tag game, battery powered modules, with the unit/speaker mounted in a 'laser gun' of some sort. I mean, how big of a speaker can you mount in the thing? And what sort of quality can you possibly get out of that size of a speaker? Not a lot. And if you do want a lot of quality, how much are you going to spend on each speaker? How big is the magnet going to be? Do you want to carry around that much weight while playing this sort of game?
Sure, 100% highest quality all the way around a project is nice...but, wow, sometimes ya just gotta draw the line and go with whatever works.

mister_e
- 7th June 2008, 23:09
Decent or reasonable... that's the question
if reasonable ISD4xxx would do.

for better quality or high quality, it's obvious you really want to avoid anything like MP3... but then there's a lot of are plenty satisfied with MP3... way better than that poor noisy ISD4xxx but... you will need storage devices (MMC card or whatever else)

Worth to have a look at Winbond website, they should have better chip than those 'Telephone line' vouched ISD4002.

xnihilo
- 8th June 2008, 17:14
That's an older MP3 chip, been around for quite awhile. Loads, literally hundreds of examples of how to drive the VS1001 chip around the internet. Just a matter of shifting data from one point to the other.
Question is... do you know how to get an MP3 sound into an eeprom, an external eeprom? 'cause a decent sound bite surely won't fit in any PIC internal eeprom.
And have you downloaded the datasheet for it yet?
And have you even tried the SOUND command yet?

I id NOT find a good interfacing example Mr SkimaskKnowsEverytging.
Yes I have the datasheet.
Yes, I am using to create a placeholder for the gunshot sound in my code but it sucks.

xnihilo
- 8th June 2008, 17:15
I have a Winbond ISD4002 I intend to hook to a PIC (someday!). This has SPI interface, and can have multipule messages. It is available with different recording times. All you have to do is connect a microphone and a speaker, so they say!

Dave

Have you more info or example? (code/intefacing). You need a special hardware and/or software to set your sounds.

xnihilo
- 8th June 2008, 17:17
See M25P32 PIC Audio (http://www.picbasic.org/forum/showthread.php?t=6870)
Warning "Other Compiler"

8 bit or 16 bit mono up to 44k.

Norm

Thank you. I'm not going to change the compiler or the programming language.

xnihilo
- 8th June 2008, 17:19
Wanting to get high quality sound out of something that is most likely going to be used in a noisy environment anyways with, most likely, a speaker with dubious quality, an amplifier that's going to be simple with minimal parts count...and so on... Almost sounds like trying to soak a turd in perfume! :D
Not dogging you or your project at all here (believe it or not).
I'm just wondering how much quality you'd actually need for a 'gunshot' sound if you're out and about, playing this laser tag game, battery powered modules, with the unit/speaker mounted in a 'laser gun' of some sort. I mean, how big of a speaker can you mount in the thing? And what sort of quality can you possibly get out of that size of a speaker? Not a lot. And if you do want a lot of quality, how much are you going to spend on each speaker? How big is the magnet going to be? Do you want to carry around that much weight while playing this sort of game?
Sure, 100% highest quality all the way around a project is nice...but, wow, sometimes ya just gotta draw the line and go with whatever works.

A turd... Nice...
I need a REALISTIC gunshot, that's all. Unless you have a replacement solution for such noise, your posts are somehow irrelevant... It looks like you need to have something to say to any post on this forum...

xnihilo
- 8th June 2008, 17:22
Decent or reasonable... that's the question
if reasonable ISD4xxx would do.

for better quality or high quality, it's obvious you really want to avoid anything like MP3... but then there's a lot of are plenty satisfied with MP3... way better than that poor noisy ISD4xxx but... you will need storage devices (MMC card or whatever else)

Worth to have a look at Winbond website, they should have better chip than those 'Telephone line' vouched ISD4002.

Hello Mister_e,

I need a sound thats not FUZZY (I mean white noise being heard when the sound is over).
Do you know what is needed (software and hardware) to use ISD chips?
Another lasergame project (Milestag, from Jim Robertson) uses a ISD 2550 but the sound is fuzzy and this chip is discontinued anyway.
Do you have an idea? MP3 with a little amplifier might do the trick, that's why I thought aout that..

mackrackit
- 8th June 2008, 17:54
Just a thought. I got a birthday card once that had a 10 second record chip in it. You know the kind when the card is opened it says something. PIC pin goes high to activate?

I do not have a part number and maybe the chips already mentioned are this.

xnihilo
- 8th June 2008, 18:03
Just a thought. I got a birthday card once that had a 10 second record chip in it. You know the kind when the card is opened it says something. PIC pin goes high to activate?

I do not have a part number and maybe the chips already mentioned are this.

Yes, that's what I'm thinking of. I just got one a few days ago for my birthday. It has a little speaker but the sound quality was pretty good and the chip was sunk in a black plastic so I was unable to check what chip is used. It might be a ISDchipcorder type.

I need to record my sound (or transfer it from my pc).
I need interfacing example to a PIC16F690 and PBP code.

I think Mister_e uses this kid of chips...

Normnet
- 8th June 2008, 18:05
i need good quality audio chip

If its quality your looking for the M25P32 PIC Audio (http://www.picbasic.org/forum/showthread.php?t=6870) is CD mono quality for short audio(gunshot).
Record a wave of a gunshot from a video game and use the included RS232 PC to M25P32 installer in the M25P32 program.

It would require converting from Proton to PicBasicPro but their similar.

The DA outputs 16 bit 44.1K CD quality mono and all thats then required is an amp and speaker to suite.

Another options is the Quadravox QV502 (http://www.quadravox.com/frameset/qvframeset.htm).

I will be posting a PIC iPOD SD card 8 bit stereo wave player later next month (Proton).

Norm

xnihilo
- 8th June 2008, 18:33
Hi,

I've already bookmarked a page related to that stuff and a post from you, intending to have a look later.
So I can interface it directly to a pic then?

Normnet
- 8th June 2008, 18:40
Interfaced directly from PIC with MSSP SPI (fastest).

Web page http://www.hickorytech.net/~normnet/

Norm

skimask
- 8th June 2008, 21:18
I id NOT find a good interfacing example Mr SkimaskKnowsEverytging.
Yes I have the datasheet.
Yes, I am using to create a placeholder for the gunshot sound in my code but it sucks.
Funny... Google pulls up a fair amount of interfaces for me. And the VS1001 datasheet show most everything needed.


A turd... Nice...
I need a REALISTIC gunshot, that's all. Unless you have a replacement solution for such noise, your posts are somehow irrelevant... It looks like you need to have something to say to any post on this forum...
Look pal, I'm just pointing out the fact that sometimes...SOMETIMES...a person overdoes a project by a whole load and wastes a lot of money and effort for perfection when the end result doesn't justify it.


Do you know what is needed (software and hardware) to use ISD chips?
Again, Google finds a few decent examples of ISD usage with an MCU.


Do you have an idea? MP3 with a little amplifier might do the trick, that's why I thought aout that..
How much does a VS1001 cost? How much does a decent amplifier cost? How much does a decent speaker cost? How much tooling to make a good PCB? How much room in a box? Is it really viable?


I need to record my sound (or transfer it from my pc).
I need interfacing example to a PIC16F690 and PBP code.
Need need need. There are examples out there. They might not all be for exactly PICs and PBP, but they aren't that different from one to the next.

Jist of the story...how you even tried the SOUND command yet? I had a play with it a couple of days ago just to see if I was on crack, talking smack, or whatever. I think the sounds came out pretty good with the example shown in the PBP manual, nothing more. A bit more of a better filter, maybe a bit of tweaking and finding the right sound frequencies/duration, I'd think that SOUND could produce something really decent.

mister_e
- 8th June 2008, 23:01
ISD chip could do the job, some have built-in amplifier, A DsPIC with nothing else as well

I already hard-coded some WAV sounds. A bit waste of time... but fun to do and don't require nothing else on board... just a small amplifier such as TS4962 (one of my favourite for really small size amp, really neat), opamp+transistors or this 650 years old LM386 ;)

And this also bring Roman Sound BitCoder solution. Could be fine... worth you try it.

Quadravox programmer for ISD is one solution for mass production.

For MP3, i would no longer use this about to be obsoleted VS1001, VS1011 would be a better choice.

Normnet
- 6th September 2008, 08:35
So, as i need only a player for one sound file, idealy I would need on one hand a complete application for recording/dumping the sound to m25p32 chips and on the other hand an application with a pic containing only a small player routine.
Yes.
Perhaps the play routine would fit on demo version or port to PBP.


I saw there are 4 sound formats supported, i guess i would only need... uh... 16bits uncompressed?? Ulaw, adpcm,... will reduce sound quality, won't they?.
16bits uncompressed is the best (CD quality), others down sample for increased play length.


From what I've seen in the code, you press shortly so it plays all stored files one after another, a press again stops the play and pressing longer fast forwards?
Yes.
I would use the in code call to play lines in the mainloop:
If sPLAY_BUTTON = 1 Then
iIN_PROGRAM_FILE_PLAY_SET = 1
wIN_PROG_FILE_TO_PLAY = 1
Endif
Play will also end if sPLAY_BUTTON = 0 in the MEM_CHIP_PLAY_16BIT sub.
This means you can start wave file by externally setting the PLAY_BUTTON pin high and stop by setting sPLAY_BUTTON pin low.


your code sends the data byte from memory to dac? Is it that 'simple'??? is the sound modified somehow between the m25p32 and the dac??
The data has already been processed from the original wave file by the PC program.
Just a read of 2 sequential bytes from M25P32 and a send of 2 bytes to DAC required.
I call it a raw file.


Producing sound with a pic is sending sound bytes at a specific 'sampling' rate to a dac? Then what is the 8bits/16bits sound parameter for?
16 bits (0-65535) increases the number of steps of volume available per sample compared to 8 bits (0-255),
Increases the quality or precision with the sampling rates being equal.
16 bits is CD quality.


I wonder if having the very short sound file (about 1s) stored in the pic internal Eeprom would not work if i feed it to the dac without the need for a serial eeprom...
One second of CD quality requires 44.2k word samples.
The largest eeprom in the PIC18 series is only 1024 bytes.
Even if loaded to ram the PIC18F4620 can hold only 15 128 element word arrays or only 1.92k of word samples.
Audio memory requires massive capacity and high speed.

Norm

xnihilo
- 7th September 2008, 12:42
Hello Norm,

I wish to thank you for all your answers. Clear and it answers exactly my questions.

When you say: "The data has already been processed from the original wave file by the PC program."
-> you mean by your program that dumps the sound file to the memory chip or by the program that recorded/converted the sound? In other words, would the sound file (wave, 44KHz, 16 bits) I found in a game sound directory be ready to be stored in the memory chip? Can I transfer the wave file 'bit per bit' into a memory chip or does the file need to be modified to be used by the dac? I guess there is a header, a trailer, a checksum and stuff like this I should get rid of first. I will read the wave file specs...

"16 bits (0-65535) increases the number of steps of volume available per sample compared to 8 bits (0-255),"
-> Right, aft(er posting the questions I googled to find the answer. I undesrtand now. Thanks.

"The largest eeprom in the PIC18 series is only 1024 bytes.
Even if loaded to ram the PIC18F4620 can hold only 15 128 element word arrays or only 1.92k of word samples.
Audio memory requires massive capacity and high speed."
-> Yes, I understand. Maybe I could try an external EEPROM (I already use one for my project), I have to check if it has a SPI interface and if it can be accessed at a frequency compatible with the sound frequency.


I found the microchip 25AA1024 1Mbits SPI bus serial EEPROM. It has 246 bytes page size, and a 20MHz clock speed.
It could store my 44K words of my 1s sound at 16bits 44KHz.
I guess it could replace the M25P32 memory chip...

Normnet
- 7th September 2008, 13:04
When you say: "The data has already been processed from the original wave file by the PC program."
-> you mean by your program that dumps the sound file to the memory chip or by the program that recorded/converted the sound? In other words, would the sound file (wave, 44KHz, 16 bits) I found in a game sound directory be ready to be stored in the memory chip? Can I transfer the wave file 'bit per bit' into a memory chip or does the file need to be modified to be used by the dac? I guess there is a header, a trailer, a checksum and stuff like this I should get rid of first. I will read the wave file specs...

The PC program converts from wave format to sequential bytes and sends to memory chip.
Must be modified.
PC program also adds CRC for 115k serial transfer.
I believe the PC program source code is included in my website download.

Norm

Normnet
- 7th September 2008, 13:17
The 25AA1024 is 20MHz while the M25P32 (50MHz) pretty much tops out at 44k 16bit.

Norm

skimask
- 7th September 2008, 18:11
Can I transfer the wave file 'bit per bit' into a memory chip or does the file need to be modified to be used by the dac?
Which DAC would that be?
Not too many PICs out there have DACs.

Another thought for you...
44.1Khz sample rate * 16 bits * single channel (ignoring stereo for the moment)

705,600 bps shift rate... Doable by a PIC, assuming you use the right crystal and the right baud rate dividers...
88,200 bytes per second total transfer rate from EEPROM to DAC thru the PIC.
Again, doable by a PIC since it's the same thing.

Ok, set up the SPI at the proper bit rate to shift data out of the EEPROM sequentially...Done...
Catch an interrupt every 8 bits to grab byte data from the SPI...
Catch every other interrupt after grabbing 2 bytes to send the 2 bytes out to the DAC.
Is this going to be a serial DAC or a parallel DAC? 16 bit DAC or 8 bit DAC?
Serial DAC...well, your SPI is already tied up grabbing data from the EEPROM, unless you're using a large PIC with 2 SPI modules. So, do you have enough PIC cycles left over to shift that data in and/or out using the firmware? Using Shiftin and/or Shiftout, you aren't going to have a lot of cycles leftover for much at all.
Parallel DAC...Your SPI is still tied up grabbing data from the EEPROM. Do you have enough pins left over to pump parallel data out to the DAC (at minimum a 28 pin PIC with practically no pins leftover to do anything)? Not to mention enough cycles left over to process any other inputs/outputs that your project requires?

Normnet
- 7th September 2008, 19:15
M25P32 PIC Audio v1.0 (http://www.hickorytech.net/~normnet/)
Warning: other compiler.
PBP's support of Longwords makes porting more feasible.


Is this going to be a serial DAC or a parallel DAC? 16 bit DAC or 8 bit DAC?
M25P32 PIC Audio supports both 16 bit and 8 bit serial DAC.


So, do you have enough PIC cycles left over to shift that data in and/or out using the firmware?
Does 8 bit and 16 bit at 44k, Ulaw compression at 32k and IMA compression at 22k.

The Basic compilers have safe reliable built in commands
such as SHIFTIN, SHIFTOUT and ADCIN but a great deal of
speed can be gained by use of the registers.

I am presently in final stages of an SD PIC iPod.
8 bit stereo 44k and Nokia 6100 GLCD with scrolling menu, in data long file names, and BMP pictures.
All done in BASIC with a PIC18F452 and SPI interface between the PIC, SD card and the GLCD.
DAC's are parallel.
Sequential read of data.


Norm

xnihilo
- 8th September 2008, 13:38
Which DAC would that be?
Not too many PICs out there have DACs.

Another thought for you...
44.1Khz sample rate * 16 bits * single channel (ignoring stereo for the moment)

705,600 bps shift rate... Doable by a PIC, assuming you use the right crystal and the right baud rate dividers...
88,200 bytes per second total transfer rate from EEPROM to DAC thru the PIC.
Again, doable by a PIC since it's the same thing.

Ok, set up the SPI at the proper bit rate to shift data out of the EEPROM sequentially...Done...
Catch an interrupt every 8 bits to grab byte data from the SPI...
Catch every other interrupt after grabbing 2 bytes to send the 2 bytes out to the DAC.
Is this going to be a serial DAC or a parallel DAC? 16 bit DAC or 8 bit DAC?
Serial DAC...well, your SPI is already tied up grabbing data from the EEPROM, unless you're using a large PIC with 2 SPI modules. So, do you have enough PIC cycles left over to shift that data in and/or out using the firmware? Using Shiftin and/or Shiftout, you aren't going to have a lot of cycles leftover for much at all.
Parallel DAC...Your SPI is still tied up grabbing data from the EEPROM. Do you have enough pins left over to pump parallel data out to the DAC (at minimum a 28 pin PIC with practically no pins leftover to do anything)? Not to mention enough cycles left over to process any other inputs/outputs that your project requires?

I would like to have a sound project based on Norm's project which is great although I didn't test it yet.
I will not use my main pic to handle the job. I will use a dedicated pic to manage the EEPROM->PIC->DAC work. Only one pin of my main MCU will trigger the sound play.
I intend to use a 16 bits serial DAC with a PIC18F452 and a 10MHz Crystal.
I think that sending a 88KB sound file from the eeprom to the DAC is manageable as Norm already did it (with a M25P32 SPI memory at 50MHz). I will try to use 25AA1024 1Mbit 20MHz microchip memory (I say 'try' because I have to calculate to check if, as you say, I will have enough cycles to perform the all the transfers).
I NEVER used SPI and I even don't know how to program the routines. In hardware mode it sounds easier but it is still hazy. I will read Microchip Application Notes and code sample and read Norm's code. I have to make routines as I didn't find dedicated functions in PBP.
It would of course be easier to use Norm's project 'as is' but I would like to create my own application and as I want to use it in a 'commercial' application, I can't just use someone else's work.