Skip to content

Creating a Pack

Mark Hughes edited this page Jan 25, 2015 · 2 revisions

Creating a Pack

Creating a pack is fairly simple but a few rules must be followed for it to be verified.

Rules

  1. Do not include any scripts that alter the design of the Music Mixer, this could causes issues with it in future updates.
  2. Ensure you own the music used, consider releasing it under the appropriate license (see Licenses)
  3. Stick to appropriate times. Anything under 2 seconds will automatically be restricted to a 2 second time slot. Anything between 8-10 seconds will automatically be restricted to 10 seconds time slots. The other available timeslot is 4 seconds.

Licenses

You should consider releasing your packs and the music included under a ShareAlike license. Try one of these:

Creating your sounds

Please try to stick to the standard of 2 seconds, 4 seconds, and 8 - 10 second samples (rounds to 10).

Try to keep the file size as low as possible. If these are put online, remember that the user will be downloading ALL sounds from ALL packs when they load the mixer - if they're too big, people will be discouraged from having them.

Folder Layout

Firstly, think of a unique name for your pack. For example "Awesome Beats by Markeh" - this will be unique, and wont conflict with other packs. Now we need to create a unique folder and script name. We'll go with "awesomebeats_markeh" so now we have the pack name (Awesome Beats by Markeh), and a pack identifier (awesomebeats_markeh).

The pack identifier will be used for the pack's folder, and the packs main script.

So you'll need to setup the folder for the pack, a folder inside the pack for the sounds, and a file inside the pack for the script.

/musicmixer/packs/awesomebeats_markeh/

/musicmixer/packs/awesomebeats_markeh/sounds/

/musicmixer/packs/awesomebeats_markeh/awesomebeats_markeh.js

Sound Files

Your sound files also need to be uniquely named. It's best to start them with your pack identifier.

For example, I have two sound files - beat1.mp3 and beat2.mp3. So I will rename them to awesomebeats_markeh_beat1.mp3 and awesomebeats_markeh_beat2.mp3.

Then I will place them into the sounds folder I created.

Script File

So using a plain text editor you edit the javascript file. Mine is called awesomebeats_markeh.js.

Here is what mine looks like

var pack = "Awesome Beats by Markeh";

Packs.setSoundPath(pack, "packs/awesomebeats_markeh/sounds/");

Packs.addSound({
	pack_id: pack,
	label: "Cool Beat",
	file: "awesomebeats_markeh_beat1.mp3",
	icon: "packs/awesomebeats_markeh/icons/beat.png"
});

Packs.addSound({
	pack_id: pack,
	label: "Funky Beat",
	file: "awesomebeats_markeh_beat2.mp3",
	icon: "packs/awesomebeats_markeh/icons/beat.png"
});

This is written in Javascript, so having a little Javascript experience will help here.

The first line var pack = "Awesome Beats by Markeh"; sets the name of the pack, change inside the quotation what you want to set your pack name to. You will see the word pack throughout this script. This is where we are setting this variable.

Next you will see Packs.setSoundPath(pack, "packs/awesomebeats_markeh/sounds/"); this is the path to where your sounds are, typically they'll be in packs/PACK ID/sounds/. Change the path as required.

Next we have addSound blocks. These are what adds each individual sound into the engine. You can copy and paste these blocks as you need. The label is what is shown to the user, this does not have to be unqiue. The file name is the name of the file we're working with, do not give a full path, but only the full file name.

In regards to 'icon' it is currently not used - but it will be used to show an icon next to your sample. It is not required however.

Now install the pack appropriately. Test it.

My pack isn't working!

Let's start with staying calm, if this is your first time with Javascript coding then you may run into issues.

Open up your Javascript console (Google chrome users: ctr/command + alt + shift + i), and see if you can match it to one of these:

- Failed to load resource: net::ERR_FILE_NOT_FOUND / File Not Found / 404 Error

This means that it couldn't find the sound file. Check over your pack script, your folder name, and the setSoundPath variables.

- Uncaught SyntaxError: Unexpected token ILLEGAL / Unexpected End Of Line

This is a scripting error, you have most likely broken the quotation of an addSound function. Ensure each line has quotations around it, and after the last quotation it should have a comma.

- It's none of the above

Open an Issue ticket and I'll help you through it.