Vscode: Bell does not work in integrated terminal

Created on 12 Apr 2018  路  25Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.22.1 (commit 950b8b0d37a9b7061b6f0d291837ccc4015f5ecd)
  • OS Version: Ubuntu 17.10

Steps to Reproduce:

  1. Open an integrated terminal
  2. Type echo "\a"

Assuming your OS is configured to allow TTY, you should hear a bell. In a normal terminal, this works fine. In code's, it does not.

Does this issue occur when all extensions are disabled?: Yes

bug integrated-terminal upstream

Most helpful comment

Electron appears to offer a way to invoke the default system sound:
shell.beep()

https://www.electronjs.org/docs/api/shell#shellbeep

All 25 comments

Looks like there's an issue with the bell in the packages version of VS Code (not in the dev build):

Uncaught (in promise) DOMException: Unable to decode audio data

This may be related to Electron https://bugs.chromium.org/p/chromium/issues/detail?id=409402, should verify after we upgrade to Electron 2.

Not fixed in Electron 2?

I have the same problem with this in my machine:

Version: 1.31.1
Commit: 1b8e8302e405050205e69b59abb3559592bb9e60
Date: 2019-02-12T02:19:29.629Z
Electron: 3.1.2
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.19.13-1-MANJARO

(Plan to use this ASCII to ring some task when the compilation is finish 馃樄)
Maybe make the beep sound can be configured (like in KDE Konsole in my case) would fix it.

Hi, any idea when this will be fixed?

I am trying to add a bell sound at the end of my grunt task. It works fine in default terminal but not in the vscode integrated terminal.

Version: 1.33.1 (1.33.1)
Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8
Date: 2019-04-11T08:14:39.158Z
OS - macOS High Sierra (10.13.6)

I can also reproduce this issue in macOS with

echo -ne '\007'

VS Code: 1.34.0
macOS: 10.14.5

I'm seeing this too.

Even with terminal.integrated.enableBell enabled, running printf "\a" in the VS Code Integrated Terminal triggers no sound, despite the same command triggering a sound in my OS terminal.

MacOS 10.14.5

This appears to work in the demo so I suspect it's actually a bug in vscode rather than an upstream issue.

Works fine out of sources, in the product build I see this:

ERR Unable to decode audio data

Probably related to CSP

This is not related to CSP but because we strip out ffmpeg.

MP3s aren't decoded either, /cc @deepak1556

Seeing this in VS Code Version: 1.41.1 on Catalina.

Who's got the keys to the jeep? Not VS Code's terminal :(

Any updates on this?

@Tyriar sorry missed this one, mp3 isn't supported with the ffmpeg library we ship with. Only the following audio codecs are supported .opus, .webm, .flac.

For testing,

The dev build uses electron release from https://github.com/electron/electron/releases which bundles ffmpeg library with proprietary codec support. For product build we ship with a minimal version of ffmpeg, so to test please extract the ffmpeg library from https://github.com/microsoft/vscode-electron-prebuilt/releases according to the platform and replace it under vscode/.build/electron

* macOS
vscode/.build/electron/Code - OSS.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib

* linux
vscode/.build/electron/Code - OSS/libffmpeg.so

* windows
vscode/.build/electron/Code - OSS/libffmpeg.dll

Hey @deepak1556 thanks for reaching out on this thread :)

I'm surprised to think that the system bell would be an mp3 file, but I like the idea that different build commands could cause this. I mean, I'd prefer it not be, but I think it's a good start on troubleshooting if it's true.

It looks like the repo @ https://github.com/microsoft/vscode-electron-prebuilt might not be publicly accessible? The URL https://github.com/microsoft/vscode-electron-prebuilt/releases is a dead link for me.

Using that idea, though, I grabbed ffmpeg-4.2.2.zip from https://evermeet.cx/ffmpeg/ (linked to from ffmpeg's official download page), but it looks like this is a full-on executable whereas VS Code just has a library-specific build.

file libffmpeg.dylib
libffmpeg.dylib: Mach-O 64-bit dynamically linked shared library x86_64

I'm not familiar with building ffmpeg, but would it be possible for you to extract the build command that the vscode-electron-prebuilt repo. is using to generate the library? Or if it's easier, upload the pre-built binary?

For reference, I found my local path to the ffmpeg library for VS Code as:

/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib

The URL https://github.com/microsoft/vscode-electron-prebuilt/releases is a dead link for me.

The repo is private :)

but it looks like this is a full-on executable whereas VS Code just has a library-specific build.

Yeah VSCode or rather electron just relies on the shared library, which makes it easier to switch between libraries that have full codec support.

For your case, test with the library from https://github.com/electron/electron/releases/download/v7.1.11/ffmpeg-v7.1.11-darwin-x64.zip

Cool, grabbed the library, swapped it in and printf '\a' now makes a weird little noise. It's kind of soft and I think you could probably miss it if you weren't expecting it. Definitely not the system bell I'm accustomed to (i.e. printf '\a' in a Terminal window is a different sound). Do you know what would account for this?

Definitely not the system bell I'm accustomed to (i.e. printf '\a' in a Terminal window is a different sound)

That would be from https://github.com/xtermjs/xterm.js/blob/master/src/common/services/OptionsService.ts#L15

@Tyriar can talk for why it was chosen, as I don't have context on it.

But the issue here is the codec supported by ffmpeg we ship with, which should be fixed once we adopt the right one.

@deepak1556 I just found a public domain bell-like sound. xterm.js is a web app and doesn't have access to some system bell sound.

Using speaker-test in vscode terminal (Arch Linux) also fails to emit audio.
Outside vscode it is working fine.
```
speaker-test -t waw -c 6
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
Playback open error: -2,No such file or directory

Electron appears to offer a way to invoke the default system sound:
shell.beep()

https://www.electronjs.org/docs/api/shell#shellbeep

@fletch29 nice find, I created an upstream issue that blocks supporting it: https://github.com/xtermjs/xterm.js/issues/3014

MacOS work-around:
osascript -e "beep beep beep"

MacOS work-around:
osascript -e "beep beep beep"

Yes! Thank you @denishowew

Let's go deeper and create a bash alias that takes over beep right in ~/.profile

alias beep="osascript -e 'beep'"
Was this page helpful?
0 / 5 - 0 ratings