1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
% load some music
load handel;
player = audioplayer(y, Fs);
t = 3; % time of play in seconds
ts = [1 (get(player, 'SampleRate')*t)];
disp('Playing at current volume...');
playblocking(player,ts);
% read current volume
[left, right] = mx_volume('WAVE');
% set volume to a dummy value and play music
mx_volume('WAVE', 8000, 8000);
disp('Playing at a volume of 8000...');
playblocking(player,ts);
% set volume to a another dummy value and play music
mx_volume('WAVE', 500, 500);
disp('Playing at a volume of 500...');
playblocking(player,ts);
% left channel only
mx_volume('WAVE', 8000, 0);
disp('Playing on the left channel only...');
playblocking(player,ts);
% right channel only
mx_volume('WAVE', 0, 8000);
disp('Playing on the right channel only...');
playblocking(player,ts);
% set volume back to original values
mx_volume('WAVE', left, right);
disp('Playing at original volume');
playblocking(player,ts); |
Partager