P2 eval board, Audio module, Sound examples
cfox
Posts: 16
Hi all!
I finally have the time to get into P2 programming, and the place I'd really like to start is audio programming. There are some audio demos in the object repo, and I have the audio expansion board that goes with the P2 eval board.
I wanted to try the reSound demos using the audio board, but I don't know which of the inputs I should plug the board into, or what to change in the source code to deal with whichever connector I've chosen. Is there some handy macro, or lookup able or something? How do you know which input to connect to?
The docs also don't talk about where the mod file needs to go - on the SD card I presume? In the root?
Any help would be greatly appreciated!
Comments
Please link/attach to webpage/files.
Hi cfox,
Try the simpleSound engine demos for something easy to just get going. It's called "simple" for a reason...
Notes:
* clkfreq can be anything you like, the sound engine will automatically adapt to anything while trying to maximize the output mixing rate.
* The module is loaded into the binary before downloading to the target.
* Module + code can never exceed the 512k RAM limit on the P2
/Johannes
So for the music file - where do I put that? On a SD card, or is it loaded through the propeller tool?
Put it in the same directory as main.spin2. It gets compiled into the binary along with the code.
Ok - I followed your instructions> @Ahle2 said:
Hi Ahle2!
Ok, did this. Now, one thing I'd like to make sure I have correct -- I attached the AV module to one of the sets of pins, the one marked "V3239", which seems to indicate the set of pins that it encompases.
And according to the A/V module schematic I downloaded, the left pin (INL) is IO+8, and the right pin (INR) is IO+7, so I defined:
LEFT_PIN = 32+8
RIGHT_PIN = 32+7
Also before I go on, at the bottom of the A/V schematic is an orange note saying: "Recommend: Always set VIO jumper to LDO on P2-EVAL when working with Audio!" -- except that I can't find any jumper labelled "VIO". There is a jumper labelled LDO VIN 5V that is current set. Is this the one it's talking about? Sorry if this is a supid question, but I just don't see anything else.
I loaded the simpleSound(Beta2)_examples/simpleSound(beta)_example1_just_music/main.spin2 and RUN->Compile Current->Load RAM
It compiled without error (currently set to play axel_f, which is fine), but I don't hear anything coming through the headphone port.
Are my pin assumptions incorrect? Or is the VIO jumper thing the issue and I did it incorrectly? I don't even know how to debug the issue
Thanks!
Part of the problem may be here:
LEFT_PIN = 32+8
RIGHT_PIN = 32+7
Change that to l:
LEFT_PIN = 32+7
RIGHT_PIN = 32+6
By my math, 32+8=40, which would be the first pin in the next pin group.
You've got the correct jumper. That notice was for the RevA Eval Board - It had a two-position jumper for each group of eight I/O.
Yeah - when I zoomed into the diagram, what I took for a IO+8 clearly became an IO+6. My bad!
After the pin correction above, it's all working now! Fantastic! Thanks everyone!
Just for the record - there were two problems. First problem was that I had the LEFT_PIN defined as 32+8 instead of 32+6, so it wouldn't have played. The right pin was correctly declared, but I also didn't have the headphone plug connected all the way in - I stopped at the first real resistance, but there was still one more "click" to go in engaging the other speaker. If I had pushed it all the way in before I would have heard music from at least one speaker, but because it wasn't all the way in, only one speaker was engaged, but that wasn't playing because of the pin problem. So I heard nothing at all.
Anyway - now I feel much more comfortable about progressing. Thanks again!