Embed song in HTML w/o file - javascript

I'm designing a mini game that would be generated with HTML and JS on smartphone.
It would be offline and won't be able to access any files.
So I was wondering how to embed a basic music in it and some sound design.
I see 2 options :
Make a sound generator with JS, and design a sound that could play this generator (something like this link)
Convert a low-fi mp3/ogg or other to base64 and add it directly in the HTML (src="data:audio/mp3;base64...")
The first method must be the lighter but could be difficult at the moment to design the song. And maybe not that light for the hardware?
The second method would be the easier to work with but because of the amount of data I don't know if it's a good option.
Any suggestions for one of those methods? Or maybe you have a better idea?

The game will probably need to be distributed to the phones somehow, so you should be able to incorporate not just HTML and JS into the distribution package, but also other asset files - like images and sound files. If that's the case, there's no need to try to embed the music into the HTML (option 2). Just ship an MP3 file with the music that you want to play as a part of that package.

Related

How to play MP3 in GUI using PyQT

I wanted to create a simple GUI app which selects one of the MP3 files and plays it. Can't seem to find the best library for doing that with PyQT. Therefore need some recommendation on it. Don't mind switch to JavaFX or something if it has more options.
I know GUI is probably outdated nowadays when everything is web. Would Javascript be a better choice?
try vlc module for python to play all types of audio and videos in case needed later. You should make use of the Qt example seen in examples folder when you unzip the downloaded tar file

Audio Editor in a Django App?

I'm in a little over my head with a project for a client, they want to build an audio editor that will allow the user to trim their uploaded audio files and save them. I've built the file uploader, and the detail view for the individual audio files, my question is how would this best be implemented? I've been looking at
Peaks.js
and I want to make sure thats the right way to go before diving in. Never used npm in a django project before, is it like using any other js library?
I've also been told about sox, which is great for manipulating the sound files, but what about displaying the sound to the user/editing in the browser?
Any help or general direction-pointing would be greatly appreciated and could save me a bunch of time potentially.

Implementing Javascript Video like Youtube Editor

I've been searching how to implement a web application which provide the functionality to edit videos. just like the youtube Editor. What are best and free libraries out there for building a web app like this?. A library which support react would be great!.
This might be the one you are looking for html5-videoEditor. This is more of a proof of concept than a fully functional web-application. Right now it allows you to load videos into the browser, they get automatically uploaded via WebsSocket to a node.js application, where those assets get transcoded (H264/WebM/OGG). Then you can create a composition (=new video), copy videos to the stage, trim them, transform them, stack them and then finally encode them on the server-side using AviSynth and ffmpeg Currently each encoding job will produce a H264 encoded video.

How do I store assets for javascript on the web?

Recently I have been trying to create a chat project which makes a ringing noise once you receive a message. My problem is that I cannot find a ringing noise that will be available for the project anywhere. Google drive does not work, the javascript can't process it. For some reason if I link sound from wikipedia it does work. Is there a way to upload a ringing sound which will be available to link to through javascript?
Thanks!
P.S. I'm sorry about how long this question is, congratulations if you read it & managed to understand what I'm saying :)
It creates a bit of overhead but you can use something like this to have an easy access to your audio:
http://www.createjs.com/soundjs
In a theoretical sense you would have your assets (be it soundfiles or images or what ever) loaded to the webserver you serve your page from. Normaly you will have an assets folder on there. You can then access these files by using the path to that folder on your server in your code.
HTML5 should provide functions for sound playback and such as well. Might as well start there

Is it possible to record sound playing in browser or speaker in javascript or by any scripting language?

I have used html audio tags for playing multiple mp3 file in browser. I want to know if it is possible to record these mp3's into a single mp3 file in javascript(specifically)?. Or even if any module which can help me record these playing mp3's.
Generally, no.
It is possible to work with audio in JS but probably not in the way you want. See this question for more info.
I don't know what exactly you're trying to do but it seems like you would need to do it server-side, and even that would take effort to achieve (Since you would need to find a library that could merge multiple MP3s into a single file and then serve that as a download to the user. This would also require you to know how to install such software and make it available to your server-side code).

Categories