schellingb / TinySoundFont

SoundFont2 synthesizer library in a single C/C++ file
MIT License
623 stars 72 forks source link

Player ending before end of music (not playing last notes) #78

Open Willyb30 opened 1 year ago

Willyb30 commented 1 year ago

Hello, I'm trying alphatab js and i'm facing an issue : The player is not playing the last notes. I've been experiencing that on the demo example found on web gettings started https://alphatab.net/docs/getting-started/installation-web

the demo is providing 17 notes but only 12 are played before the player stops After some searches i've found that some notes absolute display time are up to 10560 ans the player is stopping at 6000

Here is the code i used

    <!-- Include alphaTab cdn -->
    <script src="https://cdn.jsdelivr.net/npm/@coderline/alphatab@latest/dist/alphaTab.min.js"></script>

    <!-- Create Element which should contain alphaTab -->
    <div id="alphaTab" data-tex="true">
        \title "Hello alphaTab"
        .
        :4 0.6 1.6 3.6 0.5 2.5 3.5 0.4 2.4 | 3.4 0.3 2.3 0.2 1.2 3.2 0.1 1.1 | 3.1.1
    </div>
    <button onclick="play()">play</button>
</body>

<script>
    const element = document.getElementById('alphaTab');
    const apisettings = {
        <!--file: "https://www.alphatab.net/files/canon.gp", //same issue with the file-->
        player: {
            enablePlayer: true,
            soundFont: 'https://cdn.jsdelivr.net/npm/@coderline/alphatab@latest/dist/soundfont/sonivox.sf2',

        }
    }
    const api = new alphaTab.AlphaTabApi(element, apisettings);

    function play() {
        api.play()
    }

</script>

I've tryied that on mac Chrome 116.0.5845.140 opera 101.0.4843.58 and Chrome PC Win 11 but the issue is the same on both systems