Skip to content

enable a customizable sound to indicate successful/failed task completion #12466

Closed

Description

  • VSCode Version: 1.5.2
  • OS Version: Windows 10

It would be helpful to hear a sound at completion long running tasks.

Activity

  1. chrmarti commented on Sep 22, 2016

    @chrmarti
    Collaborator

    Or a visual notification could be helpful too.

  2. added
    feature-request
    on Sep 22, 2016
  3. dbaeumer commented on Sep 22, 2016

    @dbaeumer
    Member

    There is an issue requesting a proper status bar item for tasks.

  4. fantaclaus commented on Sep 23, 2016

    @fantaclaus

    I'm also waiting for this feature.

    It is very needed when the typescript compiler is working in a watch mode.

    So after a code change I could immediately switch to a browser. If there were no errors I will just refresh a page to see the changes. So I don't have to visually monitor the status bar of VSCode.

  5. dbaeumer commented on Sep 26, 2016

    @dbaeumer
    Member

    fantaclaus there is feedback if the tsc compiler is in watch mode. There should be a spinning ascii art next to the problem indicator in the status bat when the tsc compile is active in the background.

  6. rozzzly commented on Sep 26, 2016

    @rozzzly

    Really simple implementation. Allow items in the status bar to change their background color. Preferably just provide a method to set the css on that element so you can do css animations.

    Blinking red: failure
    Green: success.

    would be easy to return them to their original state as well


    I'd like to point out that it is possible to play sounds from the extension api. [timmyreilly/TypewriterNoises-VSCode]

    However, this is pretty hacky. It ships with an .exe for windows users that is uses child_process.execFile(...) to run that .exe (passes audio file path via cli argument) for other systems, it uses [shime/play-sound]which attempts to find a native media player to send the sound to (useschild_process.execFile(...)` aswell)

    But this terribly inefficient because it spawns a seperate process each time you trigger the sound. Plus you can't pause, seek, restart, etc. Hell there's not even a good way of telling if the sound is finished playing. Not to mention compatibility issues.

    It'd be cool to offer a easy way to do this. Would prob be easy considering vscode use electron which is basically a browser, which means it'll have access to the Web Audio Api so you just need to write a shim that interacts with it.

    [Click to Expand] I got inspired and wrote a simple api that vscode could implement

    import { Sound } from 'vscode';
    
    const errorSound = new Sound(someURI);
    // create a new sound
    errorSound.length(); 
    // number; eg: 5000 (ms)
    errorSound.play(); 
    // plays the from the current cursor position; if cursor is at the end of
    // the track move it back to the start and begin playing there
    // returns promise that resolves when the track has finished
    errorSound.play(start: number); 
    // plays the track from the specified start position until end of track.
    // returns promise that resolves when the track has finished
    errorSound.play(start: number, end: number); 
    // plays the track from the start position until the the end position.
    // returns promise that resolves when the track has finished
    errorSound.cursorPosition;
    // number; the current (ms) position of the 'cursor' in the track.
    errorSound.seek(time: number);
     // move 'cursor' to specified time. If playing, continue 
    // to play, otherwise remain stopped.
    errorSound.pause(); 
    // stop at current position
    errorSound.restart(); 
    // move 'cursor' to 0, and keep/start playing.
    // returns promise that resolves when the track has finished
    errorSound.isPlaying();
    // boolean, if the sound is playing
    errorSound.donePlaying(); 
    // boolean; true if the cursor is at the end of the track
    errorSound.stop();
    // stops playing the sound, cursor returns to 0
    errorSound.loop(times?: number); 
    // plays the sound specified number of times. 
    // Omitting a number makes it loop infinitely until stopped 
    // or restarted, but pause/resume don't stop it from looping
    // returns a promise that is resolved when looping is completed or stopped
    errorSound.loopsLeft;
    // false if not looping, undefined if looping infinitely or when looping for x ms.
    // otherwise gives the number of remaining loops (excluding
    // the current play through. So if you read this value while the loop
    // is in its last iteration, it returns 0. Or if you specify 10 loops,
    // on the first iteration this method would tell you 9 left.
    errorSound.loopFor(ms: number);
    // same behavior but dependant on elapsed ms instead of iterations.
    // pausing the track also pauses the elapsed timer until playing is resumed
    // probably should add an equivalent for loops remains. perhaps "loopTimeLeft"
    // returns a promise that resolves when the loop has finished.
    errorSound.dispose();
    // destroy that object. If there are no other instances of the same file, unload the audiobuffer/whatever
    const errorSound2 = errorSound.clone();
    // creates clone of the sound so that 2+ instances of the same sound
    // can be controlled independently. Maintain their own cursor 
    // position, playing status, loopsLeft, etc
    Sound.loaded // an array of each instance, but cloned duplicates are deduped
    Sound.all // an array of all the instances (including clones/duplicates)
    Sound.playing // an array of the instances that are currently playing.

    ...but then I realized that there are prob better preexisting libs out there built on top of the WebAudioApi with simple api.

    oh well 😒

  7. fantaclaus commented on Sep 26, 2016

    @fantaclaus

    Dirk Bäumer (@dbaeumer) you are right, there is a spinning indicator.

    But currently I have to watch it and wait until it stop spinning.

    I would rather prefer to use this time to review the code or to switch to a browser and be ready to reload a page as soon as I hear the sound of success.

    Moreover, at some workplaces I have only one monitor, and a browser takes its surface entirely. So I cannot see VSCode at the same time.

  8. ronjb04 commented on Oct 26, 2018

    @ronjb04

    any solution for this yet? i was hoping that vscode already has this sound feature when task is done

  9. alexr00 commented on Oct 16, 2019

    @alexr00
    Member

    Duplicate of #7090

  10. added
    *duplicate
    on Oct 16, 2019
  11. vscodebot commented on Oct 16, 2019

    @vscodebot

    Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.

    Happy Coding!

  12. fantaclaus commented on Oct 16, 2019

    @fantaclaus

    Alex Ross (@alexr00), how could the request for "customizable sound" be a duplicate for a request for "some visual feedback"? The sound is not a kind of visual effect, is it?

  13. alexr00 commented on Oct 17, 2019

    @alexr00
    Member

    The duplicate is about adding a post action to tasks. Visual feedback or a sound after a task are both types of post action.

  14. locked and limited conversation to collaborators on Nov 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*duplicatefeature-requesttasks

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions