Code covered by the BSD License  

Highlights from
SoundVolume - set or get the system speaker sound volume

5.0

5.0 | 3 ratings Rate this file 14 Downloads (last 30 days) File Size: 2.53 KB File ID: #25584

SoundVolume - set or get the system speaker sound volume

by Yair Altman

 

15 Oct 2009 (Updated 15 Oct 2009)

SoundVolume sets or gets the computer system's speaker sound volume, using Java

| Watch this File

File Information
Description

SoundVolume sets or gets the computer's system speaker sound volume
 
Syntax:
       volume = SoundVolume(volume);
 
SoundVolume(volume) sets the system speaker sound volume. The volume value should be numeric, between 0.0 (=muted) and 1.0 (=max).
 
volume = SoundVolume gets the current speaker sound volume (0.0-1.0).
 
volume = SoundVolume(volume) sets the system speaker sound volume and returns the previous volume value (from before setting the new value).
 
Note:
      SoundVolume relies on Java functionality that is fully supported and documented. In this respect, SoundVolume is different from some of my other Matlab-Java utilities that rely on undocumented code.
 
Bugs and suggestions:
      Please send to Yair Altman (altmany at gmail dot com)
 
See also:
      http://UndocumentedMatlab.com
      http://java.sun.com/docs/books/tutorial/sound

MATLAB release MATLAB 7.6 (R2008a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
03 Nov 2009 D Nguyen

I used this to integrate it with a GUI slider to control the system volume. Worked great! Had to slightly modify te code..
ctrls(ctrlIdx).getType to ctrls(ctrlIdx).getType.toString..with Yair Altman's help to get it to work on my system. Windows XP with MATLAB 7.0.4.365(R14) SP2, but otherwise works fine!

11 Mar 2010 Jay Casey

Yes, works perfectly but with the edition D Nguyen suggested! Thanks a lot!

18 May 2010 QurratulAin Rubab

I want to do these functions for my final year project
and i have been searching for so long
finally found this code but it is giving this error when executed

??? Undefined command/function 'toChar'.

Error in ==> opaque.char at 94
    chr = toChar(opaque_array(1));

Error in ==> SoundVolume at 83
        if ~isempty(strfind(lower(char(ctrls(ctrlIdx).getType)),'volume'))

:((
plz help me..

22 May 2010 andandgui isler

it doesn't work on my computer.. I want to control volume by using matlab but it didn't..

im using Matlab R2009b and Windows Vista..

can anyone help me?

26 May 2010 andandgui isler

anyone knows the steps of this process?

02 Mar 2011 Trevor Agus  
08 Apr 2011 Reid

I've had the same issue, but found a way around it.

In windows, open regedit, and select current user>control panel>sounds. Then select beeb and 'modify'. Where it says 'yes', type 'no' without quotes. Then just restart the computer. This turns off the beep for all applications, which works great for me, but may not be what you want.

14 Oct 2011 Joris Lambrecht

Does this work in Windows 7? I tried with and without D Nguyen's modification without success.

Please login to add a comment or rating.
Updates
15 Oct 2009

Clarified that SoundVolume uses fully documented and supported Java functionality.

Tag Activity for this File
Tag Applied By Date/Time
java Yair Altman 15 Oct 2009 10:28:59
sound Yair Altman 15 Oct 2009 10:28:59

Contact us at files@mathworks.com