-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtab.php
164 lines (122 loc) · 4.08 KB
/
tab.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
use PhpTabs\PhpTabs;
require_once "inc/app.php";
$tab = new PhpTabs('Lagu 0014.mid');
// Available options
/**
* options scale=0.8 space=16 width=500 tab-stems=true tab-stem-direction=down stave-distance=20 font-size=12 font-face=times font-style=italic tempo=66
tabstave notation=true time=4/4
*/
$options = [
// Renderer options
'measures_per_stave' => 1,
// Global options
'space' => 16, # An integer
'scale' => 0.8, # A float or an integer
'stave-distance' => 20, # An integer
'width' => 500, # An integer, in pixel
'font-size' => 12, # An integer
'font-face' => 'times', # A string
'font-style' => 'italic', # A string
'tab-stems' => true, # A boolean, default: false
'tab-stem-direction' => 'down', # A string up|down, default: up
'player' => false, # A boolean, default: false
// Tabstaves options
'notation' => true, # A boolean, default: false
'tablature' => false, # A boolean, default: true
'lyric' => true,
];
//tab-stems=true tab-stem-direction=down
// Render track 0
$tabStr = $tab
->getRenderer('vextab')
->setOptions($options)
->render(3);
$arr = explode("\n", $tabStr);
foreach($arr as $key=>$val)
{
if(trim($val) == 'notes')
{
$arr[$key] = '';
}
}
$tabStr = implode("\n", $arr);
?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script
type="text/javascript"
src="fiddle.jshell.net_files/dummy.js"
></script>
<link rel="stylesheet" type="text/css" href="fiddle.jshell.net_files/result-light.css">
<script type="text/javascript" src="https://unpkg.com/vextab/releases/main.dev.js"></script>
<style id="compiled-css" type="text/css">
.vexbox {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 300px;
}
/* EOS */
</style>
<script id="insert"></script>
<script src="fiddle.jshell.net_files/stringify.js?ceaeb44bfd207968b44d260d6b94e6686e85ba92" charset="utf-8"></script>
</head>
<body>
<div class="vexbox">
<div id="boo"></div>
</div>
<script type="text/javascript">//<![CDATA[
let data2 = `
<?php echo $tabStr;?>
`;
let data = `
options tab-stems=true tab-stem-direction=down
tabstave notation=true tablature=true time=4/4
notes :8 3/5 0-2-3/4 0-2/3 0-1-1-0/2 2-0/3 3-2-0/4 3/5
text :8,.1,C,D,E,F,G,A,B,C,C,B,A,G,F,E,D,C
`
const VF = vextab.Vex.Flow
const renderer = new VF.Renderer($('#boo')[0],
VF.Renderer.Backends.SVG);
vextab.Artist.NOLOGO = true;
// Initialize VexTab artist and parser.
const artist = new vextab.Artist(10, 10, 750, { scale: 0.8 });
const tab = new vextab.VexTab(artist);
tab.parse(data2);
artist.render(renderer);
//]]></script>
<script>
// tell the embed parent frame the height of the content
if (window.parent && window.parent.parent){
window.parent.parent.postMessage(["resultsFrame", {
height: document.body.getBoundingClientRect().height,
slug: "umkfjxyv"
}], "*")
}
// always overwrite window.name, in case users try to set it manually
window.name = "result"
</script>
<script>
let allLines = []
window.addEventListener("message", (message) => {
if (message.data.console){
let insert = document.querySelector("#insert")
allLines.push(message.data.console.payload)
insert.innerHTML = allLines.join(";\r")
let result = eval.call(null, message.data.console.payload)
if (result !== undefined){
console.log(result)
}
}
})
</script>
</body>
</html>