Skip to content

Instantly share code, notes, and snippets.

@Jire
Created May 14, 2012 16:07
Show Gist options
  • Save Jire/2694782 to your computer and use it in GitHub Desktop.
Save Jire/2694782 to your computer and use it in GitHub Desktop.
Baudio V2 generation of fields, 100 notes = 100 characters, VERY small for 100 notes (standard 100 notes in WAV = over 300KB)
public class Main {
public static void main(String[] args) {
StringBuilder total = new StringBuilder();
for (int i = 0; i < 100; i++) {
int instrument = i & 0xF;
int delay = i & 0xF;
int note = i;
int box = ((instrument & 0xF) << 12) | ((delay & 0xF) << 8) | (note & 0xFF);
int u_instrument = (box >> 12) & 0xF;
int u_delay = (box >> 8) & 0xF;
int u_note = (box & 0xFF);
System.out.println("Box: " + ((char) (box & 0xFFF)) + ", Instrument: " + u_instrument + ", Delay: " + u_delay + ", Note: " + u_note);
total.append((char) (box & 0xFFF));
}
System.out.println("Track: " + total.toString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment