Hello everyone! I am very new to all of this, and wish badly for anyone to be kind enough and give me some expert advice on this matter.
In five hours I wish to accomplish the following:
I would like to create the code necessary for an arduino switch installation that does the following:
Have four switches. Each switch enable/disable one of four sound samples each. These sounds loop to infinity.
I wish to know what components to use, and functions I need to use, and also if there is a way to test your code without having an actual arduino board at the moment.
As a thank you, I'll update this thread with my findings, and make it an available case for the community.
PS: I've been googling about arduino emulators/simulators, and I've found software that constantly breaks.
I do know programming..
None of these threads describe how to play a file one has, like if I wanted to play a wave or midi or something..
Maybe I library does that? I'll keep looking.
Do you have to purchase a board and components every time you have an idea you want to execute?
Is there simply no way to work on the program without having to purchase the hardware first?
oh you could do it in software only, but its going to be a royal ....
here is the basic idea
the arduino can really only have 2 states on a pin, on or off, a speaker is a analog device it can be anywhere tween fully out and fully at rest SO, what you would need to do is get your sounds, 8 bit, 11khz at best, chop off the wav file header and store it in rom (see progmem in the reference) these are going to need to be extremely short due to the limited space
next your going to need a carrier, something that keeps the speaker about in mid flux so plan on generating ~22khz or so, or else your going to hear a high pitched squeak, but not so fast or slow that the sound is going to be played back too fast or slow .. or at all
then your going to need to write up a software DAC, 4-8 bit to convert the data from binary form to an analog value and have that output as PWM on your carrier all while not using every single ounce of power in the chip
not impossible but not exactly a "going to whip it out in 5 hours" type of deal, especially if you have never reproduced audio on this low of a level on this limited hardware
good luck
and no if you think your going to use hardware there is nothing stopping you from going ahead and writing software, though you wont fully know if its working until everything is in place
Mossa:
Is there simply no way to work on the program without having to purchase the hardware first?
What your trying todo is not simple so extra hardware is needed to manage the complexity.
If you want some simple beeps or buzzs then you don't need extra hardware.
The memory space on an Arduino Uno is 32kB -0.5kB for boot loader.
Your program could easily take up 20kb, so you would only have 10kB for samples.
A raw 8bit audio sample running at 8kbps means you have space for 10 seconds.
So your 4 samples can not exceed that 10sec limit.