CoderLine / alphaTab

alphaTab is a cross platform music notation and guitar tablature rendering library.
http://www.alphatab.net
Mozilla Public License 2.0
1.23k stars 199 forks source link

Unclear docs for initializing alphaSynth (paths need to be rooted) #83

Closed ShredDead closed 7 years ago

ShredDead commented 8 years ago

alphatab

I have tried everything, including disabling NoScript, but I cannot get the soundfont to load in the player.html nor will Canon.gp5 render within the features.html file. I have the alphaTab-master folder loaded into my root testing server and on my live server, but nothing. But...it works on yours. What is the problem that I'm having?

Thanks.

Danielku15 commented 8 years ago

Can you check if there is any error written in the developer tools of the browser (F12). What WebServer are you running? If you're testing with IIS it might be that you need to add the .sf2 extension to the web.config so it get's provided to the clients:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <staticContent>
        <mimeMap fileExtension=".gp3" mimeType="application/gp3" />
        <mimeMap fileExtension=".gp4" mimeType="application/gp4" />
        <mimeMap fileExtension=".gp5" mimeType="application/gp5" />
        <mimeMap fileExtension=".gpx" mimeType="application/gp6" />
        <mimeMap fileExtension=".sf2" mimeType="application/soundfont2" />
        <mimeMap fileExtension=".woff" mimeType="application/woff" />
        </staticContent>
  </system.webServer>
</configuration>

Also check the "Network Analysis" tab in the developer tools when opening the page. You should see that the browser requests the default.sf2 and likely you get an error response.

ShredDead commented 8 years ago

I'm using Apache on my live and testing server. Here is a screenshot of Network within Firefox. But the file is there.

alphatab2

ShredDead commented 8 years ago

Here's another screenshot.

alphatab3

ShredDead commented 8 years ago

Okay! I figured the problem out. I cannot have the folder "alphaTab-master" within the root. All the files within that folder must be uploaded to the root directory! This should be corrected. How can this be resolved?

Also, there is an error in the index.html file of /Samples/JavaScript/ It is asking for featuress.html which needs to be corrected to features.html

Suggestion: Is there a way to have the tab scroll as it plays in Firefox? It works in Google Chrome. Because of not being able to do so it defeats the purpose of trying to play along while needing to use the mouse to scroll the window.

By the way, thank you for your efforts in providing an awesome tool for browser support!

Danielku15 commented 8 years ago

Adjusting the paths in the player.html accordingly should do the job. Change it like this:

var as = at.alphaTab('playerInit', {
    asRoot: '/alphatab-master/Samples/JavaScript/lib/alphaSynth/',
    swfObjectRoot: '/alphatab-master/Samples/JavaScript/lib/alphaSynth/'
}); // init alphaSynth

Since web workers run in a separate context within the browser, it's not easily possible to use relative paths to load the required scripts. I will need to write some docs to make it more clear how to setup the samples. Thanks for this finding.

Regardin the broken scrolling I added another issue: #84

ShredDead commented 8 years ago

Thank you. I did that earlier but maybe my browser needed to have the cache cleared. One other thing. In the file: player.html on the following line, data-tracks is not in sync with Guitar Pro.

<div id="alphaTab" data-file="files/Stratovarius.gp3" data-tracks="3"></div>

data-tracks="3" is actually 4 within Guitar Pro. So if I want to see the Solo guitar on track 2, I must select data-tracks="1"

alphatab4

Danielku15 commented 8 years ago

data-tracks is 0 indexed (like an array) and Guitar Pro starts with 1 of course for end-user display. This behavior is by design.

Danielku15 commented 7 years ago

Relative paths should not be a problem anymore, they are supported since quite a while. Initialization also became easier with the use of data attributes. Closing this issue.