play audio files when they appear in a folder
Hi, I am pretty new to Max/msp, and want to know what the best way to create a simple automated player would be.
I want Max to automatically play an audio file once when it is transfered into a folder.
I want to have max sitting on a server computer hooked up to a DAC/ADC and have audio simultaneously playback and record through an analog device.
So, I have the server setup so a client can upload a file via PHP into a /Upload folder onto the server. I want Max to be watching that folder for any new audio files and to automatically play it and record that playback into a new file in a /Download folder.
The output file can be named something else. It can even be named the same file and overwrite the previous one.
I already have the basics setup with an sfplay and sfrecord object triggered by a Toggle Object. I just need to be able to trigger them by a file appearing, and have Max play that new file.
I can create a PHP script to rename each incoming file to a sequential number or date and time if that makes it easier. I can even have it renamed to the same name and continually overwrite the last uploaded file.
So, what would be the best way to do this?
Basically in simplest terms I need Max to automatically play an audio file (.wav) as soon as it appears in a folder.
Thank you for any help.
you could hook a metro up to the folder object, then look for changes.
sorry, I am definitely going to try and look into this but could you please elaborate? I am a little new to Max.
thanks
Just copy this, open a new max patch, and paste. Should help you out.
I highly recommend doing the first few tutorials. You should learn about the metro object, and bangs.
Good luck!
thanks!
I am using Max 4.5... kinda outdated I know.
Do I need to get 5 in order to paste that?
here is a quick setup that should get you started... the code is Max 5, sorry, but I will also attach a pic so you can see the patch and reproduce if you like...
In short, what should happen is the following: you designate a folder to be watched (in this case only look for AIFF and WAVE files). The original contents of the folder is recorded. If you add an item to the folder the patch compares the original content to the new content and outputs the path and name of the added file.
It's only a quick example and not perfect. There are things that need to be worked out, but it should give a good idea of what is possible.
Thanks so much everyone! I can't believe how much help I am receiving. Much Appreciated.
I will check this out today.
I've downloaded the trial of Max 5, and then will just emulate the end results as best as possible in 4.5
I can get a copy of 5 from my school for pretty cheap, so I might purchase it as well.
Thanks again.