Wav Player help needed
NWCCTV
Posts: 3,629
I am totally lost here. I downloaded the OBEX WaveplaerV4_1. I have the pins set correctly to the BOE Board. I have my ear buds plugged in but when I run the program no the chimes.wav file which is on the SD card does not play. I am new to Spin and do not understand what I am doing wrong. Any help is appreciated.
Example of waveplayer usage con _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 bufferLen = 800 obj ser : "FullDuplexSerial" wpl : "WavePlayerSdAccess" var byte buff[bufferLen] long stack[50] pub main | sdBasePin, HeadphoneRightPin, HeadphoneLeftPin ser.start(31,30,0,19200) 'wait for any input from terminal 'ser.rx 'change values to match your setup sdBasePin := 22 HeadphoneRightPin := 27 HeadphoneLeftPin := 26 wpl.start(sdBasePin, HeadphoneRightPin, HeadphoneLeftPin, @buff, bufferLen) 'not nessesary if background playing isn't needed(only uses extra cog while playing) wpl.setStack(@stack) ser.str(string("Wave Player example", 13)) 'replace "winst.wav" with any wav on your sd card wpl.playbgwave(string("chimes.wav")) 'possibly anoying but pause and unpause wave playing in background repeat while wpl.bgisPlaying waitcnt(cnt + 20_000_000) 'wpl.togglebgPause 'play wave again using current cog wpl.playwave(string("chimes.wav"))
Comments
WavPlayer2g - Archive [Date 2013.03.04 Time 20.55].zip
I've recently realized that the one I posted in OBEX could be improved...
I think this version is a bit easier to use.
I've heard that Kye's is good too.
It should tell you the status over serial link too...
Edit: I got it. Thanks, this works great. Is there any way to change to different files if there are multiple files on the card?
Also, Any idea on how to convert 24 bit wav files to 16 bit?
ARayman, How do I call the Playwav routine? Is that done within the program or on the Serial terminal? I new to Spin so forgive my ignorance.
The demo just plays one file with this line:
If you want to play three files, one after the other, just add a couple copies:
(change the filenames to what you want...)
What is the file size limit, if any?
I have the Serial Terminal open and enabled but nothing comes up in it.
Edit: Oops, I thought you were talking about the files not playing.
Sure, PM me your email address.
BTW: wav needs to be 16-bit PCM with no compression
I only took a quick look at Rayman's latest player.
The wave sample is indeed 32 bits, not 16.
Even thought the warning about only supporting 16 bit files is still there in the PlayWav function.
'open the WAV file (NOTE: Only plays stereo, 16-bit PCM WAV Files !!!!!!!!!!!!!)
Ray? Zup bud?
Not all converters are created equal.
Download and use Audacity.
I had similar problems when I fist started playing with wavs.
It is getting stuck looking for "data". I was assuming that this marker would be long aligned, but it's not in this case.
So, I'm going to have to change the code to look at it more as a byte stream...
Should have something this morning to try.
Each of the sound samples is 16 bits. But if it's stereo, somebody might call it 32 bits...
The code actually checks the header now to make sure it's 16 bit...
WavPlayer2h - Archive [Date 2013.03.09 Time 10.08].zip
It gets stuck here.
Playing wav file...
Attempting to mountSD card
........................................................
.
Edit: Note, This is happening on files that were playing correctly in revision "g".
Please check the SD pin settings and reinsert the SD card.
Not sure what else..
Problem solved, so I have not done any more investigation.
Erlend
NWCCTV, you don't really have a wav playback probelm now, it's an SD card mounting problem.
Please triple check that these settings are the same in this version and the one that works:
If so, then something wierd is going on... Please quit the Prop Tool extract the zip file to a new folder, then open the wav player in a fresh Prop Tool and try again...