Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Roman Black's BTc Sound Encoder (mostly working)

Status
Not open for further replies.
Mikro C to play sound

I used BTc Encoder sound to generate following code for a short meesage:
Code:
void sound_data1()    org (1 * 256)
{
   asm retlw 0x12 ;
   asm retlw 0x5E ;
   asm retlw 0xFE ;    /// LINE 370
   ....
   asm retlw 0xDF ;
   asm retlw 0xC4 ;
   // reserved for MikroC return!
   //-------------------------------------
}


//--------------------------------------------------
void sound_data2()    org (8 * 256)
{
   asm retlw 0x45 ;
   asm retlw 0xDB ;
   ...
   asm retlw 0xAA ;
   // reserved for MikroC return!
   //-------------------------------------
}
Then, I dont know how to use these sound_data in Mikro C programming in order to output the sound from PIC
Anybody have idea?
Thanks!
 
With BTC you push the bits out in the order you read them from memory. The bit time needs to be regulated and is provided by the encoder software.

It has been a while since I looked at this. It was fun to play with but it is designed as an ultra inexpensive way to capture sound. For a few $ there are better ways.
 
Last edited:
First please not PM unless it is personal.
The forum is exactly for asking such questions.

Read my code in this thread.. look for function SWReadI2C_Speaker().

It it worth the effort? For a few a little money you can buy special built chips with much better sound.

Look for "Special Function - Voice Record/Playback"
on this page


leejongfan said:
Hi 3v0,

thanks for your reply.
But I still dont know how to program PIC using C to play sound using the generated code
Hope you could help
Thanks in advance!
 
Hi,
I bought one and tried to run it, but still cannot work
Worse, actually i dont know how to debug it
Following is my code in Mikro C for recording
Code:
void main()
{
     ADCON1=0x06;  //RA5 Digital I/O
     TRISA=0x20;   //!RA5=SS: output for Chip Select
     TRISC=0x10;   //RC5:output SDO
                   //RC4: Input SDI
                   //RC3:output SCK
     Spi_Init();
     PORTA.F5=0; //!SS=0 chip enabled

     Spi_Write(0x20);   // Power up
     Spi_Write(0x00);
     Delay_ms(25);      //Tpud

     Spi_Write(0x20);   //Power  up
     Spi_Write(0x00);
     Delay_ms(50);      //2 x Tpud
     
     Spi_Write(0xB0);   //SETREC from location 0x00
     Spi_Write(0x00);
     
     Delay_ms(10000);   //delay 10s for recording
     
     Spi_Write(0x30);   //STOP
     Spi_Write(0x00);
     
     Delay_ms(50);      //Tstop;
}
**broken link removed**

**broken link removed**
 
leejongfan,

I have not used this chip. You would stand a better chance of getting help if you start a new thread with isd2002 in the tiltle. Maybe "isd4002 help".

It is good that you provided a schematic.
You will also need to provide a better description of the problem.
If you do not know how to debug the problem you may want to work with easier things and increase you skills.

Things to address in the new thread.
  • What is your background? Do you know C or understand the PIC you are using?
  • Is this your first micro contoller project?
  • Do you have a debugger (ICD2 or PICkit2) that will allow you to step through the code. What is your programming setup?
  • Can you verify that the SPI interface between the uC and isd4002 is working?
  • You will need to post all the code including the SPI code.

If you answer these question it will help me and others help you.
If you fail to answer the question it will limit our ability to help you.
 
I don't see a lowpass filter and I don't see an audio amplifier.
An EPRPM cannot drive a speaker.

If the speaker is 8 ohms then the tiny 1uF capacitor cuts off frequencies below 20kHz.
An audio amplifier uses a 220uF capacitor to feed frequencies above 91Hz to an 8 ohm speaker.
 
You didn't label the part number of the ISD4002 playback IC.
The ISD4002 audio output pin is capacitor coupled to an audio power amplifier with a minimum input impedance of 5k ohms. Your circuit doesn't have an audio power amplifier that has enough output current to drive a speaker. The datasheet for the ISD4002 shows it driving an LM4860 audio power amplifier IC.
 
You didn't label the part number of the ISD4002 playback IC.
The ISD4002 audio output pin is capacitor coupled to an audio power amplifier with a minimum input impedance of 5k ohms. Your circuit doesn't have an audio power amplifier that has enough output current to drive a speaker. The datasheet for the ISD4002 shows it driving an LM4860 audio power amplifier IC.
Thanks a lot,

I am purchasing a LM4860.
In fact, i have a very stupid question to ask: when we build such a circuit with an audio output, and we want to drive a speaker:
- how do we know what kind of speaker we should use ? I mean what are the specifications we should pay attention to?
- If we have to use an Power amplifier, then how do we know what kind of amplifier we are looking for?

I know very little about analog electronics actually.
 
The LM4860 audio power amplifier iC has a high input impedance so it doesn't load down your playback IC. It produces 1.1w at clipping into an 8 ohm speaker with a 5V supply. About as loud as a clock radio.
For speach, use a 3 inch 8 ohm full-range speaker rated for at least 2W.
The IC has a tiny 16 pins surface-mount case.

Instead of the tiny LM4860 you could use a TDA7052 audio power amp IC that is in a normal size 8 pins case. Its output is 0.9W into an 8 ohm speaker with a 5V supply.
Digikey has more than 16,000 in stock for $.91US each.
 
Hi guys!
I'm having the same problem has 3v0, the sound generated by the PIC after a basic low pass filter is sizzling and not really anderstandable, did one of you find a solution?

I'm using a PIC18LF4520 clocked at 20mGhz, my sampling frequency with the RomanBlack software is 64khz with the BTc64 fineness.

Thanks
Bruno
 
The quality of the speaker makes a large difference. The speaker from a PC and one from a set of old cheap PC earphones both produced poor results. A brand spanking new speaker ordered form Mouser was much better but not all that good. I started playing with various filters.

I had fun playing with 1 bit sound but determined that there are easier ways for just a bit more money.

The dedicated sound recorder chips from Winbond ISD are hard to beat.

The author of mondo tech
Mondo Technology - Pic Projects
has a low cost sound encoding method that uses more bits. I have not tried it. Check under Speach EEProm in his index.
 
thanks for your help, i take a look on the mondo tech web site. i don't understande what i'm suppose to do with the Bin file, and how to read it? did i have to use the data like the data generated by the romanblack software?
and from a wav to sn to scf to bin to Hex what a long trip for a sound :D

I try making this work and keep you in touch if you are interesting
Thank you
Bruno
 
From Mondo Tech's page
Our programmer needs to have data sent to it in HEX file format. The DOS program HEX.EXE can be used to produce one from the BIN file...
C:>hex filename
This produces filename.hex.

Once you have the bin you convert it to .HEX using the program "hex". Then program the hex file. Use a PIC programmer like a PICkit2 to program the hex file into a I2C EEPROM. (could be SPI but I think they were I2C, check to be sure)

Also see "Talking Fish Hack" on the same site. It contains the asm source code for playing back the file. Note that the program requires a MCP141010 Microchp SPI digital pot which is uses as a DAC.

thanks for your help, i take a look on the mondo tech web site. i don't understande what i'm suppose to do with the Bin file, and how to read it? did i have to use the data like the data generated by the romanblack software?
and from a wav to sn to scf to bin to Hex what a long trip for a sound :D

I try making this work and keep you in touch if you are interesting
Thank you
Bruno
Keep us posted. This is a good learning project because you get to use I2C serial memory and a SPI digital pot. Note that the asm code for the talking fish has code to drive the fish head and tail. You will not need these.
Good stuff.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top