-1

I have a simple audio sequencer application using javascript and HTML5. The goal of the application is to let users make a beat and save it so other people can open it up, add on to it, then re save. The issue I'm having is the save/open feature. How Do I add this? Or at least where can I start looking fro this solution?

  • 1
    What have you tried? To let others open what you save you will need a server with some form of persistence and accessibility to others. I think you can give us more and narrow your question. What's your server? – joshp Apr 22 '15 at 05:26
  • Thanks for the reply. I currently don't have a server. The app is a step sequencer (like a drum machine) I want the user to be able to save their project so other people can open it. I'm doing this for a class and thought I had a programmer hired but they won't get back to me. – Joel R Gobin Apr 22 '15 at 05:35

2 Answers2

1

If you are asking for an only-JS solution to this:

  • Opening Files

You can use the FileAPI to open the files from your users local machine, as long as its your users who are selecting the files manually(you are not digging into the file system yourself).

Here is nice demo for this functionality: http://html5demos.com/file-api

  • Saving Files

However, saving files was a W3C recommendation that got ditched so your only choice here is to allow your users to download the file. See this relevant question I made some time ago

Community
  • 1
  • 1
nicholaswmin
  • 21,686
  • 15
  • 91
  • 167
  • Thanks for the reply. I'm doing this for a class and I showcase it the 28th. I want people to be able to make a beat and save it so somebody else can open it, work on it, and save again. The end result will be a beat made by several people. I thought I had a programmer hired but i dont think she can do it, now im stuck. – Joel R Gobin Apr 22 '15 at 05:49
0

If I were doing this for a class or prototype I might use PUT or POST requests to save the beat sequence in json form to a web server. When it's time to save your work, take your beat sequence data, convert from a js (I presume) object to a json string and PUT it to an appropriate url on your server. Give it a name and use the name in the url path, like "myserver.com/beats/jpbeat1.json".

When you want to retrieve that beat, issue an HTTP get to the url you saved. You can, of course also maintain and rewrite a directory page in json or html, or you can just navigate the directory offered by your web server. Most developers will think this crude, I imagine, but in a race for time, crude can be good if it meets the requirements.

Choose a web server, the easiest one for you. I might use Amazon S3. Costs money, but available to the internet, has authentication, security features, and supports http GET, PUT of static files. There are many other site hosting services.

For a local install, I might use Node.js. Also very easy to set up to serve static content. For example, the Express framework has static content service and easy examples how to set it up if you are comfortable with Javascript. With Node, you can make the site a bit fancier, by writing server side code to maintain an index, for example. Any real world implementation would require at least some server side code.

There are many other choices. Most developers would want a database, but you don't have to have one if simple files are ok for your class project. It all depends on your requirements.

I hope those ideas are helpful.

joshp
  • 1,886
  • 2
  • 20
  • 28
  • Awesome! Thanks Josh. I will go through your post and see what I can do. I will keep you updated with my progress if you dont mind. thanks again – Joel R Gobin Apr 22 '15 at 07:09
  • Do you have an example of what the code might be look like? – Joel R Gobin Apr 22 '15 at 08:07
  • 1
    No. Your question is general. I gave a general answer. I gave some suggestions, but you have to choose what tools and approach to use. If you make a decision and still have problems, you can ask another question about the specifics. – joshp Apr 23 '15 at 03:31