play wav file from SD card
shmow
Posts: 109
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
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
Comments
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
this PropDOS, what application do I open it with? I've discovered it's not Propeller Tool.
Shmow
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.
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 ]
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.
I trust this is better.
here's a better version:
thanks I'm all over it like stink on a skunk.
Shmow
what is PST? Can I use hyper terminal instead?
Shmow
Thanks a'plenty.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Leon Heller
Amateur radio callsign: G1HSM
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?
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
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
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
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.
This hill is getting steeper, but I bet the view will be worth it.
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.
it's the 3M product.
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.
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.
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.
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?
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.
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.
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
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Feature Projects: PropellerPowered.com
Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.