Shop OBEX P1 Docs P2 Docs Learn Events
play wav file from SD card — Parallax Forums

play wav file from SD card

shmowshmow Posts: 109
edited 2010-07-06 21:38 in Propeller 1
Hey All,
I purchased the SD adapter board and have been trying to play a WAV. file.
I've found a sample code (excellent and thorough - http://www.instructables.com/id/Make-a-Talking-Clock/?download=pdf); but it's somewhat complicated for my little brain to decipher.
If you look at the main portion of the enclosed program then you'll see a simple sub-routine call with it's related commands to play files.
However, a big fat nothing happens.
I've tried all sorts of things - I've even flipped the SD card thinking I've got it in the slot upside down.
No luck.
Is there any help out there?
Regards,
Shmow

'
'
' Propeller Pins SD card Pins
' 3.3v
'     
'      10k res
' p0 ───────────┻─┼─┼─┼─┼────────── do
' p1 ─────────────┻─┼─┼─┼────────── clk
' p2 ───────────────┻─┼─┼────────── di
' p3 ─────────────────┻─┼────────── cs
' └────────── irq
'
'─────────────────────────────────────────────────
'
' - +
' p7 ──────────────── + [noparse][[/noparse]speaker] - ─────┐
' 
' 47µF cap GND
'
con

_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
bufferlen = 800


obj

wpl : "WavePlayerSdAccess"

var
byte ledcolor
byte newhours
byte blinkflip
byte buff[noparse][[/noparse]bufferlen]
long stack[noparse][[/noparse]300]
byte alarmhour
byte alarmmin
byte alarmstat
byte secblinker
byte oldsec

pub main | b ' main program loop

cognew(announcer, @stack)

repeat
announcer
waitcnt(clkfreq+cnt)


pub announcer | currhr, currmin, currsec ' checks if esc has been hit and annouces time
wpl.start(0, 5, 4, @buff, bufferLen)
repeat

wpl.playwave(string("morn.wav"))
wpl.playwave(string("standard.wav"))
playhours(14)
playmins(21)
playsecs(41)


pri playhours(hrs) ' announce hours
IF (hrs <13)
playnumber(hrs)
ELSE
playnumber(hrs -12)

pri playmins(minns) ' announce minutes
IF (minns == 0)
wpl.playwave(string("exact.wav"))
else
IF (minns < 10)
playnumber(0)
playnumber(minns)
wpl.playwave(string("and.wav"))


pri playsecs(secs) ' announce seconds
playnumber(secs)
wpl.playwave(string("secs.wav"))
wpl.playwave(string("beep.wav"))

pri playnumber(number) | tendig, onedig ' generic routine to announce numbers
if (number < 20)
player(number)
ELSE
tendig := number / 10
tendig := tendig *10
onedig := number - tendig
player(tendig)
IF (onedig <> 0)
player(onedig)

pri player(number) | i
IF (number < 20)
wpl.playwave(@shortfiles[noparse][[/noparse]7 * number])
ELSE
i := number / 10
wpl.playwave(@longfiles[noparse][[/noparse]7 * i])



DAT
shortfiles byte "00.wav",0,"01.wav",0,"02.wav",0,"03.wav",0,"04.wav",0,"05.wav",0,"06.wav",0,"07.wav",0,"08.wav",0,"09.wav",0,"10.wav",0,"11.wav",0,"12.wav",0,"13.wav",0,"14.wav",0,"15.wav",0,"16.wav",0,"17.wav",0,"18.wav",0,"19.wav",0
longfiles byte "00.wav",0,"10.wav",0,"20.wav",0,"30.wav",0,"40.wav",0,"50.wav",0





                
«1

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-06 13:37
    You might be chasing two project at once.. Always tricky..

    Cross check your SD setup with something like FemtoBASIC or PropDOS which are known to work across a variety of configurations.
    (Don't be afraid to switch out your SD card itself in this test.)

    Once you verify that your hardware is working correctly, then turn your attention back to your WAVplayer code.

    You might also find the Propeller Cookbook, page 5 useful.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.

    Post Edited (Oldbitcollector) : 7/6/2010 1:44:32 PM GMT
  • shmowshmow Posts: 109
    edited 2010-07-06 13:45
    Hey OBC,
    this PropDOS, what application do I open it with? I've discovered it's not Propeller Tool.
    Shmow
  • shmowshmow Posts: 109
    edited 2010-07-06 13:48
    Uh oh! I need the combo keyboard and video - eegads!
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-06 13:48
    You'll need to rename the file with a .zip extension as the forum didn't like the upload.

    Then you should be able to extract and use it with the Propeller tool.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-07-06 13:50
    Hi Shmow,

    one thing that will help forum members help you is for you to place your code between two "code tags". They look like this except you need to take out the spaces

    [noparse][[/noparse] code ]

    [noparse][[/noparse] / code ]

      That way the indentation
         of your code
           will be preserved
    
    



    smile.gif
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-06 13:52
    No video or keyboard huh? Try this instead..

    You'll have to uncomment the sections you want to activate in the code.. Don't worry it's well documented.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
  • shmowshmow Posts: 109
    edited 2010-07-06 13:54
    oops, sorry.
    I trust this is better.




    '
    '
    '  Propeller Pins                  SD card Pins
    '                                      3.3v
    '                                        &#61463; &#61463; &#61463; &#61463; &#61463; 
    '                             &#61628; &#61628; &#61628; &#61628; &#61628; 10k
    '   p0 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9531;&#9472;&#9532;&#9472;&#9532;&#9472;&#9532;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; do
    '   p1 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9531;&#9472;&#9532;&#9472;&#9532;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; clk
    '   p2 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9531;&#9472;&#9532;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; di
    '   p3 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9531;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; cs 
    '                                              &#9492;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; irq
    '
    '&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;
    '
    '                             - +
    '   p7 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#61611;&#9472;&#9472;&#9472;&#9472;&#9472; + [noparse][[/noparse]speaker] - &#9472;&#9472;&#9472;&#9472;&#9472;&#9488; 
    '                                                                            &#61464;
    '                          47µF cap                                 GND       
    '              
    con
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      bufferlen = 800
      
    
    obj
    
      wpl : "WavePlayerSdAccess"  
    
    var
    byte ledcolor
    byte newhours
    byte blinkflip
    byte buff[noparse][[/noparse]bufferlen]
    long stack[noparse][[/noparse]300]
    byte alarmhour
    byte alarmmin
    byte alarmstat
    byte secblinker
    byte oldsec
     
    pub main | b                                            ' main program loop
    
      cognew(announcer, @stack)
    
      repeat
         announcer
         waitcnt(clkfreq+cnt)
    
    
    pub announcer | currhr, currmin, currsec                                          ' checks if esc has been hit and annouces time
    wpl.start(0, 5, 4, @buff, bufferLen)
      repeat
    
          wpl.playwave(string("morn.wav"))
          wpl.playwave(string("standard.wav"))
          playhours(14)
          playmins(21)           
          playsecs(41)
    
          
    pri playhours(hrs)                                           ' announce hours
        IF (hrs <13)
          playnumber(hrs)
        ELSE
          playnumber(hrs -12)
    
    pri playmins(minns)                                            ' announce minutes
    IF (minns == 0)
      wpl.playwave(string("exact.wav"))
    else
      IF (minns < 10)
        playnumber(0)
      playnumber(minns)
    wpl.playwave(string("and.wav"))
    
    
    pri playsecs(secs)                                            ' announce seconds
        playnumber(secs)
        wpl.playwave(string("secs.wav"))
        wpl.playwave(string("beep.wav"))
              
    pri playnumber(number)  | tendig, onedig                ' generic routine to announce numbers
    if (number < 20)
      player(number)
    ELSE
      tendig := number / 10
      tendig := tendig *10
      onedig := number - tendig
      player(tendig)
      IF (onedig <> 0)
        player(onedig)
    
    pri player(number) | i
    IF (number < 20)
      wpl.playwave(@shortfiles[noparse][[/noparse]7 * number])
    ELSE
      i := number / 10
      wpl.playwave(@longfiles[noparse][[/noparse]7 * i])
                    
    
    
    DAT
    shortfiles byte         "00.wav",0,"01.wav",0,"02.wav",0,"03.wav",0,"04.wav",0,"05.wav",0,"06.wav",0,"07.wav",0,"08.wav",0,"09.wav",0,"10.wav",0,"11.wav",0,"12.wav",0,"13.wav",0,"14.wav",0,"15.wav",0,"16.wav",0,"17.wav",0,"18.wav",0,"19.wav",0
    longfiles byte          "00.wav",0,"10.wav",0,"20.wav",0,"30.wav",0,"40.wav",0,"50.wav",0                        
    
    
    
    
  • shmowshmow Posts: 109
    edited 2010-07-06 13:55
    must be the heat wave here...
    here's a better version:

    '
    '
    '  Propeller Pins                  SD card Pins
    '                   3.3v
    '                 &#61463; &#61463; &#61463; &#61463; &#61463; 
    '                 &#61628; &#61628; &#61628; &#61628; &#61628; 10k
    '   p0 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9531;&#9472;&#9532;&#9472;&#9532;&#9472;&#9532;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; do
    '   p1 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9531;&#9472;&#9532;&#9472;&#9532;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; clk
    '   p2 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9531;&#9472;&#9532;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; di
    '   p3 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9531;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; cs 
    '                         &#9492;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; irq
    '
    '&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;
    '
    '                - +
    '   p7 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#61611;&#9472;&#9472;&#9472;&#9472;&#9472; + [noparse][[/noparse]speaker] - &#9472;&#9472;&#9472;&#9472;&#9472;&#9488; 
    '                                           &#61464;
    '             47µF cap                     GND       
    '              
    con
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      bufferlen = 800
      
    
    obj
    
      wpl : "WavePlayerSdAccess"  
    
    var
    byte ledcolor
    byte newhours
    byte blinkflip
    byte buff[noparse][[/noparse]bufferlen]
    long stack[noparse][[/noparse]300]
    byte alarmhour
    byte alarmmin
    byte alarmstat
    byte secblinker
    byte oldsec
     
    pub main | b                                            ' main program loop
    
      cognew(announcer, @stack)
    
      repeat
         announcer
         waitcnt(clkfreq+cnt)
    
    
    pub announcer | currhr, currmin, currsec                                          ' checks if esc has been hit and annouces time
    wpl.start(0, 5, 4, @buff, bufferLen)
      repeat
    
          wpl.playwave(string("morn.wav"))
          wpl.playwave(string("standard.wav"))
          playhours(14)
          playmins(21)           
          playsecs(41)
    
          
    pri playhours(hrs)                                           ' announce hours
        IF (hrs <13)
          playnumber(hrs)
        ELSE
          playnumber(hrs -12)
    
    pri playmins(minns)                                            ' announce minutes
    IF (minns == 0)
      wpl.playwave(string("exact.wav"))
    else
      IF (minns < 10)
        playnumber(0)
      playnumber(minns)
    wpl.playwave(string("and.wav"))
    
    
    pri playsecs(secs)                                            ' announce seconds
        playnumber(secs)
        wpl.playwave(string("secs.wav"))
        wpl.playwave(string("beep.wav"))
              
    pri playnumber(number)  | tendig, onedig                ' generic routine to announce numbers
    if (number < 20)
      player(number)
    ELSE
      tendig := number / 10
      tendig := tendig *10
      onedig := number - tendig
      player(tendig)
      IF (onedig <> 0)
        player(onedig)
    
    pri player(number) | i
    IF (number < 20)
      wpl.playwave(@shortfiles[noparse][[/noparse]7 * number])
    ELSE
      i := number / 10
      wpl.playwave(@longfiles[noparse][[/noparse]7 * i])
                    
    
    
    DAT
    shortfiles byte         "00.wav",0,"01.wav",0,"02.wav",0,"03.wav",0,"04.wav",0,"05.wav",0,"06.wav",0,"07.wav",0,"08.wav",0,"09.wav",0,"10.wav",0,"11.wav",0,"12.wav",0,"13.wav",0,"14.wav",0,"15.wav",0,"16.wav",0,"17.wav",0,"18.wav",0,"19.wav",0
    longfiles byte          "00.wav",0,"10.wav",0,"20.wav",0,"30.wav",0,"40.wav",0,"50.wav",0                        
    
    
    
    
  • shmowshmow Posts: 109
    edited 2010-07-06 14:00
    OBC,
    thanks I'm all over it like stink on a skunk.
    Shmow
  • shmowshmow Posts: 109
    edited 2010-07-06 14:05
    OBC,
    what is PST? Can I use hyper terminal instead?
    Shmow
  • shmowshmow Posts: 109
    edited 2010-07-06 14:17
    Yes, I'm using hyper terminal.
    Thanks a'plenty.
  • LeonLeon Posts: 7,620
    edited 2010-07-06 14:18
    It's the Parallax terminal program, it's a lot better than HyperTerminal. You can download it from the Parallax web site (Propeller Downloads).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • shmowshmow Posts: 109
    edited 2010-07-06 14:21
    Thanks Leon.
  • shmowshmow Posts: 109
    edited 2010-07-06 14:36
    I have the PST connected.
    After running a test, it states that: "SD card expected..."
    I know this card works because I've used a separate card reader on it successfully.
    I've checked the connections of the pins and they are correct and true.
    Could I have damaged the SD card adapter while soldering it together - specifically the card reader?
  • RaymanRayman Posts: 14,889
    edited 2010-07-06 15:16
    Are you trying to drive a speaker directly from a Prop pin?
    You are using amplified speakers, right?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Apps:· http://www.rayslogic.com/propeller/Programming/Programming.htm

    My Prop Info: ·http://www.rayslogic.com/propeller/propeller.htm
    My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
  • RaymanRayman Posts: 14,889
    edited 2010-07-06 15:17
    PS: I have some wave players in OBEX you might try. One of them doesn't need the SD card...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Apps:· http://www.rayslogic.com/propeller/Programming/Programming.htm

    My Prop Info: ·http://www.rayslogic.com/propeller/propeller.htm
    My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
  • shmowshmow Posts: 109
    edited 2010-07-06 16:02
    Hey Rayman,
    ultimately, the file will be fed to a "line out" of an amplifier.
    Currently, I have an emic, and I want to replace it with the SD/WAV design.
    That's great for the offer! I do want to keep the SD option.
    It looks like I'd use your sysdep_demo_ser.spin.
    Regards,
    Shmow
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-06 16:09
    shmow said...
    I have the PST connected.
    After running a test, it states that: "SD card expected..."
    I know this card works because I've used a separate card reader on it successfully.
    I've checked the connections of the pins and they are correct and true.
    Could I have damaged the SD card adapter while soldering it together - specifically the card reader?

    Anything is possible.. Which card reader are you using?

    The "SD card expected..." message means that the card failed to mount. double check pins settings in the CON section.

    Just for giggles.. Have you tried a different card?

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
  • shmowshmow Posts: 109
    edited 2010-07-06 16:12
    Yes on both counts - checked the con settings and used another card.
    This hill is getting steeper, but I bet the view will be worth it.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-06 16:15
    Yes, conquering SD is truly worthwhile..

    You didn't answer which SD interface you were using..

    Any chance that you have a spare molex (or equiv) SD connector you could wire up?
    I've manged to run many SD setups without the pull-up resistors with simply the four required wires
    directly from the Propeller to the SD card. Follow the example given in page 5 of the Cookbook link I gave you earlier.

    The only problem I've ever run into was a Sparkfun SD/pcb that I ordered earily on, once I shifted to other options
    SD has been smooth sailing.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
  • shmowshmow Posts: 109
    edited 2010-07-06 16:22
    the reader is the one which came with the parallax SD Card Adapter (product #32313)
    it's the 3M product.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-06 16:29
    Time to whip out a meter and check the connections.

    I'd check from the rear of the card to the pin. Don't worry about CD and WP at this point.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
  • shmowshmow Posts: 109
    edited 2010-07-06 16:34
    I've done that - I'm beginning to think I cooked the reader.
    I used a hot air solder to make the connections and there was some damage on the sides where the two large "feet" are to solder.
    I figured it was just cosmetic; perhaps I'm mistaken.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-06 16:43
    Ouch!

    Time to whip out four paperclips and a piece of perf-board..

    Someone unfolded the paper clips to one bend, inserted them through some perfboard and soldered to the back side.
    Slid the SD card between the perfboard and the paperclips.. If I can find the photo you'll get a chuckle.

    It really isn't much more than four I/O connections and Vss/Vdd

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
  • shmowshmow Posts: 109
    edited 2010-07-06 16:44
    on the reader, I checked the isolation of between the GND pin and the CD pin.
    There's a short there (or they're connected for a reason).
    Those two pins are the small pair right on the end.
    Should I isolate them?
  • shmowshmow Posts: 109
    edited 2010-07-06 16:48
    It's the little, tin guard or fender between the GND and CD; I've soldered the fender to CD.
  • shmowshmow Posts: 109
    edited 2010-07-06 17:27
    I have the reader working!!!
    The problem was the card?!!
    I pulled another card from my camera and used it.
    Prior to that I was using a pair of cards that have been
    sitting in my desk for years.
    Now the next step is to get my sample code to work.
    'Cause I'm getting no sound or anything.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-06 18:47
    Most Excellent!

    Fall back to Rayman's WAV player code from OBEX. (I think he gave you a link somewhere in this thread.)

    That'll help you sort out the other side of the issue.. [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
  • shmowshmow Posts: 109
    edited 2010-07-06 20:50
    Hey All,
    now that I have some kind of communication between the prop and the SD reader,
    I'm trying to get the prop to send the WAV. file (MORN.WAV) to the little speaker.
    I've looked at several examples and I've had no luck.
    My oscilloscope shows there is a signal going out to the speaker from pin 7, but nothing is heard.
    Does anyone have any suggestions?
    Regards,
    Shmow

    
    '
    '
    '  Propeller Pins                  SD card Pins
    '                     3.3v
    '                       &#61463; &#61463; &#61463; &#61463;  
    '                 &#61628; &#61628; &#61628; 10k
    '   p0 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9531;&#9472;&#9532;&#9472;&#9532;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; do
    '   p1 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9531;&#9472;&#9532;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; clk
    '   p2 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9531;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; di
    '   p3 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9531;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472; cs 
    
    '
    '&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;
    '
    '                - +
    '   p7 &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#61611;&#9472;&#9472;&#9472;&#9472;&#9472; + [noparse][[/noparse]speaker] - &#9472;&#9472;&#9472;&#9472;&#9472;&#9488; 
    '                                           &#61464;
    '             47µF cap                     GND       
    '              
    con
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      bufferlen = 800
      
    
    obj
    
      wpl : "WavePlayerSdAccess"  
    
    var
    
    byte buff[noparse][[/noparse]bufferlen]
    long stack[noparse][[/noparse]300]
    
    pub main | b                                            ' main program loop
    
      cognew(announcer, @stack)
    
      repeat
         announcer
         waitcnt(clkfreq*4+cnt)
    
    
    pub announcer | currhr, currmin, currsec                                          ' checks if esc has been hit and annouces time
    
    wpl.start(0, 7, 7, @buff, bufferLen)
    
          wpl.playwave(string("morn.wav"))
    
          playsecs(41)
    
          
    
    pri playsecs(secs)                                            ' announce seconds
    
        playnumber(secs)
              
    pri playnumber(number)  | tendig, onedig                ' generic routine to announce numbers
    
    if (number < 20)
      player(number)
    ELSE
      tendig := number / 10
      tendig := tendig *10
      onedig := number - tendig
      player(tendig)
      IF (onedig <> 0)
        player(onedig)
    
    DAT
    shortfiles byte         "00.wav",0,"01.wav",0,"02.wav",0,"03.wav",0,"04.wav",0,"05.wav",0,"06.wav",0,"07.wav",0,"08.wav",0,"09.wav",0,"10.wav",0,"11.wav",0,"12.wav",0,"13.wav",0,"14.wav",0,"15.wav",0,"16.wav",0,"17.wav",0,"18.wav",0,"19.wav",0
    longfiles byte          "00.wav",0,"10.wav",0,"20.wav",0,"30.wav",0,"40.wav",0,"50.wav",0                        
                              
    
    
    
    
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-06 21:38
    I see a "speaker" referenced. An amplified speaker? I doubt you'll get much signal to power anything at standard 8ohms without some help.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
Sign In or Register to comment.