Pic Sound Player

Discussion in 'The Projects Forum' started by Art, Jan 8, 2010.

  1. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    Hi Guys,
    This is mainly for Roman Black, the author of the algorithm for playing 1 bit sound on microcontrollers,
    but if anyone has experience with it, I'll take help from anyone ;)

    I have assembled and programmed micros for a circuit which, at the moment,
    can speak any number from 0 to 9.
    The circuit can currently use those samples to count with an audible voice.

    Edit: Video Deleted... Updated one posted on this page!

    I'm wondering if this is the best possible resulting sound that can be expected from the project.
    The sound player chip is a 16F628 running at 4MHz (internal RC Osc).
    Sampled speech was 22050 sample rate, and converted with the 1.5 bit
    setting with version 2 of the BTC encoder.

    The YouTube video actually seems to reproduce the sound better than the
    circuit can itself. There is a lot of screech in the background.
    I've tried a higher sample rate, which didn't appear to benefit much,
    and 44100 is too much for the pic running at 4MHz (I removed the timer delay altogether for this).

    Does this sound right? Maybe a better filter or speaker would help?
    Cheers, Art.

    [​IMG]
     
    Last edited: Jan 10, 2010
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Sounds like it needs a low-pass filter on it.

    Reminds me of the first computer game that I bought for my TRS-80 Model I that had voice; "Galaxy Invasion", back around 1981. 1.77MHz Z80 processor. It had a very similar "tinny" twang to it; used the same kind of PWM technique on the internal speaker.
     
  3. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Hi Art. :) I can probably suggest more help if you post a schematic.

    Juts looking at your speaker, that is about the worst possible type of speaker for this app. Try some small magnetic speakers, some sound much better than others.

    What low pass filter do you have before the speaker? You could add more filtering there, ie another resistor and cap, provided you have good enough volume.

    22kHz will have playback artifacts at /2 /3 and /4, which is 11kHz, 7kHz and 5kHz, they are all in the peak range of your little speaker and very audible. Going to 44kHz (just go to a 8MHz xtal?) will double these frequencies and make them so much easier to filter out in hardware.
     
  4. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    Hi RB,
    I didn't really do a schematic, I'm looking at the chip pinouts for the pics as I go.
    The primary pin resistor is an 8.2K, and the secondary pin is 4.7k.
    There is no cap, just the other ends of the resistors connected to the piezo, and the piezo negative to gnd.
    I copied these values from a circuit that has a sample which sounds good
    (may have even been in a pic/EEPROM schematic on your old site).

    I have a working talking real time clock now, which is what I was working towards.
    It has an LCD interface ready, but still no display.
     
  5. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Art, are you using this Btc 1.5 algorithm?
    [​IMG]

    If so the 2 resistors should be the same value and you "disconnect" 1 of them by making that PIC pin high impedance. That second PIC pin is disonnected whenever it doesn't match the primary PIC pin.

    Please check my web page;
    http://www.romanblack.com/BTc_alg.htm
    a lot of new content has been added for the BTc sound recently, including new algorithms in the BTc Sound Encoder Windows software.

    The biggest sound improvement will probably be to ditch the piezo and use a little 8 ohm magnetic speaker. Also a cap will help from the output of the resistors to ground. Something about 0.33 uF would be right, just remember it will cut your volume a little bit but a speaker will be more efficicnt than your piezo anyway.

    Then I often use an additional resistor after that, in series with the speaker and even use a 1uF or 2.2uF cap across the speaker terminals themselves.
     
  6. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    Art, just out of curiosity, why did you solder your components on the underside of the board?? The circuit would look a lot "neater" if components where placed thru the other side of the board and all soldered connections are on the bottom side. I guess for debugging the circuit, it would make it easier to see all the connections though....
     
  7. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    So it's got a flat side to sit on the desk, and I think I prefer it this way now.

    Thanks RB, I'll try your advice.
     
  8. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    Last edited: Jan 10, 2010
Loading...