moinejf / abc2svg Goto Github PK
View Code? Open in Web Editor NEWproject moved to https://chiselapp.com/user/moinejf/repository/abc2svg
License: GNU Lesser General Public License v3.0
project moved to https://chiselapp.com/user/moinejf/repository/abc2svg
License: GNU Lesser General Public License v3.0
I'm trying to play an abc tune with multiple voices but the play.html its throwings errors. Please see this jsbin. I just replaced the abc tune in the play.html example.
I know, this is a difficult thing, nevertheless, i report it and leave it up to you if you improve it.
using 1.13.7; If I enter
I:transpose=2
I get the message
`Cannot read property 'uscale' of null``
Of course this is a syntactical error, maybe it is possible to report it as such.
I open this issue in order to track the changes we have disucssed by mail:
@moinejf wrote: Yes, there is still some work to do with playing!
I will add a 6th item meaning 'volume' in the sound events.
If this item is present and nul (== 0), the event will not be output
(no gain connection).
on_note
. But if you don’t want to provide this, i will use an index into a corresponding event list.In the current version, v1.14.1 the play functionality doesn't work well with repeats (In the previous version this was working fine)
How to reproduce:
1- copy the following abcnotation in http://moinejf.free.fr/js/edit-1.xhtml
X:1
%%measurenb 0
%%slurheight 1.4
%%scale 0.83
L:1/16
M:4/4
I:linebreak $
K:A
V:1
|: (ABcd edcB ABcd edcB | ABcd edcB ABcd edcB) :| %2
When stf=='js', the current default URL (https://raw.githubusercontent.com/gleitz/midi-js-soundfonts/gh-pages/FluidR3_GM) fails, with an error saying that it doesn't allow execution of JS for something returned as mime text.
The solution we found was to replace the server with https://rawgit.com/gleitz/midi-js-soundfonts/gh-pages/FluidR3_GM which seems to return a more suitable mime type.
More info here ( https://github.com/rgrove/rawgit/blob/master/FAQ.md ).
Good morning,
This ABC:
X:1
Z:Copyright ©
%%scale 0.83
L:1/8
M:2/4
I:linebreak $
K:D
V:1
%%measurenb 0
(!1!E!1!c) (c!1!E) :: (!1!E!2!d) (d!1!E) :: (!1!E"^3"e) (e!1!E) :: (!1!E"^4"f) (f!1!E)
Generates this:
The font on those 3 and 4 are wierdly big. When generating the same code with a different XML2ABC, the result is different, but the problem is the same:
Thank you.
Hello, I'm trying to computationally manipulate an abc tune and wanted to ask how I can use your library to parse an abc string into an object, manipulate the object (ie remove notes, change pitch) then convert it into an abc string. Thanks!
The name says it all :)
It's easier to control import as npm package than as direct git import.
Ideally (from our p.o.v.) it could allow use it as an Angular 4 components. If not, then we can always create an angular wrapper package later on.
Thanks!
The following testcase indicates that nested repeats do not play properly.
On the other hand, nested repetitions are virtually never notated that way, because it is virtually 100% likely a human musician won't be be able to follow the intended roadmap.
So If you wand to close this as "Wontfix" it is ok.
X:1
L:1/8
F:3047_nested-repetion-play
M:4/8
K:C octave=-1 treble
cdef | gabc' :|: defg |1 abc'd' :|2 GABc |] defg :|
%
W:Should play measures in following order
W:
W:a: 1 2 - 1 2 - 3 4(1) - 3 5(2) - 6
W:b: 1 2 - 1 2 - 3 4(1) - 3 5(2) - 6
W:
W:But the last repetiton (b) starts on measure 3
Zupfnoter's output visualizes the flow
Hello.
There's some inconsistency when 'triggering' onendplay functionality from play-1.js:
I've made a basic setup to demonstrate the problems:
Here's the gist or see abc2svg.zip
Thanks
The following code causes an endless loop. It work if I remove the "z" from the very first voice overlay.
X:3004
T:test voice overlay
M:4/4
L:1/4
Q:1/4=120
K:C
%%score 1
V:1 clef=treble-8 name="Sopran" snm="S"
C4| (& z (3DDD (3DDD & F (3GGG G - &)| D4 & G GGG |
This abc
X:1025
F:1025_Tuplet-patterns
T:Tuplet-patterns
C:
S:
I:measurenb 1
M:3/4
L:1/4
Q:1/4=120
U: l="^<"
U: r="^>"
K:C
%%score 1 2
V:1 clef=treble name="Sopran" snm="S"
[r:c1](3CCC z| (3CCC z | [r:tpl1] (2CD | (3:2:2 C2C z | (3"^!xx" [r:tpl3]CEG z |
[r:tpl4](3 GEC rz | (3 CGC z | (3 CA,C z | [r:tpl5](3 CGF z | [r:tpl2](3 FGC z |
V:2 octave=-1
GGG |GGG |GGG |GGG |GGG |GGG |GGG |GGG |GGG |GGG |
Yields
maybe it is possible to improve behavior on bar 5, 6, 10
I do not manage to suppress "line too much shrunk" by %%linewarn 0
I think in music.js line 4323 it should be
if (cfmt.linewarn) {
error(0, s, "Line too much shrunk $1 $2 $3",
xmin.toFixed(2),
x.toFixed(2),
width.toFixed(2))
}
after updating to 1.15.0-15-g 2844008 I have a crash with the following abc. it was not there with 1.15.0-9-g eee5e5e
F:1006_Note-Durations
X:1006
T:Note Durations
C:Bernhard Weichel
R:{rhythm}
M:4/4
L:1/1
Q:1/4=120
K:C
%%score T1 T2 T3
V:T1 clef=treble-8 name="Rythm" snm="S"
V:T2 clef=treble-8 name="Alt" snm="A"
V:T3 clef=treble-8 name="Rests" snm="A"
[V:T1] c | [L:1/16] c16 | (cccc) (cccc) (cccc) (cccc) | (cccc) (cccc) (cccc) (cccc) | (cccc) (cccc) (cccc) (cccc) | (cccc) (cccc) (cccc)
P:Tuplets
[V:T1] c | [L:1/4] cc2c4 c4-c4c
[V:T2] [I:transpose -5] d | [L:1/1]d1 | d3/4 z/4 | d/2 d3/8 d1/4 d3/16 d/8 d/16 d3/2
| (3d/8d/8d/8 (3d/4d/4d/4 (3 d/2 d/2 d/2 (3ddd d1/4
[V:T3] e [L:1/1] | z1 | z3/4 z/2 z3/8 z1/4 z3/16 z/8 z/16 z/32 z/64 (3z/8z/8z/8 (3 z/4z/4z/4 (3:3:2 z/2 z/2 z/2 (3zzz z1/4
%
it reports
Cannot read property 'type' of undefined
*** Abort ***
TypeError: Cannot read property 'type' of undefined
at draw_tuplet (/private/tmp/toto.js:4537:19)
at draw_sym_near (/private/tmp/toto.js:5322:5)
at output_music (/private/tmp/toto.js:12047:4)
at generate (/private/tmp/toto.js:18175:2)
at end_tune (/private/tmp/toto.js:7135:3)
at Abc.tosvg (/private/tmp/toto.js:7189:5)
at do_file (/private/tmp/toto.js:20416:7)
at abc_cmd (/private/tmp/toto.js:20446:3)
at Object. (/private/tmp/toto.js:20649:2)
at Module._compile (module.js:570:32)
Another version
F:1006_Note Durations
X:1006
T:Note Durations
C:Bernhard Weichel
R:{rhythm}
M:4/4
L:1/1
Q:1/4=120
K:C
%%%%hn.print {"t":"alle Stimmen", "v":[1,2,3,4], "s": [[1,2],[3,4]], "f":[1,3], "j":[1]}
% %%%hn.print {"t":"sopran, alt", "v":[1,2], "s":[[1,2]], "f":[1], "j":[1]}
%%%%hn.print {"t":"tenor, bass", "v":[3, 4], "s":[[1, 2], [3,4]], "f":[3 ], "j":[1, 3]}
%%score T1 T2 T3
V:T1 clef=treble-8 name="Rythm" snm="S"
V:T2 clef=treble-8 name="Alt" snm="A"
V:T3 clef=treble-8 name="Rests" snm="A"
[V:T1] [L:1/16] c16 | (cccc) (cccc) (cccc) (cccc) | (cccc) (cccc) (cccc) (cccc) | (cccc) (cccc) (cccc) (cccc) | (cccc) (cccc) (cccc) (z3/4)
P:Tuplets
[V:T1] [L:1/4] cc2c4 c4-c4c
[V:T2] [I:transpose -5] [L:1/1]d1 | d3/4 d/2 d3/8 d1/4 d3/16 d/8 d/16 d/32 d/64 d3/2
| (3d/8d/8d/8 (3d/4d/4d/4 (3 d/2 d/2 d/2 (3ddd d1/4
[V:T3] [L:1/1]z1 | z3/4 z/2 z3/8 z1/4 z3/16 z/8 z/16 z/32 z/64 z3/2
| (3z/8z/8z/8 (3z/4z/4z/4 (3 z/2 z/2 z/2 (3zzz z1/4
%
Cannot read property 'type' of null
*** Abort ***
TypeError: Cannot read property 'type' of null
at draw_tuplet (/private/tmp/toto.js:4537:19)
at draw_sym_near (/private/tmp/toto.js:5322:5)
at output_music (/private/tmp/toto.js:12047:4)
at generate (/private/tmp/toto.js:18175:2)
at end_tune (/private/tmp/toto.js:7135:3)
at Abc.tosvg (/private/tmp/toto.js:7189:5)
at do_file (/private/tmp/toto.js:20416:7)
at abc_cmd (/private/tmp/toto.js:20446:3)
at Object. (/private/tmp/toto.js:20649:2)
at Module._compile (module.js:570:32)
``´
I see that overlay voices to not have bar symbols. It appears reasonable since the regular notation has such things in the main voice. But for tableharps I need to handle overlay voices as regular voice with all features.
Would it be easy for you to add this information?
Would it be sufficient, to remove all bars from overlay voices and duplicate the bars from voice 0 into the overlay voice according to the time? Then I can do it on my side.
May testcase was
C4|(3DDD (3DDD & F (3GGG G - | D4 & G GGG | E4 | E4 & d4 |
In this case the overlay voice indeed does not have bars in the ABC-code.
In an earlier discussion we found that accidentals of one voice effects the others if they are in the same measure and the same octave.
Below I illustrate the problem with abc and Zupfnoter output which visualizes the pitch provided by midi.js. The test also works on http://moinejf.free.fr/js/edit-1.xhtml but only audible.
The pitch of the one note in V:2 collides with the pitch of beat 5 in V:1. So the result is a D#/Eb instead of an E.
First I thought it is a leftover of #3, but I think it is that the accidental of V:2 affects V1 as it is in the same octave.
This leads to the question: does the "same octave" refer to the noted or to the played octave.
Not sure if this is a bug, but in any case, I think it is an interesting case and worth to be documented.
X:1
F:octave_clefs
T:Octave clefs
M:12/16
L:1/16
Q:1/4=60
K:C
%
%%score 1 2
%
V:1 clef=treble-8 octave=1 name="Sopran" snm="S"
C ^C D ^D E F ^F G ^G A ^A B |
V:2 treble
_E12 |
yields
The pitch of the one note in V:2 collides with the pitch of beat 5 in V:1
If I move V:2 to another octave such that I do not have the collision, then everything is fine.
1.13.5 no longer works in Zupfnoter
It does work with 1.12.8
It appears to me that statements like this (object loop applied to array)
for (v in voice_tb) {
voice_tb[v].meter = s;
voice_tb[v].wmeasure = wmeasure
}
Should iterate over the array elements, but it iterates over the properties of arrays.
It should be:
for(var v = 0; v < voice_tb.length; v++){
voice_tb[v].meter = s;
voice_tb[v].wmeasure = wmeasure
}
This is a general problem with the fact that Opalrb adds more properties to javascript entities.
see also
see opal/opal#1684
opal/opal#680
http://www.sebarmeli.com/blog/2010/12/06/best-way-to-loop-through-an-array-in-javascript/
which says:
The two main problems with for-in loop are :
- It enumerates through all the properties even the >ones associated to the
Object (that can be augmented previously)- The order of the elements i s not guaranteed.
So it’s strongly recommended to use the FOR LOOP to loop through an Array and remember that
Java and JavaScript are different.
Would you be able to fix that?
If I run abcnode from another folder (e.g. ../abcnode) it fails. I am preparing a PR for this.
I am currently working on a regression test framework. Intitially I process with abcnode. For this I need to start it from another folder than the root of abc2svg.
One of my user had the request that meter changes within the piece. I also display the content of the M: header literally in the table harp sheets. So they had the need to express the multiple meters in the M: header.
Eventually this worked:
M: 3/4 (4/4)
But I do not understand why. When I use
M: 3/4 4/4
then the bar numbers in Zupfnoter are not correct and I had Problems to get the countnotes right on the very first measure. It seems that the property wmeasure
gets a different value depending of the second value in paranthesis.
It also appears abc2svg produces bar numbers only if we have at least filled the measure.
I found the documentation in http://moinejf.free.fr/abcm2ps-doc/features.xhtml. But i do not know what exactly I can write in the M: line and what the effect will be. Even http://abcnotation.com/wiki/abc:standard:v2.2#mmeter does not state all the options of M:
Could you help me with some hints how to deal with these things. First I want to do it right on the ABC-level. When I understand this and the result in JSON, then I can adapt the harpnote transformation accordiingly.
Starting with commit 1e156fd there is a problem with voices not being referenced in the %%score
with
X:3045
F:3045_unreferenced-voices
T:unreferenced voices
C:
S:
M:4/4
L:1/4
Q:1/4=120
K:C
%
%
%%score 1 2 3
%
V:1 clef=treble name="Sopran" snm="S"
c
V:2 clef=treble name="Alto" snm="A"
B
V:3 clef=bass name="Tenor" snm="T"
C
V:4 clef=bass name="Bass" snm="B"
B,
I get in the console (note that the line numbers refer to the result of NOMIN=1; ./ninja #{f}
)
Cannot read property 'time' of undefinedTypeError: Cannot read property 'time' of undefined
at vloop (http://localhost:9292/assets/abc2svg-1.self.js?body=1:20584:14)
at AbcMIDI.AbcMIDI.add (http://localhost:9292/assets/abc2svg-1.self.js?body=1:20579:4)
at $Abc2Svg.$_callback_get_abcmodel (http://localhost:9292/assets/opal-abc2svg.self.js?body=1:196:19)
at Object.TMP_7 [as get_abcmodel] (http://localhost:9292/assets/opal-abc2svg.self.js?body=1:71:21)
at generate (http://localhost:9292/assets/abc2svg-1.self.js?body=1:18181:8)
at end_tune (http://localhost:9292/assets/abc2svg-1.self.js?body=1:7181:3)
at Abc.tosvg (http://localhost:9292/assets/abc2svg-1.self.js?body=1:7234:5)
at $Abc2Svg.$get_abcmodel (http://localhost:9292/assets/opal-abc2svg.self.js?body=1:143:19)
at $Abc2svgToHarpnotes.$transform (http://localhost:9292/assets/abc2svg_to_harpnotes.self.js?body=1:75:39)
at $Controller.$load_music_model (http://localhost:9292/assets/controller.self.js?body=1:674:143)
The situation before the crash is in my browser as follows:
It appears that voices not referenced in %%score do not have a sym property.
Hi,
We are having some difficulties in building the library.
$ ninja -v
[1/12] fontforge -c 'open("font/abc2svg.sfd").generate("abc2svg.woff")'
[2/12] cp editor/edit.css edit-1.css
[3/12] if [ -x /usr/bin/git -a -d .git ]; then VERSION=`git describe`; VERSION=${VERSION#v}; DATE=`git log -1 --pretty=format:%ci HEAD | cut -d' ' -f1`;else VERSION=`grep '"version"' package.json|cut -d'"' -f4`; DATE=`stat --printf=%y build.ninja | cut -d' ' -f1`;fi;cp core/license abcdoc-1.js;echo "// abcdoc-1.js for abc2svg-$VERSION ($DATE)" >> abcdoc-1.js;if [ "x$NOMIN" = "x" ]; then uglifyjs util/abcdoc.js >> abcdoc-1.js;else cat util/abcdoc.js >> abcdoc-1.js;fi
[4/12] if [ -x /usr/bin/git -a -d .git ]; then VERSION=`git describe`; VERSION=${VERSION#v}; DATE=`git log -1 --pretty=format:%ci HEAD | cut -d' ' -f1`;else VERSION=`grep '"version"' package.json|cut -d'"' -f4`; DATE=`stat --printf=%y build.ninja | cut -d' ' -f1`;fi;cp core/license abcemb-1.js;echo "// abcemb-1.js for abc2svg-$VERSION ($DATE)" >> abcemb-1.js;if [ "x$NOMIN" = "x" ]; then uglifyjs util/abcemb.js >> abcemb-1.js;else cat util/abcemb.js >> abcemb-1.js;fi
FAILED: fontforge -c 'open("font/abc2svg.sfd").generate("abc2svg.woff")'
Copyright (c) 2000-2012 by George Williams.
Executable based on sources from 14:57 GMT 31-Jul-2012-ML.
Library based on sources from 14:57 GMT 31-Jul-2012.
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'file' object has no attribute 'generate'
ninja: build stopped: subcommand failed.
Can you please help identify what is the cause?
Although this also happens on OSX (Windows doesn't even run for obvious reasons), we created a Dockerfile to have a clear and consistent environment (https://github.com/highskillz/abc2svg/blob/master/Dockerfile).
Thanks
I observe that onend
fires too early. I assume, it fires when the last note is scheduled. In my expectation, it should fire when the last note is turned off.
you can reproduce it with
X:1
K:C
E4 F4
If you play this in http://moinejf.free.fr/js/edit-1.xhtml, you can see that play button toggles immediately after playing the E4.
You can also observe it by setting a breakpoint in the browser, you can see that after calling endpoint
, there are more calls to notehighlight
How can I decode the font/symbol inserted in for the notes. I need convert it to a value which can be used to compare whether the text is a note, dot or an accidental.
Hi,
Do you have anything lined up to (optionally) play a metronome sound on top of the current generated sound?
If this is the case, it would also be great to have a count-in of 1 or 2 bars (ie, just the metronome sound for 1 or 2 bars before starting the visual and audio).
Thx
Hi,
We are trying to use the play-1.js script on an desktop app that can be used offline. One of the difficulties we are facing has to do with the dynamic download of audio files for MIDI playback.
For offline support, it means that we would have to increase the download size.
An alternative for this would be to define the concept of a user-defined default instrument.
Currently we are focused on violin, which means that most of the files (since they don't explicitly specify an instrument) end up playing as "acoustic_grand_piano".
Allowing setting the default instrument via something like "set_default_instr" could address this.
Another possible improvement would be to detect failure to load an instrument and, in that case, try to load the default instrument. From our analysis of the code, it seems that this could be easier with the 'mp3' mode, as it already has support for "onerror". This would also mean that we would have to pack fewer instruments while still being able to deal with user-defined files.
We can try to add some of this, but we fear our javascript skills are not yet on the required level to deal with play-1.js :)
Anyway, it would be great if you could give some input on this.
Thanks!
Hello once again.
When using AudioContext its best to threat as a single instance object because if you create more than once its likely wasteful or you doing something wrong (1) (2). The way play-1.js was built, it work just fine when using as a single page like yours. But when using in a 'modern/module/complex' app things gets trickier. In my app, the AbcPlay() is being used more than once and this causes the multiple creations of AudioContexts causing the following error:
NotSupportedError: Failed to construct 'AudioContext': The number of hardware contexts provided (6) is greater than or equal to the maximum bound (6).
What I am requesting is a feature that passes to the AbcPlay() an existing audioContext. Give us more versatility that is.
My take on this one would be something like this:
(although since sf stands for 'soundfount' probably it doesn't fit right)
With this change we can pass the ac like:
const ac = new AudioContext(); //global, only declared once
...
const abcplay = new AbcPlay(endplay, {type: 'mp3', url: 'assets/soundfonts', audiocontext: ac }, notehlight)
//or just like in your edit-1 app we can still use: new AbcPlay(endplay, {type: 'mp3' }, notehlight)
When calling your Object I can unsure only one ac is created.
Thanks.
Hello, the play-1.js Audio() object corrupts the existing object from HMTLAudioElement constructor
normal behaviour:
<!DOCTYPE html>
<html>
<body>
<script>
const audio = new Audio('http://www.sample-videos.com/audio/mp3/crowd-cheering.mp3');
audio.play(); //plays the sound like it should
</script>
</body>
</html>
But adding your script:
<!DOCTYPE html>
<html>
<body>
<script src="http://moinejf.free.fr/js/play-1.js"></script>
<script>
const audio = new Audio('http://www.sample-videos.com/audio/mp3/crowd-cheering.mp3');
audio.play(); //throws an error 'Uncaught TypeError: audio.play is not a function'
</script>
</body>
</html>
Renaming your Audio object solves the problem.
Thank you.
Hi,
ninja -t clean
ninja: error: remove(font): Directory not empty
Cleaning... 14 files.
I observe two reasons why the json model contain voices without symbols:
Is there a way to distinguish these two cases such that I can provide a proper error message to the user.
Best would be if
X:1
T: weird score
%%score 1
K:F
V:1
c
%%score 2
V:2
%
C
Yields
and a json model where the notes of V2 do not have a midi entry.
It is getting better if I add a Measure bare after the first "c"
I fully admit that this is a weird case, but it happens, and we should provide a helpful feedback.
Dealing with multiple score statements is rocket science. I feel the spec is not very clear and hard to implement.
Doesn't work in Safari. Chrome seems to be more tolerant about using const in strict mode.
Replacing const by var seems to break something somewhere. I cannot play abc anymore using play-1.js ! Although the svg output of the abc seems to be correctly displayed.
Would be nice to have documentation about play-1.js on how using it without abcemb-1.js though.
The following code
X:1
F:octave_clefs
T:Octave clefs
M:4/4
L:1/4
Q:1/4=120
K:C
%
%%score 1
%
V:1 clef=treble-8 octave=1 name="Sopran" snm="S"
C ^C D ^D E F ^F G ^G A ^A B
Does not yield the correct midi values in the json. it does not respect the accidentals.
It yields
"midi": 60
"midi": 60
"midi": 62
"midi": 62
"midi": 64
"midi": 65
"midi": 65
"midi": 67
"midi": 67
"midi": 69
"midi": 69
"midi": 71
Without the Octave clef I get
"midi": 72
"midi": 73
"midi": 74
"midi": 75
"midi": 76
"midi": 77
"midi": 78
"midi": 79
"midi": 80
"midi": 81
"midi": 82
"midi": 83
I Wanted to try it on http://moinejf.free.fr/js/edit-1.xhtml to see, how it plays, but the player there crashes with
We have looked in the standard (http://abcnotation.com/wiki/abc:standard:v2.2) and it seems not to exist.
If not, can abc2svg render the correct dynamics even if not in the standard?
thx
similar to #46 there is one more thing where midi.js deviates from player js. I think play.js is right here.
Accidentials should survive the tie if the tie crosses a measure
X:3049
F:3049_abcsvg-issue-48
T:48 Blues with ties midi.js
%%score 1
L:1/4
Q:1/4=120
M:3/4
I:linebreak $
K:C
V:1 treble nm="Sheng, melody" snm="She."
V:1
^B A B - |$ "^!this should be C" B3 | ^F E F - | "^!This should be F#" F3 |]
Yields in zupfnoter based on midi.js
But it sounds correct in http://moinejf.free.fr/js/edit-1.xhtml
We tried upgrading from 1.12.10 to a recent build (8e76f3b) - and we started having these errors.
This happens on Electron+Webpack+Angular. A smaller test app with Webpack+Angular works fine.
index.html:21 Uncaught ReferenceError: exports is not defined
at eval (eval at webpackJsonp.../../../../script-loader/addScript.js.module.exports (scripts.bundle.js:63), <anonymous>:21:253829)
at eval (<anonymous>)
at webpackJsonp.../../../../script-loader/addScript.js.module.exports (scripts.bundle.js:63)
at Object.../../../../script-loader/index.js!../../../../../src/vendor/abc2svg/abc2svg-1.js (scripts.bundle.js:72)
at __webpack_require__ (inline.bundle.js:55)
at Object.13 (scripts.bundle.js:127)
at __webpack_require__ (inline.bundle.js:55)
at webpackJsonpCallback (inline.bundle.js:26)
at scripts.bundle.js:1
We will try to isolate this, but if you have any ideas or suggestions, please let us know.
Thx
I'm trying to use AbcPlay. When I call play it throws this
GET http://127.0.0.1:3000//undefined-0/C0.0 404 (Not Found)
Uncaught (in promise) DOMException: Unable to decode audio data
Heres my code:
function play () {
if (position == 2) {
abcPlay.stop();
endplay()
return
}
position = 2
if (!abcPlayEvents) { // if no playing event
if (!abcPlay) {
abcPlay = new AbcPlay({
endplay: endplay
})
abcPlay.clear();
}
abcPlayEvents = abcPlay.clear() // keep the playing events
}
abcPlay.play(0, 100000, abc)
}
I think this is related to the soundfont url but isn't there a default? When I try:
abcPlay.set_sft(0)
abcPlay.set_sfu('http://moinejf.free.fr/js/FluidR3_GM')
it throws these errors:
GET http://moinejf.free.fr/js/FluidR3_GM/undefined-0/C0.0 404 (Not Found)
decode_note @ play.js:5
play_start @ play.js:5
Audio5.Audio5.play @ play.js:5
app.play @ main-debug.js:1038
(anonymous) @ VM6950:1
index-debug.html:1 Failed to load http://moinejf.free.fr/js/FluidR3_GM/undefined-0/C0.0: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:3000' is therefore not allowed access. The response had HTTP status code 404.
And now I think its the instrument but can't find the func to set the instrument. It'd be great if there were documentation for this.
I admit to have a strange issue. I imported a piece from somewhere else which has Key changes and transpositions in one voice only.
The following abc code is an extract of W.C.Handy's "St.Louis blues". As I integrated play-1.js to Zupfnoter and provided to loaders for the player (one from ABC-Model, one from Zupfnoter-Model which gets its pitches by midi.js AbcMIDI), I expected both to sound the same. But (according to murphy's law - surprise, surprise :-) they don't!
When I remove the I:transpose -2 in V:1, then V2 renders correctly.
X:348
F:348_abcsvg-issue-46
T:46 Blues midi.js
%%scale 0.83
%%pagewidth 21.01cm
%%leftmargin 1.00cm
%%rightmargin 1.00cm
%%score 1 4
L:1/8
Q:1/4=140
M:4/4
I:linebreak $
K:C
V:1 treble transpose=-2 nm="Sopransaxofon" snm="S. sax."
V:4 bas nm="Double Bass" snm="Db."
L:1/4
V:1
I:transpose -2
|: [K:A]"A7" cecA- A4 | %18
"D7" z =F^FA =c2 BA|
%V
V:4
|: [K:G] G, =F, "^!^ this should be E not D#" E, D, | C, D, ^D, "^!^ this should be E not D#"E, |
Zupfnoter with midi.js in commit bf816c7 yields the correct notes vor V:4
Zupfnoter with midi.js from commit 23f3bb5 yields wrong notes (note that commit 1e156fd was crashing)
It appears that we still have some trouble with accidentals. In the upper voice it also looks strange, that we have two neutrals caused by the key switch.
I stumbled over a block symbol in the model but do not have a handler for it. What is it, and now shall I treat it (if not simply ignore)
The following code causes abc2svg to crash in line introduced by commit 0928c89
If you remove the % in line 18, it works fine.
X:3049
F:3049_github_issue-49
T:https://github.com/moinejf/abc2svg/issues/49
%%score 1 4
L:1/8
Q:1/4=140
M:4/4
I:linebreak $
K:C
V:1 treble
V:4 bas
L:1/4
V:1
I:transpose -2
z eec |:"Am" Z |1 %7
"Am" Z | Z :|2
%remove percent in next line - the crash disappears
%"Am" "x"e |]%29
%
V:4
z2 |: %6
Z |1 Z | Z "^@@5":|2
z/ |] %29
in the following stackdump abc2svg-1 was created by ninja
Bug Cannot read property 'undefined' of undefinedTypeError: Cannot read property 'undefined' of undefined
at draw_gchord (http://localhost:9292/assets/abc2svg-1.self.js?body=1:20139:19)
at draw_deco_staff (http://localhost:9292/assets/abc2svg-1.self.js?body=1:1754:4)
at draw_sym_near (http://localhost:9292/assets/abc2svg-1.self.js?body=1:5386:2)
at output_music (http://localhost:9292/assets/abc2svg-1.self.js?body=1:12074:4)
at generate (http://localhost:9292/assets/abc2svg-1.self.js?body=1:18197:2)
at end_tune (http://localhost:9292/assets/abc2svg-1.self.js?body=1:7171:3)
at Abc.tosvg (http://localhost:9292/assets/abc2svg-1.self.js?body=1:7224:5)
at $Abc2Svg.$draw (http://localhost:9292/assets/opal-abc2svg.self.js?body=1:137:17)
at $Controller.$render_tunepreview_callback (http://localhost:9292/assets/controller.self.js?body=1:537:35)
at http://localhost:9292/assets/controller.self.js?body=1:601:43
io.self.js?body=1:140
the following file causes an endless loop. Reason seems to be the line K
after K:C
. If I remove this, it no longer hangs
X:22
T:Testcase with K
M:4/4
L:1/4
Q:1/4=120
K:C
K
%
%
%%score 1 2
%
V:1
c
The following ABC-code does not render properly on 1.14.4
Issue was introduced in commit 8cbc097
X:3045
F:3045_unreferenced-voices
T:unreferenced voices
C:
S:
M:4/4
L:1/4
Q:1/4=120
K:C
%
%
%%score 1 2 3 4
%
V:1 clef=treble name="Sopran" snm="S"
c
V:2 clef=treble name="Alto" snm="A"
B
V:3 clef=bass name="Tenor" snm="T"
C
V:4 clef=bass name="Bass" snm="B"
I get
Also get messages on console
jquery-3.0.0.min.js?dev:3 Error: attribute d: Expected number, "mNaN 161.00v21.00".
oa @ jquery-3.0.0.min.js?dev:3
jquery-3.0.0.min.js?dev:3 Error: attribute x: Expected length, "NaN".
oa @ jquery-3.0.0.min.js?dev:3
jquery-3.0.0.min.js?dev:3 Error: attribute x: Expected length, "NaN".
oa @ jquery-3.0.0.min.js?dev:3
jquery-3.0.0.min.js?dev:3 Error: attribute x: Expected length, "NaN".
oa @ jquery-3.0.0.min.js?dev:3
jquery-3.0.0.min.js?dev:3 Error: attribute d: Expected number, "mNaN 201.00v21.00".
oa @ jquery-3.0.0.min.js?dev:3
jquery-3.0.0.min.js?dev:3 Error: attribute x: Expected length, "NaN".
oa @ jquery-3.0.0.min.js?dev:3
jquery-3.0.0.min.js?dev:3 Error: attribute x: Expected length, "NaN".
oa @ jquery-3.0.0.min.js?dev:3
jquery-3.0.0.min.js?dev:3 Error: attribute d: Expected number, "mNaN 262.00v21.00".
oa @ jquery-3.0.0.min.js?dev:3
jquery-3.0.0.min.js?dev:3 Error: attribute x: Expected length, "NaN".
oa @ jquery-3.0.0.min.js?dev:3
jquery-3.0.0.min.js?dev:3 Error: attribute x: Expected length, "NaN".
Not sure if this is something that can be enabled in ABC...
What we are looking to show the numbering of the 1st bar of each line.
Thx
This one is quite simple to explain.
We would like to be able to speed up / slow down the playback by a factor of N. This could be made available to users via a slider.
After reading through play-1.js, it seems that the only way to do it now is to redo the abc conversion with a different BPM setting.
Something like "set_speed_factor" with a float (<1 == slowdown, >1 == speedup) would be great.
Thanks
Hello. When I try to run in a command line I got the following error:
Using the following setup
Win10, node v7.4.0, npm v.5.3.0
package.json
...
"scripts": {
"start": "abc2svg z.xml z.abc"
}
..
npm start
abc2svg z,xml z.abc
....\abc2svg\toxhtml.js:34
abc.blk_out(); ^
TypeError: Cannot read property 'blk_out' of undefined
at abort (.....\toxhtml.js:34:5)
at do_file (....\node_modules\abc2svg\cmdline.js:62:3)
at abc_cmd (.....\node_modules\abc2svg\cmdline.js:97:3)
at Object. (....\node_modules\abc2svg\abc2svg:81:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
is there a way to call a function in abc2svg to render abc that is stored in a variable? it looks like it's mostly designed to be used as an editor. but im manipulating computationally as opposed to manually in a textarea.
Hello!,
it seems I've detected a bug when rendering SVG images from ABC, only for certains dimensions.
You can see the effect at this screenshot from the software I'm developing using abc2svg library (https://spheras.github.io/backingtrainer/). At this screenshot I use the last version of abc2svg 1.13.7 (currently, the official released version use an old one -1.12.6- which doesn't seems to have the bug)
It seems that the anno_start function, in some cases where one measure need to be split/wrap in two lines like in the screenshot, it reports an inexistent note figure.
Highlighted in blue is the box that is reported.
The following is an example of ABC where you can see the problem. The anno_start function report 2 inexistent notes. The first one is the number 317 figure reported, the second the 551.
X:1 T:J. S. Bach (BWV 244 No. 49) T:Aria: "Aus Liebe will meinx Heiland sterben" T:Interpretation for Flute & Harp by Mike Magatagan 2017 Z:Aria: "Aus Liebe will mein Heiland sterben" (BWV 232 No. 49) by J.S. Bach Arranged for Flute & Harp by Mike Magatagan Z:Mike Magatagan ([email protected] or Mike Magatagan on http://www.MuseScore.com) %%scale 1 %%pagewidth 11cm %%leftmargin 0cm %%rightmargin 0cm L:1/16 Q:1/4=48 M:3/4 I:linebreak $ K:C V:1 treble nm="Flute" snm="F" %%MIDI program 73 %%MIDI control 7 74 %%MIDI control 10 1968.5 V:1 "^Aria"!mf! A4 | (e6- e/f/e/d/){d} (e2>c'2) |{e} d8 b4- | b(c'ba) (ba^g^f edcB) |$ %4 (BdcB){B} A4 z (Ace) | (fefa c'bag) fef2- | f(^deg bagf) e=de2- |$ e(^cdf agfe) dcd2- | %8 d(fed b^gfe) dB^c2- | c(B^ce ag^fe) ^dB=c2- |$ c(Bc^d ^f^gab) c'ab2 | b4- b(fed eBc^G) | %12 (A/c/^d/^f/a2- a)^g/f/ec'- c'b/a/ga |$ (a3g/f/) (eaed) dbdc | (cBA^G) (ABcd) (efeg) | f12- | %16 f(c'ba ba^g^f) edb2- |$ bde^G (Aceg) (fb)(fe) | (dcBc){B} A4 z4 | z2 b2- b(agf) ede2- | %20 e(^cdf agfe) dcd2- |$ d(fed) (b^gfe) dB^c2- | c(B^ce) (ag^fe) ^dB=c2- | c(Bc^d ^f^gab) c'ab2 |$ %24 b4 z4 z4 | z12 | z12 | z4 z4 g4- |$ g(fed) e(Bce) (abc'a) |{g} f8 d'4- | d'(c'ba gfe)f{f} d'2>f2 | %31 {f} e12- |$ e_ede (ab)(bc') c'(eed |{c} B4- B)_aag g^ffg | %34 (g/c'/b/a/)(g/c'/)c (c/d/e2)d (Td3c/d/) | c4- cdcB (ce/f/g)e |$ c4- c(dcB) (ce/f/g)e | %37 (_b3a/g/) f4 (e2>f2) | f4- f(gfe) (fa/^a/)(c'=a) | f4- f(gfe) (fa/_b/)(c'a) |$ %40 (_e'3d'/c'/) _bg a4 _a2- | a^fg2- g^a(d'c' a)(=a/g/)(fg) | (c^Ac^f) (agf_e dcA=A) | %43 (_BABd) (ed^cd) (ga)_b2- |$ b^ga2 z4 z4 | a6 (a/_b/a/g/) (a2>d'2) | g12- | g(agf ed^c_B AGFE) |$ %48 (GA^A^c def^g) (ag)(ba) | a12- | a2^g2 (g2a2) b4- | b2a^g (abc'd') (c'bag) |$ (a4- agfe) (d^cd2- | %53 d4) z4 z4 | z (fed) (b^gfe dB)^c2- | c(B^ce) (ag^fe) ^dB=c2- |$ c(Bc^d ^f^gab c'a)b2- | b4 z4 z4 | %58 z12 | z12 | z12 | z4 z4 A4 | (e6- e/f/e/d/){d} (e2>c'2) |{e} d8 b4- |$ b(c'ba) (ba^g^f edcB) | %65 (BdcB){B} A4 z (Ace) | (fefa c'bag) fef2- | f(^deg bagf) e=de2- |$ e(^cdf agfe) dcd2- | %69 d(fed) (b^gfe dB)^c2- | c(B^ce ag^fe) ^dB=c2- |$ c(Bc^d ^f^gab c'a)b2 | %72 b4- b(fed) e[Q:1/4=64.00]"^rit."(Bc^G) | (A/c/^d/^f/a2- a)(^g/f/e)c'- c'(b/a/)(ga) | %74 !fermata!a12 |] %75
The user data I put to the library when detecting this problems is:
'imagesize': 'width=320', 'page_format': true
`
Is there a way to force the library not to split a measure in two lines? This way I could avoid the problem.
Now I'm detecting, and ignoring, those cases when the box of the reported note is overlapping the clef, but is not working in all the cases.
By the way, thank you for this great library! It is amazing!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.