
Firstly, remember that the wise mage stood proudly at the old tower, her mane flowing in the breeze,
 wondering if this was really, truly her dominion now, after all opponents had faded into the night.

Remembering this sentence proves you have bothered to open this file.
Should you come to me with usability issues, I will check for this.
If I find your understanding incomplete,
 I will refuse to help you until you have read this file.

 THIS MEANS YOU, ZXIN!
 ---------------------

 -- PiyoPiyoJ v4 --

Why it exists:
 An alternative to PiyoPiyo, basically.
 Also, it's windowed, instead of PiyoPiyo which is fullscreen.
 So there's that. (yes, it's a useless feature)

Usage:
 Just play around with it.
 The screen is split into two sections - the thing you're editing,
  and the editing/playback controls.

  When editing the note-pattern, the top section is split into two again -
   the top part being the notes,
   and the bottom part being the panning control.
   Nobody actually reads this, as zxin can attest to, but nevertheless,
    the pan control is now based on click-toggles.
   The freed up row is used for the bar number.

  A specific horizontal section of the notes being enveloped in squares indicates this section is selected.
  This is used by the Paste tools to indicate the source.
  Note that this selection can be independent of the current channel,
   depending on what tool you use to paste from it.

  A note is a white dot surrounded by a white rounded rectangle.
  A note that is not on the current channel is a greyish dot, darker than the surrounding grid.

  The start and end loop points are green and red lines respectively,
   where the green line has "S" symbols and the red line has "E" symbols.

  (MAY-NEED-FIX-NOTE: If you have trouble working out which loop point is which,
    please alert me. I think the symbol thing should be enough though)

  When editing an instrument with the 'Edit' button,
   the top section is split into the waveform (top), the envelope (bottom-left),
   and the parameters (bottom-middle/right).
  As for the editing/playback controls:
   At the very top of them is the song-position scrollbar.
   This can be used to seek through the song very quickly.
   Immediately below is the channel-changer, status line, and playback controller.
    '1', '2', '3', 'P' control the current channel. 'Edit' edits that track's details.
    (This option is useless on 'P' except under undocumented circumstances.)
    'L' on this enables/disables loop - '>' is play -
     and '<<' / '>>' seek to the beginning/end of the song.
    '/', meanwhile, makes the song go at half-speed.
   Further below is the tool-section.
   It's split into the tool chooser, and information on the current tool.
   At the bottom is the File bar.
   This bar controls things across the entire file,
    such as loading, saving, time-adjustment (adds/removes spacing between all columns in the file),
    undo/redo (This may show '----', meaning "unavailable". 'X' clears undo/redo buffer.)
    and the beat length (in milliseconds) and drum volume controls.

System Requirements:
 Anything that can run Java 6 with AWT and javax.audio.sampled.
 Might run on Android with gabien-android, but that's a build-it-yourself case.

Release Notes:
 Hopefully this just fixes everything and nobody will bother me about this program again.
 According to my note-to-self,
  I am apparently supposed to delete .class files (but not .java files) that go unused by PiyoPiyoJ.

Additional Credits Go To:
 Jazz Jackalope for the piano-keys text patch and testing
 zxin for testing
 Studio Pixel indirectly for piyoDrums.bin (it's extracted out of PiyoPiyo).
 (Please don't sue me?)

 Regarding the following - it seems to just be a standard musical formula.
 Nevertheless:
  // Thank you liborganya, as it's where I got this from.
  double freq = 8363d * Math.pow(2.0d, pos / 12.0d) / 22050d;

Changelog:
 ---April 17th, 2018---
 V5.MIDI export, + whatever UI adjustments I forgot to mention, including filebrowser stuff
    But mostly MIDI export. zxin's idea.
 ---April 2nd, 2018---
 V4.UI improvements and stuff
    Undo buffer clear needs confirmation.
    WAV export is now a thing.
    The output is 44100hz, 16-bit signed, with the marker `/PPJ`,
     because I don't trust Nicalis not to use the thing for their own ends somehow.
    Not that it'll make much of a difference, the marker's lost on re-encodings...
    You can export both an "intro" file (main + first loop),
     and a "loop" file (second loop).
    You can scroll with your mouse over the main note display.
    There are bar numbers now.
    The sharp indicators have a sort of greyish extension over the main panel.
    Pan mechanism has changed.
    New files don't have selections covering stuff.
    Probably some other stuff.
    Left Shift can act as a substitute for \ on non-UK keyboards.

 ---March 3rd, 2018---
 V3.Port to gabien ipcress
    double-checked all credits details
    there's undo/redo
    there's the Tx & T/ buttons for time-adjust
    the tool list is scrollable
    the fonts are better
    the entire thing has had a change of theme
    there's a scrollbar for scrolling through the song
    the playback engine is Better In More Ways
    there's two secret features
    oh, yeah, and the waveform editor sucks less
    (yes, the wrapping is deliberate)
    and last but not least everything's on gabien-ipcress for a theoretical Android port if I were so inclined
 
 ---July 14th, 2015---
 V2.1.A small change.
    + Added text(the letters of notes) on notes.
 
 ---May 19th, 2015---
 V2.Jazz Jackalope's requests
    + Stopped accounting for Ikachan's timing issues, I apparently mis-judged(songs were too slow)
    + Current position display now rounds, so it doesn't go off the screen.
    + Added "Loop" control.
    + Left and right arrow keys now move through the song.
    + Saving the file will now trim empty frames at the end.
    + A keyboard is now displayed at the left of the screen.
 
 ---May 1st, 2015---
 V1.Initial release
 
That piyoDrums.bin doc some people want:
 piyoDrums.bin is drum audio extracted out of PiyoPiyo itself,
  with the help of a resource editor, Audacity, and this Java code:

  FileOutputStream fos = new FileOutputStream("piyoDrums.bin");
  DataOutputStream dos = new DataOutputStream(fos);
  for (int i = 0; i < 6; i++) {
   FileInputStream is = new FileInputStream("D" + (i + 1) + ".raw");
   int b = is.available();
   dos.writeInt(b);
   for (int j = 0; j < b; j++)
    dos.write(is.read());
   is.close();
  }
  dos.close();

 Probably not a complicated format. The samples are considered to be at 22050hz, 8-bit.

Licensing Information:
 License of 'gabien' stuff, which is more or less just a more formal replacement for the PiyoPiyoJ license:

  gabien-common - Cross-platform game and UI framework
  Written starting in 2016 by contributors (see CREDITS.txt)
  To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
  You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.

  gabien-javase - gabien backend for desktop Java
  Written starting in 2016 by contributors (see CREDITS.txt)
  To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
  You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.

 For reference, 'CREDITS.txt' just says "Just 20kdc for now... :(".
 License of everything else apart from piyoDrums.bin (wow, I forgot to update the date when I removed the expletive):

       DO WHATEVER YOU WANT TO PUBLIC LICENSE 
                   Version 2, December 2004 
  Modified by gamemanj <asdd2808@gmail.com> to remove expletives
  Original copyright (C) 2004 Sam Hocevar <sam@hocevar.net> 

  Everyone is permitted to copy and distribute verbatim or modified 
  copies of this license document, and changing it is allowed as long 
  as the name is changed. 

       DO WHATEVER YOU WANT TO PUBLIC LICENSE                      
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 
   0. You just DO WHATEVER YOU WANT TO.

