You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clean up code; add better documentation for how to use other midi files; download zipped midi files and extract melody strings to a temporary file, if that file doesn't already exist
Copy file name to clipboardExpand all lines: dl4j-examples/src/main/java/org/deeplearning4j/examples/wip/advanced/modelling/melodl4j/MelodyModelingExample.java
finalstaticStringsymbolicMelodiesInputFilePath = tmpDir + "/" + inputSymbolicMelodiesFilename; // Point to melodies created by MidiMelodyExtractor.java
finalstaticStringinputSymbolicMelodiesFilePath = tmpDir + "/" + inputSymbolicMelodiesFilename; // Point to melodies created by MidiMelodyExtractor.java
62
73
finalstaticStringcomposedMelodiesOutputFilePath = tmpDir + "/composition.txt"; // You can listen to these melodies by running PlayMelodyStrings.java against this file.
Copy file name to clipboardExpand all lines: dl4j-examples/src/main/java/org/deeplearning4j/examples/wip/advanced/modelling/melodl4j/MelodyStrings.java
+96-25Lines changed: 96 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -26,36 +26,102 @@
26
26
*
27
27
* @author Don Smith
28
28
*/
29
+
29
30
publicclassMelodyStrings {
30
31
publicstaticfinalStringCOMMENT_STRING = "//";
31
32
// The following strings are used to build the symbolic representation of a melody
32
33
// The next two strings contain chars used to indicate pitch deltas.
33
-
publicstaticfinalStringnoteGapCharsPositive = "0123456789abc"; // A pitch delta of "0" indicates delta=0.
34
-
publicstaticfinalStringnoteGapCharsNegative = "ABCDEFGHIJKLM"; // A pitch delta of "A" indicates delta=-1.
35
-
// R is used to indicate the beginning of a rest
34
+
// We use this ordering of characters so that the pitch gap order is the same as the ASCII order.
35
+
publicstaticfinalcharlowestPitchGapChar = 'A';
36
+
publicstaticfinalcharREST_CHAR = ' ';
37
+
38
+
// We allow pitch gaps between -12 and +12, inclusive.
39
+
// If you want to change the allowed gap, you will have to change the characters in PITCH_GAP_CHARS_NEGATIVE and PITCH_GAP_CHARS_POSITIVE
40
+
41
+
publicstaticintMAX_POSITIVE_PITCH_GAP = 12;
42
+
// The order of characters below is intended to simplify the learning of pitch gaps, because increasing
43
+
// characters correspond to increasing pitch gaps. The string must end with 'A'.
0 commit comments