Sound

Differences between revisions 38 and 39
Revision 38 as of 2010-09-29 15:23:48
Size: 25046
Editor: eth0
Comment:
Revision 39 as of 2010-10-01 11:37:50
Size: 25050
Editor: client-80-3-169-189
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
{{attachment:cases.png}} {{attachment:mockup.png}} {{attachment:cases.png}} {{attachment:Screenshot.png}}

So that people can easily change sound volume and control music playback, there should be a unified sound menu taking the place of the Gnome mixer_applet2 and the notification area items for Rhythmbox, Banshee, and Amarok.

cases.png Screenshot.png

We also offer this design, and its associated APIs, to the Kubuntu and KDE communities as a foundation for a possible replacement of the kmix applet.

Artwork requirements

Beyond icons that are already included in themes:

  • A new named icon, audio-volume-low-zero-symbolic: a speaker with zero sound waves emanating.

  • A new named icon, audio-volume-muted-blocking-symbolic (sound is playing, but it is muted): the same as audio-volume-low-zero-symbolic, but in the error color. (We are aware that this color-only difference will not be noticable for monochromats and some dichromats.)

  • A new named icon, audio-output-none-symbolic (no output devices are available): the same as audio-volume-zero, but in outline form.

  • Zero-volume and maximum-volume icons for a microphone. What should their names be?

  • A custom ♫ icon.
  • Custom scrub bar rendering.
  • Play, Pause, Previous, and Next button rendering.

The menu should give easiest access to the volume of the primary sound output device and the primary sound input device. Other devices can be accessed through the Sound Preferences window.

Except where specified, the menu should inherit all the normal behavior and keyboard navigation of a standard menu. Test case: With the volume slider item highlighted, press Page Down. The highlight should move to the bottom item in the menu. Test case: With the “Mute” item highlighted, press Left. The sound menu should close and the menu to its left in the panel should open.

Title

Whenever there is no primary sound output device (because no available output devices have been detected yet), the title of the menu should be audio-output-none-symbolic (in the default theme, an outline version of the speaker icon).

If there are any available output devices:

  • The title of the menu should be an icon roughly representing the current volume for the primary output device: audio-volume-muted-panel, audio-volume-low-zero-symbolic, audio-volume-low-symbolic, audio-volume-medium-symbolic, or audio-volume-high-symbolic (which, in the default theme, should be a speaker icon with zero to three sound waves). The icon should be updated even if the volume is being changed while the menu is open.

  • If the sound is muted and the computer begins “playing” sound, the icon should switch instantly to audio-volume-muted-blocked-symbolic (in the default theme, a red version of audio-volume-muted-panel), persist for five seconds after sound stops playing, then take one second to fade back to audio-volume-muted-panel.

  • As a hidden treasure, when the pointer is over the title, whether the menu is open or not, clicking a mousewheel up or down should increase or decrease the volume respectively, to the nearest 10-percent step.

“Mute”/“Unmute”

The first item, “Mute”, makes it easy to urgently silence unwanted sound using a pointing device. If there are no available sound output devices, the item should be insensitive. Activating the item should mute all output devices, while remembering their previous volumes. After being chosen, “Mute” should change to “Unmute”.

“Unmute” should return all output devices to the volume settings they had immediately before “Mute” was selected. Either choosing “Unmute”, or changing any volume setting manually, should change “Unmute” back to “Mute”.

Output volume item

If there is a primary sound output device, the menu should contain an item for changing its volume, followed by a separator. The Up and Down keys should navigate between the volume item and other items, just as for a normal menu item. The item should highlight when navigated to, or on mouseover, just as normal menu items do, but the item should not be activatable (clicking it or pressing Enter should not close the menu).

The item should contain three individual interactive elements.

  1. A borderless, mouseover-less button that sets the volume to zero (as distinct from muting it). The icon for the button should be audio-volume-low-zero (in the default theme, a speaker with no sound waves).

  2. A slider that lets you set the volume more precisely. Whenever sound is muted, the slider should temporarily be at zero. Unmuting should return the slider to its previous position.
  3. A borderless, mouseover-less button that sets the volume to maximum. The icon for this button should be audio-volume-high (in the default theme, a speaker with three sound waves).

Whenever the volume item is highlighted:

  • The Left and Right arrow keys should instantly decrease or increase the volume, respectively, to the nearest 5 percent step.
  • The “-” and “+” keys should instantly decrease or increase the volume, respectively, to the nearest 5 percent step.
  • Rolling a mousewheel up or down should increase or decrease the volume respectively, 10% per click.
  • Ctrl Left and Ctrl Right should decrease the volume to 0 percent or increase it to 100 percent, respectively. (This overrides the normal large-step behavior of Ctrl Left and Ctrl Right with GTK sliders.)
  • None of the elements should have a visible focus ring, and Tab and Shift Tab should not do anything. (There are enough other ways to activate each of the elements, and a focus ring inside part of a highlighted menu item would be ugly.)

Changing the volume with the volume item should provide the same audio feedback as changing the volume any other way (such as with the volume keys on the keyboard), but should not generate notification bubbles.

Implementation: The PulseAudio async API takes care of detecting different devices and whether there is sound coming out of them. There will be need to be a connection to either Pulse or HAL to detect the addition of new devices. This could be something like plugging in a new USB headset.

Microphone volume item

microphone-slider.png

If a VoIP audio stream is active (media.role=phone) and the computer has a detected microphone, the output volume item should be followed by a microphone volume item. The microphone volume item should look and behave exactly the same as the output volume item, except that the button icons should feature a microphone rather than a speaker.

Music player section

There should be an API that lets a music player add a section to the sound menu. Multiple compliant music players may result in multiple music sections, ordered alphabetically by application name. (In future, there may even be multiple sections for the same player.)

A compliant player should not insert itself into the menu merely because it is installed, but should insert itself as soon as you start actively using it (e.g. playing something with it for the first time, or adding music to its library). The player’s own settings interface should also have a checkbox for whether to integrate the player into the sound menu:

  • ☑ Show FooPlayer in the sound menu

Future work: Add a “Where?” button that shows you where the sound menu is, using the same highlighting mechanism introduced for applications in Ubuntu Software Center.

Suggestion: It would be nice to be able to chose between "never show FooPlayer in the sound menu", "always show FooPlayer in the sound menu" and "show FooPlayer in the sound menu only when playing" (with an appropriate wording)

A compliant player should also keep playing if you close its window while it is playing; exit if you close its window while it is not playing; and remember exact state across sessions, so that after exit and relaunch it is as if the player had never exited.

A music section should consist of an item for the music player itself, followed by any or all of a track metadata item, a scrub bar item, a playback item, track-specific custom items, a playlist submenu, and player-global custom items. Some of these items are present only when the player is running.

For the purpose of the following sections that describe these items, the active track for a player is the track that is playing, that is paused, or that would play if the Play command was given (if this is known ahead of time). At any time, a player may or may not have an active track.

Music player item

This item should be present regardless of whether the player is running.

The item should consist of a ♫ icon and the name of the music player. A player should also be able to specify custom text that is presented, in brackets, after the name of the application name in the menu (most players will not need to do this). Choosing the item should launch the player; if the player is already running, it will switch to an existing instance.

Track metadata item

If the music player is not running, or if it is running but has no active track, this item should not be present at all.

If there is an active track, the item should consist of the track or album art on the leading side, and three rows of text on the trailing side. If no track or album art is available, it should fall back to a generic track icon. The text should be the track name, artist, and album, one on each line (aligned the same way as the rest of the menu, regardless of what language each string is in). For each line, if there is not enough room in the menu to display all the text, it should be ellipsized in the middle; and if the data is not known, the line should be left blank. This assemblage should be highlightable and activatable like a single normal menu item; as a hidden treasure, activating the item should copy the album art and track metadata to the clipboard.

There should be a D-Bus API for exporting info about the playing track (not the same as the active track) for use elsewhere (for example, setting a custom IM status).

We need precise fonts, sizes, and spacing specified for these elements.

Scrub bar item

If the music player is not running, or if it is running but has no active track, this item should not be present at all.

If there is an active track, this item should be a scrub bar, with the time elapsed at its leading end (e.g. “0:31”), and time remaining in at least minutes and seconds at its trailing end (e.g. “1:31:54”). There should be enough space reserved at each end of the scrub bar to show the full length of that track (so if the menu happens to be open when tracks change, the scrub bar may change length). The scrub bar and times should update live while the menu is open.

The scrub bar item should be navigable with a pointing device or keyboard in the same way as a normal menu item, but should not be activatable. In addition:

  • The scrub bar should be manipulable with the mouse (by dragging the thumb, or clicking in the trough) regardless of whether the item is highlighted.
  • When the item is highlighted, the left and right arrow keys should scrub backwards or forwards through the track, accelerating as long as the key is held down.

Playback item

The playback item should consist of a large play/pause button in the middle, with Previous and Next buttons on the sides. If something is playing, the main button should be Pause. If nothing is playing, the main button should be Play.

If the player is not running, or if it is running but has no active track, the playback item should not be present by default. However, the API should provide a way for a player to register a Play action, so that the play button can work even when the player is not running. If this has been done, the whole playback item should be present, but the Previous and Next buttons should be insensitive.

The API should also provide a way for a player to make the Previous and Next buttons sensitive or insensitive, and to turn the Play button into a Pause button and back again.

The playback controls item should be navigable in the same way as a normal menu item; selecting the item should activate the Play/Pause button. In addition, when the item is highlighted:

  • Pressing the Space key should activate the Play/Pause button.
  • The Left and Right keys should activate the Previous and Next buttons respectively.
  • None of the elements should have a visible focus ring, and Tab and Shift Tab should not do anything. (There are enough other ways to activate each of the elements, and a focus ring inside part of a highlighted menu item would be ugly.)

sound-menu-v2.jpg

To do: Mock up the menu with the ♫ icon in the left margin, to see how it looks.

Track-specific custom items

The API should let the music player provide up to three track-specific custom menu items — for example, for buying, “liking”, or “banning” the song currently playing. Any of these items may be a submenu containing other items.

Playlist submenu

This can be implemented last, since players don’t currently provide API access to playlists. For 10.10 we aim to extend the MPRIS spec to allow playlists to be properly managed and implement playlist support for rhythmbox in its current DBus API state

The MPRIS API should let the player expose icons and names of playlists, even when the player is not running.

The playlist item should be present in the menu only if the music player is currently exposing any playlists. If the player also indicates that it is playing (or is paused partway through) a playlist, the submenu title should be the name of the playlist. Otherwise, it should be “Choose Playlist”.

The submenu itself should contain items named for each of the playlists. Selecting an item should start playing that playlist.

Player-global custom items

Not targeted for Maverick.

The API should let the music player provide up to three player-global custom menu items, even when the player is not running. Any of these items may be a submenu containing other items, for setting equalizer settings for example.

“Sound Preferences…”/“Sound Settings…”

The menu should end with a separator, followed by a “Sound Preferences…” item that opens the Gnome Sound Preferences window. (A Kubuntu version of this menu item would be “Sound Settings…”, and would open the Sound panel in KDE System Settings.) Launch feedback for this item should be exactly the same as when you launch an application any other way.

(If PulseAudio is not running when you choose “Sound Preferences…”, gnome-volume-control should try to start it. If it fails, it should invoke Apport during the development cycle, or an error alert in a stable release. This is outside the scope of the menu; it should be part of the specification for the Sound Preferences themselves.)

Handling upgrades

When you log in to a version of Ubuntu that implements this sound menu, and you are running a gnome-panel that includes mixer_applet2, that applet should automatically be removed from your panel configuration.

Music player integration

Registration process

Each player should use a similar approach used with Ted Gould’s app indicators in order to enable remote control from the sound menu.

This is very straightforward. Here is an example of the mandatory override method of a Rhythmbox plugin in Vala which basically establishes Ayatana registration.

  • public override void activate (RB.Shell shell) {

    • debug("Rhythmbox - Hello Ayatana world\n");

      server = Server.ref_default();

      server.set("type", "music.rhythmbox");

      server.set_desktop_file("/usr/share/applications/rhythmbox.desktop");

      server.show();

 } 

The advantage of using libindicate is that no matter happens, on client shutdown, the sound service will be notified of the event. Similarly for start up this mechanism provides a clean fool-proof approach for dynamic registration without relying on PulseAudio's client/stream labelling. Also it enables the menu to start the client if it is not already running through the desktop file path set at registration.

Bindings for libindicate exist for Python, Vala, Mono and C are available. https://launchpad.net/libindicate. Please contact Conor if you need any help with this (https://launchpad.net/~cjcurran) .

Registration will need to be disabled if a user would prefer for a certain player not to be controllable from the menu. Guidelines as to how this preference is to be represented in the UI of the client (specifically Rhythmbox, Banshee or Amarok) has been included below. We would like to provide a unified music player experience on the Ubuntu platform therefore we strongly urge application developers to follow this spec.

In order to test client registration, application developers should fetch the latest lp:indicator-sound release from the indicator-sound-developers ppa here (https://launchpad.net/~indicator-sound-developers/+archive/sound-menu-v2-deps).

To load the new menu.

  • Remove the indicator applet from the panel
  • Open a terminal and type "killall indicator-sound-service"
  • Then add the indicator-applet back to the panel.

Successful registration of a client will result in an extra item being placed in the sound menu with the text "$client_name registered". When the player exits this item will be removed from the menu.

Rhythmbox

  • Rhythmbox should be altered to comply with the standard behavior: it should keep playing if closed while playing, it should exit if closed while not playing, and it should restore location and other state on relaunching.

  • The “Status Icon” plug-in for Rhythmbox should be replaced by notifications integrated into Rhythmbox itself. The layout of the “General” tab in Rhythmbox’s “Preferences” window should be adjusted — by changing the “Browser Views” radio buttons to a “Browser views show:” option menu, and by changing the two columns of “Visible Columns” checkboxes to three columns of “Track listings show:” checkboxes — to make room for a “Notifications for playing tracks:” option menu. This menu should contain three items: “Always”, “When Rhythmbox is hidden”, and “Never”. On first launch of a version of Rhythmbox that integrates notifications in this way, the configuration for the “Status Icon” plug-in (if any) should be mapped to the equivalent value for the “Notifications for playing tracks:” menu. If the plug-in had been disabled, the value of the new setting should be “Never”.
  • The “General” tab in Rhythmbox’s “Preferences” window should also include a “Show Rhythmbox in the sound menu” checkbox. The option should be off by default for a new user account, but should turn itself on automatically when you first play something or add items to the music library.

    rhythmbox-preferences-old.png

    rhythmbox-preferences-new.jpg

    rhythmbox-plug-in-old.png

Banshee

  • Banshee should be altered to comply with the standard behavior: it should keep playing if closed while playing, it should exit if closed while not playing, and it should restore location and other state on relaunching.

  • Banshee should no longer have a notification area item.
  • At the end of the “Miscellaneous” section in the “General” tab in Rhythmbox’s “Preferences” window should be a “Show Banshee in the sound menu” checkbox. The option should be off by default for a new user account, but should turn itself on automatically when you first play something or add items to the music library.

    banshee-preferences-old.png

Not targeted for Maverick.

  • In the sound menu, Banshee should have one track-specific item: a “Rating” submenu, with “☆☆☆☆☆”, “★☆☆☆☆”, “★★☆☆☆”, “★★★☆☆”, “★★★★☆”, and “★★★★★” radio items, that sets the rating for the active track.

Not targeted for Maverick.

  • In the sound menu, Banshee should have two player-specific items:
    • a “Repeat” submenu, with “Off”, “This Track”, and “All” radio items;
    • a “Shuffle” submenu, with “Off”, “by Song”, “by Artist”, “by Album”, “by Rating”, and “by Score” radio items.

Amarok

Whenever Amarok is running in an environment where the sound menu is present:

  • It should comply with the standard behavior: it should keep playing if closed while playing, it should exit if closed while not playing, and it should restore location and other state on relaunching.

  • It should no longer have a notification area item.
  • In the “General” section of the “Configure - Amarok” window, the “Show tray icon” checkbox should be replaced by a “Show Amarok in the sound menu” checkbox. The option should be off by default for a new user account, but should turn itself on automatically when you first play something or add items to the music library.

    amarok-configure-old.png

Upstream implications

  • Development of an API
  • Media Player changes:
    • Support API
    • Use notification area
    • Amarok will need to detect whether the sound menu is present.

Specifications involving FreeDesktop:

Future work

  • Integrate Totem.
  • Show multiple sound outputs separately.
  • Integrate application-specific volume settings.
  • Sound configuration and management.
  • Consider http://pulseaudio.org/wiki/WritingVolumeControlUIs#Colouredvolumesliders

  • Should equalizer settings go into the system? (or should they be track-specific/application-specific)
  • Respect surround-sound in the menu and in the settings window
  • Fade out other audio automatically if you receive a VoIP call? (Where would a setting for this go?)
  • Return of the scrub bar?

Risks

  • People may be disconcerted that something appearing to be a volume menu contains items for a music player. Or they may think that the presence of those items means that the volume is specific to the music player rather than system-wide. We should perform user testing once we have a basic implementation.

Unresolved issues

  • We need a high-fidelity visual mockup to help us decide the width of the track metadata and scrub bar, and therefore the overall width of the menu.
  • We need an animated mockup of each item being highlighted as you navigate through it.
  • How to turn the sound menu off completely? (currently gnome-volume-control won’t open if isn’t running — leave till Maverick+1?)
  • The MPRIS v2 in its current state doesn't support playlists, see below.

Proposed playlists extension

Alex Merry wrote an extension for listing and selecting playlists: http://www.randomguy3.me.uk/mpris/Playlists.html

Sound (last edited 2017-03-30 15:52:16 by mpt)