changeset 22441:bb8914d68f25

Fix noise signal generation in audioplayer doc string and demos (bug #49011) * @audioplayer/audioplayer.m: Fix noise signal generation in doc string and %!demo blocks.
author Mike Miller <mtmiller@octave.org>
date Tue, 06 Sep 2016 12:08:38 -0700
parents 20e6de770ca4
children 638625a0186f
files scripts/audio/@audioplayer/audioplayer.m
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/audio/@audioplayer/audioplayer.m	Tue Sep 06 11:52:17 2016 -0700
+++ b/scripts/audio/@audioplayer/audioplayer.m	Tue Sep 06 12:08:38 2016 -0700
@@ -38,7 +38,7 @@
 ##
 ## @example
 ## @group
-## y = randn (2, 44100) - 0.5;
+## y = 0.25 * randn (2, 44100);
 ## player = audioplayer (y, 44100, 8);
 ## play (player);
 ## @end group
@@ -111,7 +111,7 @@
 
 %!demo
 %! fs = 44100;
-%! audio = randn (2, 2*fs) - 0.5;
+%! audio = 0.25 * randn (2, 2*fs);
 %! player = audioplayer (audio, fs);
 %! play (player);
 %! pause (1);
@@ -124,8 +124,8 @@
 ## Tests of audioplayer must not actually play anything.
 
 %!testif HAVE_PORTAUDIO
-%! mono = randn (1, 44100) - 0.5;
-%! stereo = randn (2, 44100) - 0.5;
+%! mono = 0.25 * randn (1, 44100);
+%! stereo = 0.25 * randn (2, 44100);
 %! fs = 44100;
 %! player1 = audioplayer (mono, fs);
 %! player2 = audioplayer (stereo, fs);
@@ -137,7 +137,7 @@
 %! assert (player2.TotalSamples, 44100);
 
 %!testif HAVE_PORTAUDIO
-%! audio = randn (2, 44100) - 0.5;
+%! audio = 0.25 * randn (2, 44100);
 %! fs = 44100;
 %! player = audioplayer (audio, fs);
 %! set (player, {"SampleRate", "Tag", "UserData"}, {8000, "tag", [1, 2; 3, 4]});
@@ -146,7 +146,7 @@
 %! assert (player.UserData, [1, 2; 3, 4]);
 
 %!testif HAVE_PORTAUDIO
-%! audio = randn (2, 44100) - 0.5;
+%! audio = 0.25 * randn (2, 44100);
 %! fs = 44100;
 %! player = audioplayer (audio, fs);
 %! settable = set (player);
@@ -159,7 +159,7 @@
 %! assert (player.UserData, [1, 2; 3, 4]);
 
 %!testif HAVE_PORTAUDIO
-%! audio = randn (2, 44100) - 0.5;
+%! audio = 0.25 * randn (2, 44100);
 %! fs = 44100;
 %! player = audioplayer (audio, fs);
 %! player.SampleRate = 8000;