Open audio file

Hello,

I have a project in my work and i need to open mp3 or wav audio file on my computer.

I wonder if it's possible with arduino and how does it work ( Wich function need to use )

Kind Regards

Do you have a specific Arduino board you're planning to use for the project?

I must use an arduino mega 2560

The most common way for a Mega to communicate with a computer is over the virtual serial port. There is no way to directly open an audio file using serial communication. You would need an application running on your computer that receives the serial communication from the Arduino board, and then opens the audio file. There are some existing applications that can do this. For example, I use a Windows program named EventGhost to do things like this:
http://www.eventghost.net/

You could also write your own program to do this, in the programming language of your choice.


A more simple solution would be to use keyboard emulation on an Arduino board to press a keyboard shortcut on the computer that triggers the audio file to open. Unfortunately, the ATmega2560 microcontroller on your Arduino Mega board does not have the native USB capability needed to do keyboard emulation. If you have a genuine Arduino Mega, or a faithful clone, it uses the ATmega16U2 as its USB to TTL serial adapter chip. This microcontroller does have native USB capability and can be reprogrammed to do the keyboard emulation. An example of a project that allows this is here:

However, this is a fairly advanced thing to do, and there is a possibility that if things went wrong you could end up with your Mega in a state where you can no longer upload to it.

Thanks for your help

I will try to do something. :slight_smile:

I'll mirror pert's second recommendation..

but say perhaps try to prototype/develop using a Pro-Micro instead..

Can be used as a HID device/emulator... and you dont need to mess USB/serial stuff until you are happy with what you got.. and need to port over to the required MEGA..

This equates to the same approach as having a 'keyboard' marco or something..

Questions:

Open? With what? Windows Media Player? what application on your 'computer' (PC? MAC?) will be doing the real 'playback' of the audio clip?