Jump to content
StunStick

APB Theme Assistant/Automator

Recommended Posts

Don't have a single musical bone in your body? Don't worry, neither do I. That's why I made this little program to help those of us who are musically illiterate so that we too can have themes that don't sound like complete garbage. 

Alright, I'll stop pretending to be a salesman now. Basically, I got sick of hearing people with terrible themes that seem like the player just smacked their face into their keyboard a bunch of times to make them. So, while I was bored waiting to get on the train today, I decided I'd make a little tool that makes the theme-making process easier for us tone-deaf people. I hope you find this useful.

Here's  how it works:
First, you go to https://virtualpiano.net/ and click on "Music Sheets".
Then, you find a song that you like using the little search bar at the top right and copy the "random" letters that make up the music.
From here, It's probably a good idea to go back to VirtualPiano, and clicking "Recorder" and pasting the letters into there, and clicking play to see how it sounds. It'll basically sound the exact same in APB. You can delete sections of the song in order to select the part of the song you want to make your theme out of.

Then, open up notepad, and copy and paste the following code into a new notepad document:
 

 

<style>
HTML {
background:
radial-gradient(black 15%, transparent 16%) 0 0,
radial-gradient(black 15%, transparent 16%) 8px 8px,
radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 0 1px,
radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 8px 9px;
background-color:#282828;
background-size:16px 16px;
}
input[type=text], select {
    width: 38%;
    padding: 12px 20px;
    margin: 7px 0;
    display: inline-block;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
	background-color: black;
	color: gray;
}
input[type=Button] {
    width: 4%;
    background-color: orange;
    color: white;
    padding: 12px 0px 12px;
    margin: 8px 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
	text-align: center;
}
th, td {
	width: 14px;
	height: 14px;
	border-radius 5px;
}
table {
border-radius: 5px;
border-collapse: collapse;
overflow: auto;
align: center;
vertical-align: middle;
table-layout: fixed;
width: 50em;
}
</style>

	<form align="center"><input type="text" id="inputNotes" placeholder="Notes"/>
		<input type="text" id="inputTempo" placeholder="Tempo"/>
		<input type="Button" value="Create" onclick="createTable('=')"/>
		<input type="Button" value="<" onclick="createTable('-')"/>
		<input type='text' id='counter'value='0' style = 'width:5%;text-align:center;'/>
		<input type="Button" value=">" onclick="createTable('+')"/>	</form>
	<div id="divTable"  align="center" style="overflow:auto; height:872px;border-radius: 5px;"></div>


	<script>

		cRow = 0;
		createTable();
		function NoteToggle(Note) {
								CellRow = Note.getAttribute('title');
			if (Note.getAttribute('bgcolor') == "Orange") {
					if (Note.getAttribute("id") == "Dark") {
						Note.setAttribute('bgcolor','#585858');
					}
					else {
						Note.setAttribute('bgcolor','gainsboro');
					}
					ConvNotes[CellRow-1] = ConvNotes[CellRow-1].replace(Note.getAttribute('alt'),"");
					
			}
			else {
					Note.setAttribute('bgcolor','Orange');

					ConvNotes[CellRow-1] = ConvNotes[CellRow-1].concat(Note.getAttribute('alt'));
			}
					var newString = "";
					for (z=0;z<ConvNotes.length-1;z++){
						if (ConvNotes[z].length > 1) {
							newString = newString.concat("[",ConvNotes[z],"]");
						}
						else if (ConvNotes[z].length = 1) {
						newString = newString.concat(ConvNotes[z]);
						}
						else {
						newString = newString.concat("");
						}
					}
					document.getElementById("inputNotes").value = newString;
		}
		
		
		
		function createTable(Direction) {x
		if(Direction=="=") {
			cRow = 0;
			}
		else if(Direction=='+') {
			cRow++;
			}
		else if(Direction=='-') {
			if(cRow >-1) {
			cRow = cRow-1;
			}
		else {
			}
		}
		document.getElementById('counter').value = cRow;
			if(document.getElementById("Table") == null) { 								
				}
			else {
				var element = document.getElementById("Table"); 						
				element.parentNode.removeChild(element);
			}
			
			var NotesArray = document.getElementById('inputNotes').value.split(""); 	
			ConvNotes = [];		

			var n = 0;
			var curTime = 1;

			for (n=0;n<NotesArray.length-1;n++) {
				if (NotesArray[n] != "]" && NotesArray[n] != "[") {
					ConvNotes.push(NotesArray[n])
				}
				else if (NotesArray[n] == "[") {
					var offset = 1;
					while(NotesArray[n+offset] != "]") {
						offset++;
						}
					var x = 1;
					var tempNoteArray = "";
					for (x=1;x<offset;x++)
					{
					tempNoteArray=tempNoteArray.concat(NotesArray[n+x])
					}
					ConvNotes.push(tempNoteArray);
					n=n+offset;

				}
				
			}
			var table = document.createElement('table');
				table.id = "Table";
				
			var inputs = ['m','n','B','b','V','v','C','c','x','Z','z','L','l','k','J','j','H','h','G','g','f','D','d','S','s','a','P','p','O','o','I','i','u','Y','y','T','t','r','E','e','W','w','Q','q','0','(','9','*','8','7','^','6','%','5','$','4','3','@','2','!','1'];
				table.setAttribute('border','thin');
				table.style.borderStyle = "thin dotted gray";
				table.style.borderCollapse = "Collapse";
				table.setAttribute('bgcolor','gainsboro');
				table.setAttribute('overflow','auto');
				
			var j=0;
			var i=0;
			var BlackKeys = [2,4,6,9,11,14,16,18,21,23,26,28,30,33,35,38,40,42,45,47,50,52,54,57,59];
			
			for (i=0;i<61;i++) {
				var row = table.insertRow(i);
					row.style.borderBottom = "thick gray";

				
				for (j=0;j<Math.floor(document.getElementById('inputTempo').value/3);j++){
					var cell = row.insertCell(j);
					cell.setAttribute('title',j+1);
					cell.setAttribute('alt', inputs[i]);
					tempNoteArray = "";
						cell.setAttribute('width','15px');
						cell.setAttribute('height','15px');
						cell.setAttribute('padding','0');
						cell.setAttribute('onClick','NoteToggle(this)');
						
					if(BlackKeys.indexOf(i) != -1) {
						cell.setAttribute('bgcolor','#585858');
						cell.setAttribute('id','Dark');
					}
					
					if((j-3)%4==0) {
						cell.style.borderRight = "medium solid black";

					}
					if((j-4)%4==0) {
						cell.style.borderLeft = "medium solid black";
					}
					if(j==cRow) {
						cell.style.borderLeft = "thin double orange";
						cell.style.borderRight = "thin double orange";
					}
				if (ConvNotes.length > j) {
					var curNote = ConvNotes[j].split("");
				}
				else {
					var curNote = "";
				}
					var z = 0;
					for (z=0;z<curNote.length;z++) {
					if (i==inputs.indexOf(curNote[z]))  {
						cell.setAttribute('bgColor','Orange');
						
					}
					}
				}
			}
			
			var div = document.getElementById('divTable');
			div.appendChild(table);
			
			
		}

	</script>
 
 
 
 
 
 
 

Then, save the notepad document as an HTML file somewhere that you can find it. I recommend your desktop.
Then, click on your newly created HTML document, and it should open in your browser of choice.

There are two text inputs here: One that says "Notes", and one that says "Tempo" In notes, you want to paste the letters from the song you found earlier, and in tempo, you want to type the tempo of the theme you'd like to create. Usually, this number should be between 120 and 180 or so. It's basically how fast you want the notes to be played.

Then, you click "Create Theme"

This will then generate the song in a format that should be very similar to how APB's theme editor looks.

Then, enter APB's Theme editor, and select "Acoustic Piano" (depending on the song used, this can be switched for a different type of instrument, but the acoustic piano is the best for this program)

Manually copy what was generated by the program into APB, and you're done.



Questions/Answers:

Q: Will this get me banned?
A: It shouldn't. It's just a website, it does not have any way of interacting with APB. However, the staff has the final say in this matter.

Q: Why did you use HTML for this?
A: I did not have a good way of distributing a file in any other language without people thinking it was some sort of virus, or having people download other programs to create the tool. There is literally no way a website can do anything to your computer unless you let it. This website you created with this guide does not even need any permissions to run, so I don't really think it's possible to be dangerous.

Q: Can I improve this? Why did you do it like this?
A: I'm not a professional coder, so by all means, if you know better, feel free to do edits. (You can post them here if you like)

Q: Is there a way to add percussion instruments?
A: Unfortunately, I don't know any good websites that do something similar to this website. As a result, at this point, the drums and other instruments will have to be added by hand. Sorry about that.

Q: Can I post this somewhere else?
A: I would prefer if you didn't, but I can't really stop you.

Known issues:
  • The output of the program has fewer keys then the in-game editor. This is because virtualpiano.net does not support as many notes as APB does. unfortunately, there's no way to remedy this, but this can be considered an advantage as well, as now you can set the song in whatever frequency you find more pleasing (higher or lower pitch)

Here's a picture of the program after it's run in a fairly simple song:
Capture.png

Changelog:
  1.  August 27th, 2018: Initial release.
  2.  August 28th, 2018: Updated code to account for songs with more than 2 simultaneous keypresses. updated appearance for a more sleek look, Added cursor for easier placekeeping. Updated apearance to make the page less bland.... No operational changes.
  3. September 20th, 2018: Fixed a potential issue when a song is too short for a specified tempo. Added the ability to add/change notes, enabled the program to display larger amounts of notes if the tempo is high. Technically, this can now be used for songs as well. This will be updated in the future to streamline this process.
Edited by StunStick
More updates
  • Like 8
  • Thanks 10

Share this post


Link to post
Share on other sites

Necessity is the mother of invention, they say. Good job keeping true to that. 👏

Share this post


Link to post
Share on other sites

This is pretty cool; I'll have to give it a go myself. It looks like you'll get something pretty close even if it's not spot on it will probably be passable. Just requires you to play around with it a bit. I've always found making themes tricky, I've made a couple that I think are pretty good but not perfect. People that make really great themes are really talented.

If this does work it should be pinned in the guides section. Would be great to see more awesome themes out there. It's annoying when you think how much possibility there is in the customization of this game and most themes are just spammed Wilson LeBoyce audio lines. -.-

Share this post


Link to post
Share on other sites
1 hour ago, CombatMedic02 said:

 It's annoying when you think how much possibility there is in the customization of this game and most themes are just spammed Wilson LeBoyce audio lines. -.-

That is exactly my problem too. 

Share this post


Link to post
Share on other sites

Quick update: 
Updated code for more than 2 simultaneous keypresses. This allows songs that require one to press more than 2 keys at the same time to still register all the simultaneous keypresses.

Please let me know if I am allowed to post updates as a reply or if I should just edit the main post. At this point, I'm adding a changelog, and posting a reply. If this is against the rules (Or your interpretation of the rules) let me know, I will only post updates as an edit of the main post from now on.

Share this post


Link to post
Share on other sites

looks pretty neat tbh for those who prob wants some basic in music patterns lol
I wanted to make somehting similar to fl studio back in the days when i used to live in social making theme's but i lost interest after my harddrive died in 2015 😢

Share this post


Link to post
Share on other sites

Hey guys, I updated the code to add a place keeping function. Tell me if you find this easier, or if it just clutters the interface (It's supposed to be easy to use after all!)

Edited by StunStick
Oops

Share this post


Link to post
Share on other sites
20 hours ago, StunStick said:

Basically, I got sick of hearing people with terrible themes that seem like the player just smacked their face into their keyboard a bunch of times to make them.

I am... 85% sure most people do this on purpose.
Except that guy I was matched against that had flight of the bumblebee. Definitely had the wrong notes.

Share this post


Link to post
Share on other sites
1 hour ago, JohnNighthawk said:
I am... 85% sure most people do this on purpose.
Except that guy I was matched against that had flight of the bumblebee. Definitely had the wrong notes.
Yeah, I get that impression sometimes... Maybe it's just wishful thinking that if they had the ability to make a better theme they would.

Share this post


Link to post
Share on other sites

It's not tuned for APB exactly, but I used to play Mabinogi a while back and there's a program to make music in Mabinogi's format (which is letter and symbol based) called 3MLE, and you can use its interface to actually visualize what a song is going to look like in a standard / simplified audio tool like APB's and it's pretty good for splitting up and isolating different tracks (especially for music pieces with different parts / instruments). You can import sheet music directly to it, too. You don't need the extra notepad file for it either, though it does require a bit of fiddling with since it's not made EXACTLY for APB.
While I didn't convert them from sheet music, I used this program also as an organizational tool when I made my old Pokemon songs in APB (basically, I made the songs in 3MLE first by hand, and then copied them over to APB)

That said, if you can get this program's functionality up to par with 3MLE's, I'd be willing to use it just for the sake of not needing to fiddle with it as much due to it being tuned EXACTLY for APB instead.

Godspeed with your project tho my dude, here's hoping you get it working fantastically.

Share this post


Link to post
Share on other sites
9 hours ago, Mightyena said:

It's not tuned for APB exactly, but I used to play Mabinogi a while back and there's a program to make music in Mabinogi's format (which is letter and symbol based) called 3MLE, and you can use its interface to actually visualize what a song is going to look like in a standard / simplified audio tool like APB's and it's pretty good for splitting up and isolating different tracks (especially for music pieces with different parts / instruments). You can import sheet music directly to it, too. You don't need the extra notepad file for it either, though it does require a bit of fiddling with since it's not made EXACTLY for APB.
While I didn't convert them from sheet music, I used this program also as an organizational tool when I made my old Pokemon songs in APB (basically, I made the songs in 3MLE first by hand, and then copied them over to APB)

That said, if you can get this program's functionality up to par with 3MLE's, I'd be willing to use it just for the sake of not needing to fiddle with it as much due to it being tuned EXACTLY for APB instead.

Godspeed with your project tho my dude, here's hoping you get it working fantastically.

I specifically made this so that anyone could create it themselves so that I don't have to distribute a file.
Unfortunately I don't think that HTML is up for converting sheet music, which is unfortunate.
Ill try to release an update later today that fits the APB system better, I just need to add new keys that don't do anything and are purely visual to make up for the extra keys that APB has that the virtual piano does not. Edited by StunStick
Clarification

Share this post


Link to post
Share on other sites
On 8/28/2018 at 9:30 PM, StunStick said:
On 8/28/2018 at 8:27 PM, CombatMedic02 said:

 It's annoying when you think how much possibility there is in the customization of this game and most themes are just spammed Wilson LeBoyce audio lines. -.-

That is exactly my problem too. 
I would pay money to have the LeBoyce audio removed from the game.

As a tone-deaf untalented hack who drools over what some users put up on the marketplace, I love what you've done here, I can't wait to try it out.  

Share this post


Link to post
Share on other sites
1 hour ago, StunStick said:
I specifically made this so that anyone could create it themselves so that I don't have to distribute a file.
Unfortunately I don't think that HTML is up for converting sheet music, which is unfortunate.
Ill try to release an update later today that fits the APB system better, I just need to add new keys that don't do anything and are purely visual to make up for the extra keys that APB has that the virtual piano does not.
Yeah that's kind of the cool thing about 3mle, that it can convert both sheet music and midi files into a visual format that kind of matches APB's creator visually, though obviously not exactly. It also has a fairly large list of instruments that you can test playback with.

Though, TBH I kind of just brought it up in hopes that it could give you ideas in how to improve your own program, because like I said, using 3MLE is fiddly with APB's synth being just different enough that it can cause some hiccups along the way. Also it's free in case you wanted to study it to help improve your own heh.

Edit: I'm also not a programmer so I don't actually know how viable this would be Edited by Mightyena

Share this post


Link to post
Share on other sites
On 8/29/2018 at 8:55 AM, Mightyena said:
Yeah that's kind of the cool thing about 3mle, that it can convert both sheet music and midi files into a visual format that kind of matches APB's creator visually, though obviously not exactly. It also has a fairly large list of instruments that you can test playback with.

Though, TBH I kind of just brought it up in hopes that it could give you ideas in how to improve your own program, because like I said, using 3MLE is fiddly with APB's synth being just different enough that it can cause some hiccups along the way. Also it's free in case you wanted to study it to help improve your own heh.

Edit: I'm also not a programmer so I don't actually know how viable this would be
Just an update on this:

I've looked into it and I think I've found a way that my program can accept .midi files. This means that technically any song can be turned into an APB format. I'm still working on implementing this feature, but it is theoretically posible, and people have been able to read MIDI files through HTML.

However, if anyone is interested, I could definitely use some help. 
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Or you could let me make totally fair priced custom themes for you 😏

Share this post


Link to post
Share on other sites

Another Update: 

I added the ability to add/remove notes and create a new song "Code" on the fly. Basically, you can edit the points, play them back in virtualpiano to see how it sounds.

I hope to add tones and autoplay in the future to reduce the amount of copy-pasting to/from virtualpiano.

Update on the MIDI file reading:
I don't think I will be able to do this without making the program very difficult to understand/read, and I would also have to get into adding libraries to my code, something I'd like to avoid.
If I find a better way to do this, I will add another update.

Share this post


Link to post
Share on other sites
6 minutes ago, CookiePuss said:

Am I the only one who thinks it odd we are allowed a thread dedicated to cheating?


I guess your friend giving out call outs on discord is cheating also....how else did you know he was cooking a nade?

Share this post


Link to post
Share on other sites
13 minutes ago, LaQuandra said:

I guess your friend giving out call outs on discord is cheating also....how else did you know he was cooking a nade?
Funny story, I once asked support about that and they told me yes all 3rd party programs are cheating. 

... sometimes I miss Puck.

Share this post


Link to post
Share on other sites

Another Quick update:
Fixed an issue where "<html>" displayed at the top of the page.
Fixed an issue where the program will not run if the song is too short for the specified tempo. Now the "Empty space" will be filled with no notes instead of simply not generating anything.
Enabled the ability to display songs with a large number of notes by enabling a scrollbar.
 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...