SPIN WAV Player
Rayman
Posts: 14,762
Ok, it only plays mono and at a fairly low sample rate of 16 ksps.
But, for SPIN, I think it's pretty impressive!
Fairly light on used resources too... (so can be included in other programs...)
I've included a few samples.
Files must be PCM WAV mono @ 16000 to play right
You'll need an SD card installed to use this...· (because it plays from the SD card)
But, for SPIN, I think it's pretty impressive!
Fairly light on used resources too... (so can be included in other programs...)
I've included a few samples.
Files must be PCM WAV mono @ 16000 to play right
You'll need an SD card installed to use this...· (because it plays from the SD card)
Comments
Oldbitcollector
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
If you already have Rockiki's SD card object in your project, this code only adds 334 longs...
File size at this rate is about 2 MB/minute...· So, a 1 GB SD card should hold 8 hours of sound.
Also, I made a few notes here:
http://www.rayslogic.com/propeller/Programming/dac/dac.htm
Post Edited (Rayman) : 11/9/2007 8:54:41 PM GMT
Looking at your code, I didn't realize doing something like this was just that simple.
Simplicity was the goal with this code. I want to include some sounds in an already bloated project, so it had to be small. Still, there are a few tricks in there that my not be so obvious...
Now I'll have to figure out how to use this (might be a nice thing to put under the Christmas tree or something).
Harrison
Post Edited (Harrison.) : 11/10/2007 1:45:17 AM GMT
beginning of the sound file now when I reduced the buffer size, but otherwise perfect!
Now I've just got to figure out the changes that the Femto version of fsrw has to place this into PropDOS.
The propeller just blows me away... [noparse]:)[/noparse]
Oldbitcollector
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
Is there any other way I can detect for the end of the wav file? I seem to be loosing it in PropDOS for some reason.
your current line is: repeat while (j==buffsize*2) 'repeat until end of file
It looks like the end is never found... Is there an alternative I can set a watchpoint for?
updated
Ah ha!
j > 0 works just fine...
Thanks
Oldbit
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
Post Edited (Oldbitcollector) : 11/10/2007 6:38:15 AM GMT
I copied the code from the above into my spin code and it works great the first time the "routine"/"method"/"sub" is called, but locks up if it is called again.
Can someone point me in the right direction here?
thanks,
Xy
Murphy's always there, just waiting for the right moment
Do you mind sharing what you did originally vs what worked?
Cheers
Sorry for the delay in my reply
I don't mind at all, simply changed over to use the COGINIT instead of the COGNEW command and specified a cog to use. Then stopped the cog after the wav file is closed. Worked from there.
I have however hit another snag, my understanding of wav playback is VERY limited and I don't see a way to adjust volume control from code. The code I am working on would really benefit from it if anyone wants to point me in the right direction.
Thanks
Otherwise you need to multiply the samples by a scaling factor...