Playing Music
Android
Posts: 82
So I already get the piezospeaker and how to do that, but was wondering if there's an easy way to directly upload lets say an itunes song to the propeller and have it play through whatever is hooked up to the earphone jack. Thanks in advance!
-Android
-Android
Comments
First, you can use the Propeller itself to create reasonable .wav file playback. It won't be "music listening" quality, but is reasonable enough for simple audio playback and only requires the Propeller and a connected SD card. (One of these players can be found here: http://forums.parallax.com/showthread.php/99726-Ray-s-ASM-Wav-Player)
Secondly, you can incorporate an outside MP3, (or cheaper .OGG) playback chip/circuit which would connect and be controlled by the Propeller.
(An example of this can be found here: http://www.instructables.com/id/Building-an-OGG-Player-using-the-Pocket-Mini-Comp/)
Jeff
How do I use the WAV file player do you just attach SD card with the music on it? Does the propeller have a port for SD?
Not a port as such. An SD card needs 4 pins connected and you just connect those to 4 pins on the propeller, then in software tell the program which 4 pins you chose. For hardware you will need an SD socket, and four 10k resistors. For the audio side, you need one headphone socket, two capacitors and two resistors. Pick two propeller pins for audio output and then tell the software which two pins you chose.
There is code around to read .wav files and to play them. It is pretty easy to convert .mp3 to .wav - lots of free converters on the internet including some online ones.
The code you will need to write is only a few lines, as most of the work is already done.
Ok, how I do it is I buy SD sockets on ebay at a good price, and then I measure up the spacing on the socket, design my own part on Eagle PCB and get a board made. I like to use the large SD sockets as they are easier to solder. Once you have a propeller chip running with the regulated supply etc, total cost to get music playing might be a dollar or so for the SD socket, and maybe 50c for the resistors and capacitors.
But... there are much simpler ways than that. eg premade SD boards http://www.futurlec.com/Mini_SC.shtml and there are cheaper ones on ebay if you look around. They bring out the SD pins to header pins and you can fit a board like that into a Breadboard http://www.futurlec.com/Breadboards.shtml along with the propeller chip and then you don't need to do any soldering.
BTW re sound quality, if you start off with a good .mp3 file and use decent headphones, it sounds very good.
Even better, there may well be premade boards around that have an SD socket and the audio components. Others should chime in soon with advice. http://www.parallax.com/Store/Microcontrollers/PropellerDevelopmentBoards/tabid/514/List/0/CategoryID/73/Level/a/SortField/0/Default.aspx
As a general question, at what level would your electronics skills be?
Off to the parallax store to rummage around...
All the hardware is already done - it has audio out and an SD socket, plus lots of other goodies.
Ok, it is $129, but you don't need to solder anything.
Or at the other extreme - buy an individual propeller chip for $8, and have fun soldering or using a breadboard. You could do this with another $3 worth of components.
If you already have a BOE, then this might just be a software problem...
BOE has a stereo socket and an SD card. Let's check the schematic....
I need to find the schematic. The .jpg photo is a bit blurry but I think the SD is pins 22-25 and the audio out is 26 and 27. So those values will go into the program. I'd like to double check that though.
Re software, I think there is something in the obex written by Kye that does almost everything you want.
Looks like audio is P26 and 27 so that will be easy.
SD is CS=25, MOSI is 24 (DI), CLK is 23 and MISO (DO) is 22.
Ok, hardware all sorted. Now for software...
http://obex.parallax.com/objects/567/
I can't believe one of use hasn't done a step-by-step for this yet. (Just added to my list)
Jeff
Take a look at this wav player - has the SD card and the wav player as part of the same package http://obex.parallax.com/objects/567/
ok so change the dopin from 0 to 22, clk pin from 1 to 23, di pin from 2 to 24 and cs pin from 3 to 25. Make cdpin and wppin both -1 as they are not used.
Change the audio pins from 10 to 26, and 11 to 27.
The default filename to play is "wav.wav" so find any .wav file, rename it to that and put it on the sd card. If that works, have fun converting other .mp3 files to .wav and playing them
Jeff
Then choose, File and Export to save them at Microsoft 16bit PCM format.
Jeff
I've had professional music teachers comment on how good the quality is.
Search for online mp3 wav will find various online converters. Just copy the resulting .wav to the sd card.
I'd be interested to hear how our original poster is going.
Jeff
Besides writing a nice wav player, Kye also wrote a wav recorder. I'm off to find a link. I'll edit this post when I find it. (I bet I have it listed in my index somewhere.) Here it is (it was listed in post #5 of my index).
So, if you wanted really poor quality music, record the music directly with the PropBOE. I'd be surprised if this sounded any good though. I think the record feature is better used with normal human speech.
BTW, There are lots of other ways of playing music with a Propeller. Ahle2 has some cool retro music players. I think Jeff has some tutorials on using his stuff. The Propeller can also play MIDI files. A lot of digital pianos will output MIDI files from the notes played on it. There are lots of songs which have been converted to MIDI. I wont go into the advantages of MIDI here but it allows songs to be captured with very little memory.
You might want to take a look at the Scribbler 2's GUI. I use it generate sounds to be played back on the Propeller later. It also has a lot of nice beeps an other robot noises. It might take a bit of figuring to know how to play them back on a Propeller other the S2's built in sound circuit, but I don't think it would be very hard.
http://forums.parallax.com/showthread.php/140767-A-new-topic-for-vga-%28not-only%29-sid-player?highlight=propplay
Compile this with BST/unused method removal, else it doesn't fit in 32k...