Where does the music files, that is played in Minecraft, get stored in the latest minecraft.jar?
Just extracting the jar-file as a zip-file, doesn't reveal any audio files, only .class, .png, .txt, .lang and one .bin file for the font glyphs.
How does Minecraft encrypt the audio files?
The audio files come from here, which is just an XML file. They're not encrypted, and the client downloads them as it needs them. Don't do anything naughty, and read through the Minecraft brand guidelines, which covers third party usage of these resources.
Related
I have some .ogg sound files that must be merged together.But the problem is in that the java only support .wav extension (as I used AudioSystem and AudioInputStream).
I've searched among different pages for converting and I've not found a better way than.
Do you know a better way other than using Command line tool?
I think you may have to inspect and tinker with the source code. This can be obtained from various libraries that have JOrbis and other files needed for ogg playback and encoding (there are several on github).
For a project where I needed to load decompressed ogg files (that were originally wav) into memory, I used source code from the example OggPlayer (usually included in the package) and intercepted the bytes before they were written to a SourceDataLine. You can maybe also find a hook in example code that compresses wav to ogg and then link the two parts.
Most of the solutions tells me use the File Class, but I am planning to use the audio stored in the Java Project. If I make an .exe file, would that work when I'm using File Class?
If you are using JavaFX, there is direct support for MP3. I just discovered this page, and haven't tried using it yet. I've always used javax.sound.sampled.SourceDataLine for audio output, and added libraries as needed to deal with the compression format. There are some useful libraries on github: https://github.com/pdudits/soundlibs. Of these, I've only used the jorbis library for ogg/vorbis encoded wav files. But the mp3 decoders here have been around for a long time, have been used in countless projects, and should work.
As far as packaging audio resources, a key thing to remember is that file systems don't "see into" jar files. So, a File address is basically useless as long as the resource is packed into a jar. But a URL can specify a file that is jarred. The usual practice is to have a "resource" folder for the project that can be specified by a relative address, and to load the resource using its URL. The URL can be obtained using the .getResource method of Class
For example, if you have a class named "AudioHandler" in your project in a package loction "com.dory.mymediaplayer", and a sub folder "/res", and an mp3 file "audiocue01.mp3" in /res, the line to obtain the URL for the mp3 file would be as follows:
URL url = AudioHandler.getClass().getResource("res/audiocue01.mp3");
However, depending on the needs of the library used for decoding the mp3, you might need to use the .getResourceAsStream method. The getResourceAsStream method returns an InputStream instead of a URL.
I want to find a way to save captured picture and recorded sound in custom file-type(s) then open them in my app. I don't want to other apps could open my files (for example gallery app don't open my pictures).
Is there any way to encode and decode my files in my app for example by writing a string at end of files.
Thanks
There is no need for custom file types. If you save your files in Internal Storage, no other application can access them. You can also save files in the External Storage that are private, by calling getExternalFilesDir().
Details are here: http://developer.android.com/guide/topics/data/data-storage.html#filesInternal
Use a file extension no one else uses, then use this answer to open all such files with your app.
I have a requirement to download multiple files from server and zip them into one file. So that user will have to deal with only one file while downloading.
I need in Java/JSP code or Javascript
It's very easy.
First, allow the user to choose files (if the application requires them to do so).
Then on clicking download create a zipped file dynamically and add all chosen files. Allow the user to download this file.
I'd used Zip functions in PHP for similar functionality in the past.
You can refer Compressing and Decompressing data using Java APIs from Sun Developers Network (SDN) on Oracle website.
I want to know the version of a mp3 file format.
What should I do?
I am reading file properties with java programs
The website wotsit.org has specifications and descriptions of file formats. Wikipedia is also often a good starting point. Read MP3 on Wikipedia.
If your goal is just to read the metadata from MP3 files (track title, artist name, etc.): That information is stored in ID3 tags inside the file. There are several Java libraries available for reading ID3 tags. Google for "java id3" and you'll find them.