Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loud clipping sound when playback ends #1599

Closed
1 task done
Danielku15 opened this issue Jul 29, 2024 · 6 comments · Fixed by #1609
Closed
1 task done

Loud clipping sound when playback ends #1599

Danielku15 opened this issue Jul 29, 2024 · 6 comments · Fixed by #1609
Assignees
Labels
area-player Related to the audio playback engine. platform-javascript Related to the JavaScript version of alphaTab state-accepted This is a valid topic to work on.

Comments

@Danielku15
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When the playback ends there is a chance of hearing some (clipping) noise at the end.

Expected Behavior

No clipping noise should occur, not on the first and not on second/third playbacks.

Steps To Reproduce

  1. https://bali182.github.io/stick/#/default/score
  2. image

Link to jsFiddle, CodePen, Project

https://bali182.github.io/stick/#/default/score

Found in Version

1.4 (alpha)

Platform

Web

Environment

- **OS**: Windows 11 Pro
- **Browser**: 126.0.6478.185

Anything else?

#1593
#1298

@Danielku15 Danielku15 added the state-needs-triage Bug not triaged yet. label Jul 29, 2024
@Danielku15 Danielku15 self-assigned this Jul 29, 2024
@Danielku15 Danielku15 added 🕷️ type-bug state-accepted This is a valid topic to work on. area-player Related to the audio playback engine. platform-javascript Related to the JavaScript version of alphaTab and removed state-needs-triage Bug not triaged yet. labels Jul 29, 2024
@bali182
Copy link

bali182 commented Aug 7, 2024

To make the repro simpler, here is an 1 file example. I just tweaked it until I could repro.

I added a bunch of random garbage dom nodes (to impact performance a bit), and that made it consistently reproducible.

I don't know if the config (notation/display settings) have anything to do with it, couldn't really find a consistent answer for that, so I just added the stuff I have.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>AlphaTab Click/Pop repro</title>
    <script src="https://cdn.jsdelivr.net/npm/@coderline/alphatab@alpha/dist/alphaTab.min.js"></script>
  </head>

  <body>
    <div id="alphaTab"></div>
    <div id="garbage" style="display: flex; flex-wrap: wrap"></div>
    <button onclick="api.playPause()">Play/Pause</button>
    <script type="text/javascript">
      const alphaTabDom = document.querySelector('#alphaTab')
      const score = `\\track "Bass" "Bass" \\instrument "AcousticBass"
      \\clef Bass \\ts 4 4 \\ks C 0.3.4 4.3.4 2.2.4 4.3.4 | 5.3.1`

      const api = new alphaTab.AlphaTabApi(alphaTabDom, {
        core: { tex: true, engine: 'svg' },
        notation: { elements: { guitarTuning: false, trackNames: false } },
        display: {
          staveProfile: 'Default',
          justifyLastSystem: true,
          barsPerRow: 4,
          resources: {},
        },
        player: {
          enableCursor: true,
          enableAnimatedBeatCursor: true,
          enableElementHighlighting: true,
          enablePlayer: true,
          enableUserInteraction: true,
          soundFont:
            'https://cdn.jsdelivr.net/npm/@coderline/alphatab@latest/dist/soundfont/sonivox.sf2',
        },
      })

      api.tex(score)

      // Adding a bunch of garbage to the dom, to make the browser work a bit
      const garbage = document.getElementById('garbage')
      for (let i = 0; i < 20000; i += 1) {
        const el = document.createElement('div')
        el.style.width = '1px'
        el.style.height = '1px'
        el.style.backgroundColor =
          '#' + Math.floor(Math.random() * 16777215).toString(16)
        garbage.appendChild(el)
      }
    </script>
  </body>
</html>

@Danielku15
Copy link
Member Author

Thanks a lot for your efforts. I hope this allows narrowing down the problem easier. I have a lot going on in private life currently and don't find a lot of time to develop on alphaTab. But I'll try to tackle this as one of the next things.

@bali182
Copy link

bali182 commented Aug 7, 2024

No worries, just wanted to make a repro, so tracking this down is not find Waldo in my code :) Hope all will be good in your private life mate!

@Danielku15
Copy link
Member Author

@bali182 Can you check if things are improving with 1.4.0-alpha.1112? I couldn't directly reproduce it locally on my quick tests with the latest setup but I found some suspicious bits in code which could explain bad samples being played.

@bali182
Copy link

bali182 commented Aug 8, 2024

Just updated, and it seems miles better on my end too. There is a little pop at the end, but that might just be because of the envlelope of the note, no loud cracks/clicks, well done! 👍

@Danielku15
Copy link
Member Author

1.4.0-alpha.1116 should fix the final bits that there are no major clicks when the song ends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-player Related to the audio playback engine. platform-javascript Related to the JavaScript version of alphaTab state-accepted This is a valid topic to work on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants