Permalink
Browse files

Uncommon beats support (6 beats instead of 4 in one line)

  • Loading branch information...
narze committed Jun 10, 2012
1 parent c75be69 commit dedc5a970ded116ccfb528d3c9a80537c74ff951
Showing with 66 additions and 7 deletions.
  1. +66 −7 jubeat_memo_analyser.rb
View
@@ -7,6 +7,8 @@
memoBackBlank = ''
analyserSymbols = ['@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
analyserSymbolPrefix = ''
+analyserSixSymbols = ['@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
+analyserSixSymbolPrefix = ','
space = " "
groups = Array.new
group = Array.new
@@ -35,25 +37,38 @@
groups.shift
# convert into jubeat analyser format
+# front : beats' position
+# back : beats' rhythm
groups.each_with_index do |a_group, index|
front = Array.new
back = Array.new
a_group.each do |line|
front.concat line[0..3].split('')
backside = line[/\|(.+)\|/, 1]
- back.concat(backside.split('')) unless backside.nil?
+ back.push(backside.split('')) unless backside.nil?
end
# replace with jubeat analyser symbols
- back.each_with_index do |item, i|
- if item != memoBackBlank
- front.map! do |x|
- x == item ? "#{analyserSymbolPrefix}#{analyserSymbols[i]}" : x
+ back.each_with_index do |line, l|
+ isSix = line.length === 6 ? true : false
+ line.each_with_index do |item, i|
+ if item != memoBackBlank
+ if(isSix)
+ n = (l * 6) + i
+ front.map! do |x|
+ x == item ? "#{analyserSixSymbolPrefix}#{analyserSixSymbols[n]}" : x
+ end
+ else
+ n = (l * 4) + i
+ front.map! do |x|
+ x == item ? "#{analyserSymbolPrefix}#{analyserSymbols[n]}" : x
+ end
+ end
end
end
end
- #fill space
+ # fill space
front.map! do |x|
x == memoBlank ? "#{analyserSymbolPrefix}#{space}" : x
end
@@ -65,11 +80,55 @@
end
end
-# write result
+# write result into output
# Set encoding to windows 1252
# (jubeat analyser cannot read utf-8)
output = File.basename(input, ".*") + "_jma.txt"
f = File.new(output, 'w:Windows-1252')
+
+# write file attributes
+f.write "// Generated by jubeat-memo-analyser\n"
+f.write "// http://github.com/NarzE/jubeat-memo-analyser\n"
+f.write '#title="songtitle"' + "\n"
+f.write '#artist="songartist"' + "\n"
+f.write '#jacket="songjacketimage.jpg"' + "\n"
+f.write 'm="songfile.mp3"' + "\n"
+f.write '// Offset' + "\n"
+f.write 'o=0' + "\n"
+f.write '// Beats' + "\n"
+f.write 'b=4' + "\n"
+f.write '// BPM' + "\n"
+f.write 't=195' + "\n"
+f.write "\n"
+
+# write 'six' symbols timing
+f.write "*#{analyserSixSymbolPrefix}@:0" + "\n"
+f.write "*#{analyserSixSymbolPrefix}A:0.166667" + "\n"
+f.write "*#{analyserSixSymbolPrefix}B:0.333333" + "\n"
+f.write "*#{analyserSixSymbolPrefix}C:0.5" + "\n"
+f.write "*#{analyserSixSymbolPrefix}D:0.666667" + "\n"
+f.write "*#{analyserSixSymbolPrefix}E:0.833333" + "\n"
+f.write "*#{analyserSixSymbolPrefix}F:1" + "\n"
+f.write "*#{analyserSixSymbolPrefix}G:1.166667" + "\n"
+f.write "*#{analyserSixSymbolPrefix}H:1.333333" + "\n"
+f.write "*#{analyserSixSymbolPrefix}I:1.5" + "\n"
+f.write "*#{analyserSixSymbolPrefix}J:1.666667" + "\n"
+f.write "*#{analyserSixSymbolPrefix}K:1.833333" + "\n"
+f.write "*#{analyserSixSymbolPrefix}L:2" + "\n"
+f.write "*#{analyserSixSymbolPrefix}M:2.166667" + "\n"
+f.write "*#{analyserSixSymbolPrefix}N:2.333333" + "\n"
+f.write "*#{analyserSixSymbolPrefix}O:2.5" + "\n"
+f.write "*#{analyserSixSymbolPrefix}P:2.666667" + "\n"
+f.write "*#{analyserSixSymbolPrefix}Q:2.833333" + "\n"
+f.write "*#{analyserSixSymbolPrefix}R:3" + "\n"
+f.write "*#{analyserSixSymbolPrefix}S:3.166667" + "\n"
+f.write "*#{analyserSixSymbolPrefix}T:3.333333" + "\n"
+f.write "*#{analyserSixSymbolPrefix}U:3.5" + "\n"
+f.write "*#{analyserSixSymbolPrefix}V:3.666667" + "\n"
+f.write "*#{analyserSixSymbolPrefix}W:3.833333" + "\n"
+f.write "\n"
+
+# write data
out.each do |line|
f.write("#{line}\n");
end

1 comment on commit dedc5a9

@narze

This comment has been minimized.

Show comment Hide comment
@narze

narze Jun 10, 2012

Owner

And added file header

Owner

narze commented on dedc5a9 Jun 10, 2012

And added file header

Please sign in to comment.