diff options
author | Shashank | 2017-05-29 12:40:26 +0530 |
---|---|---|
committer | Shashank | 2017-05-29 12:40:26 +0530 |
commit | 0345245e860375a32c9a437c4a9d9cae807134e9 (patch) | |
tree | ad51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/sound/tests | |
download | scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2 scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip |
CMSCOPE changed
Diffstat (limited to 'modules/sound/tests')
47 files changed, 962 insertions, 0 deletions
diff --git a/modules/sound/tests/nonreg_tests/bug_10942.dia.ref b/modules/sound/tests/nonreg_tests/bug_10942.dia.ref new file mode 100755 index 000000000..0682daa78 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_10942.dia.ref @@ -0,0 +1,2 @@ +t=[0:1:0.001*8000-1]/8000; +assert_checkequal(soundsec(0.001,8000),t); diff --git a/modules/sound/tests/nonreg_tests/bug_10942.tst b/modules/sound/tests/nonreg_tests/bug_10942.tst new file mode 100755 index 000000000..7ea9fb16e --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_10942.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Pierre-Aime Agnel +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 10942 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=10492 +// +// <-- Short Description --> +// soundsec does not sample at the given frequency and is one element too long +// + +t=[0:1:0.001*8000-1]/8000; +assert_checkequal(soundsec(0.001,8000),t); diff --git a/modules/sound/tests/nonreg_tests/bug_11860.dia.ref b/modules/sound/tests/nonreg_tests/bug_11860.dia.ref new file mode 100755 index 000000000..9f58fc39c --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_11860.dia.ref @@ -0,0 +1,45 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 11860 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=11860 +// +// <-- Short Description --> +// wavwrite failed for 24 bits files (error in savewave function) +// +// For two channels +filename=SCI +'/modules/sound/tests/nonreg_tests/bug_11860.wav'; +[y_ref,Fs_ref,nbits_ref]=wavread(filename); +wavwrite(y_ref,Fs_ref,nbits_ref,TMPDIR + '/bug_11860_written.wav'); +filename_written=TMPDIR + '/bug_11860_written.wav'; +// Check +[y,Fs,nbits]=wavread(filename_written); +assert_checktrue(abs(y_ref-y)<1e-6); +assert_checkalmostequal(Fs,Fs_ref); +assert_checkalmostequal(nbits,nbits_ref); +mdelete(filename_written); +// For 1 channel +filepath= TMPDIR + '/bug_11860_mono.wav'; +Fs_ref = 44100; +nbits_ref = 24; +recordLength=1; +t= soundsec(recordLength,Fs_ref); +// Signal +frequency = 1000; +y_ref = 0.5*sin(2*%pi* frequency *t); +// Output +wavwrite(y_ref, Fs_ref, nbits_ref, filepath); +// Check +[y,Fs,nbits]=wavread(filepath); +assert_checktrue(abs(y_ref-y)<1e-6); +assert_checkalmostequal(Fs,Fs_ref); +assert_checkalmostequal(nbits,nbits_ref); +mdelete(filepath); diff --git a/modules/sound/tests/nonreg_tests/bug_11860.tst b/modules/sound/tests/nonreg_tests/bug_11860.tst new file mode 100755 index 000000000..ced3e3867 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_11860.tst @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 11860 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=11860 +// +// <-- Short Description --> +// wavwrite failed for 24 bits files (error in savewave function) +// +// For two channels +filename=SCI +'/modules/sound/tests/nonreg_tests/bug_11860.wav'; +[y_ref,Fs_ref,nbits_ref]=wavread(filename); +wavwrite(y_ref,Fs_ref,nbits_ref,TMPDIR + '/bug_11860_written.wav'); +filename_written=TMPDIR + '/bug_11860_written.wav'; +// Check +[y,Fs,nbits]=wavread(filename_written); +assert_checktrue(abs(y_ref-y)<1e-6); +assert_checkalmostequal(Fs,Fs_ref); +assert_checkalmostequal(nbits,nbits_ref); +mdelete(filename_written); + +// For 1 channel +filepath= TMPDIR + '/bug_11860_mono.wav'; +Fs_ref = 44100; +nbits_ref = 24; +recordLength=1; +t= soundsec(recordLength,Fs_ref); +// Signal +frequency = 1000; +y_ref = 0.5*sin(2*%pi* frequency *t); +// Output +wavwrite(y_ref, Fs_ref, nbits_ref, filepath); +// Check +[y,Fs,nbits]=wavread(filepath); +assert_checktrue(abs(y_ref-y)<1e-6); +assert_checkalmostequal(Fs,Fs_ref); +assert_checkalmostequal(nbits,nbits_ref); +mdelete(filepath); diff --git a/modules/sound/tests/nonreg_tests/bug_11860.wav b/modules/sound/tests/nonreg_tests/bug_11860.wav Binary files differnew file mode 100755 index 000000000..7d528114e --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_11860.wav diff --git a/modules/sound/tests/nonreg_tests/bug_12779.dia.ref b/modules/sound/tests/nonreg_tests/bug_12779.dia.ref new file mode 100755 index 000000000..804e92a03 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_12779.dia.ref @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 12779 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=12779 +// +// <-- Short Description --> +// Function "savewave" has a miscoding in the internal function "write_wavedat" +// +t=soundsec(0.5); +s=sin(2*%pi*440*t)+sin(2*%pi*220*t)/2+sin(2*%pi*880*t)/2; +t(11026)=0.500001; +nc=size(t,2); +nc=nc+1; +assert_checktrue(execstr("savewave(TMPDIR+''/bug_12779.wav'',s, 22050, 2);", "errcatch")==0); diff --git a/modules/sound/tests/nonreg_tests/bug_12779.tst b/modules/sound/tests/nonreg_tests/bug_12779.tst new file mode 100755 index 000000000..d61f23820 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_12779.tst @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 12779 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=12779 +// +// <-- Short Description --> +// Function "savewave" has a miscoding in the internal function "write_wavedat" +// +t=soundsec(0.5); +s=sin(2*%pi*440*t)+sin(2*%pi*220*t)/2+sin(2*%pi*880*t)/2; +t(11026)=0.500001; +nc=size(t,2); +nc=nc+1; + +assert_checktrue(execstr("savewave(TMPDIR+''/bug_12779.wav'',s, 22050, 2);", "errcatch")==0); diff --git a/modules/sound/tests/nonreg_tests/bug_141.dia.ref b/modules/sound/tests/nonreg_tests/bug_141.dia.ref new file mode 100755 index 000000000..5ce93cce3 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_141.dia.ref @@ -0,0 +1,14 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Vincent COUVERT +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 141 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=141 +// +// <-- Short Description --> +// savewave crashes my machine +if execstr("savewave(TMPDIR+""/toto.WAV"", rand(1:10000), 11025);", "errcatch")<>0 then bugmes();quit;end diff --git a/modules/sound/tests/nonreg_tests/bug_141.tst b/modules/sound/tests/nonreg_tests/bug_141.tst new file mode 100755 index 000000000..44a34ba1d --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_141.tst @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA - Vincent COUVERT +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 141 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=141 +// +// <-- Short Description --> +// savewave crashes my machine + + +if execstr("savewave(TMPDIR+""/toto.WAV"", rand(1:10000), 11025);", "errcatch")<>0 then pause; end + diff --git a/modules/sound/tests/nonreg_tests/bug_1609.dia.ref b/modules/sound/tests/nonreg_tests/bug_1609.dia.ref new file mode 100755 index 000000000..128308e3c --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_1609.dia.ref @@ -0,0 +1,17 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- ENGLISH IMPOSED --> +// <-- Non-regression test for bug 1609 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=1609 +// +// <-- Short Description --> +// I can't freely choose "fs" parameter in the following example with 'sound' +y=loadwave("SCI/modules/sound/demos/chimes.wav"); +sound(y,44100); +sound(y,22500); diff --git a/modules/sound/tests/nonreg_tests/bug_1609.tst b/modules/sound/tests/nonreg_tests/bug_1609.tst new file mode 100755 index 000000000..0f7415b9e --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_1609.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- ENGLISH IMPOSED --> + +// <-- Non-regression test for bug 1609 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=1609 +// +// <-- Short Description --> +// I can't freely choose "fs" parameter in the following example with 'sound' + +y=loadwave("SCI/modules/sound/demos/chimes.wav"); +sound(y,44100); +sound(y,22500); diff --git a/modules/sound/tests/nonreg_tests/bug_1926.dia.ref b/modules/sound/tests/nonreg_tests/bug_1926.dia.ref new file mode 100755 index 000000000..6990757aa --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_1926.dia.ref @@ -0,0 +1,40 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 1926 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=1926 +// +// <-- Short Description --> +// wavwrite does not work properly in Scilab 4.0, final version. The same +//instructions create a correct file in Scilab 3.0. When the .wav file is written +//for a single channel, from a 1 column vector, the scilab message indicates +//thousands of channels (but still a small fraction of the number of samples, so +//it's not simply one-deep by many channels). +//===================================================================== +r = wavread("SCI/modules/sound/demos/chimes.wav","size"); +if r <> [2 13921] then bugmes();quit;end +[yref,FsRef,bitsRef]= wavread("SCI/modules/sound/demos/chimes.wav"); +wavwrite(yref,FsRef,TMPDIR+'/chimes.wav'); +r = wavread(TMPDIR+'/chimes.wav',"size"); +if r <> [2 13921] then bugmes();quit;end +[y,Fs,bits]= wavread(TMPDIR+'/chimes.wav'); +if yref <> y then bugmes();quit;end; +if FsRef <> Fs then bugmes();quit;end; +if bitsRef <> bits then bugmes();quit;end; +//===================================================================== +r = wavread("SCI/modules/sound/tests/nonreg_tests/bug_1926.wav","size"); +if r <> [2 11026] then bugmes();quit;end +[yref,FsRef,bitsRef]= wavread("SCI/modules/sound/tests/nonreg_tests/bug_1926.wav"); +wavwrite(yref,FsRef,TMPDIR+'/bug_1926.wav'); +r = wavread(TMPDIR+'/bug_1926.wav',"size"); +if r <> [2 11026] then bugmes();quit;end +[y,Fs,bits]= wavread(TMPDIR+'/bug_1926.wav'); +if yref <> y then bugmes();quit;end; +if FsRef <> Fs then bugmes();quit;end; +if bitsRef <> bits then bugmes();quit;end; +//===================================================================== diff --git a/modules/sound/tests/nonreg_tests/bug_1926.tst b/modules/sound/tests/nonreg_tests/bug_1926.tst new file mode 100755 index 000000000..294c4dc01 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_1926.tst @@ -0,0 +1,49 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 1926 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=1926 +// +// <-- Short Description --> +// wavwrite does not work properly in Scilab 4.0, final version. The same +//instructions create a correct file in Scilab 3.0. When the .wav file is written +//for a single channel, from a 1 column vector, the scilab message indicates +//thousands of channels (but still a small fraction of the number of samples, so +//it's not simply one-deep by many channels). + + +//===================================================================== +r = wavread("SCI/modules/sound/demos/chimes.wav","size"); +if r <> [2 13921] then pause,end + +[yref,FsRef,bitsRef]= wavread("SCI/modules/sound/demos/chimes.wav"); +wavwrite(yref,FsRef,TMPDIR+'/chimes.wav'); + +r = wavread(TMPDIR+'/chimes.wav',"size"); +if r <> [2 13921] then pause,end + +[y,Fs,bits]= wavread(TMPDIR+'/chimes.wav'); +if yref <> y then pause,end; +if FsRef <> Fs then pause,end; +if bitsRef <> bits then pause,end; +//===================================================================== +r = wavread("SCI/modules/sound/tests/nonreg_tests/bug_1926.wav","size"); +if r <> [2 11026] then pause,end + +[yref,FsRef,bitsRef]= wavread("SCI/modules/sound/tests/nonreg_tests/bug_1926.wav"); +wavwrite(yref,FsRef,TMPDIR+'/bug_1926.wav'); + +r = wavread(TMPDIR+'/bug_1926.wav',"size"); +if r <> [2 11026] then pause,end + +[y,Fs,bits]= wavread(TMPDIR+'/bug_1926.wav'); +if yref <> y then pause,end; +if FsRef <> Fs then pause,end; +if bitsRef <> bits then pause,end; +//===================================================================== diff --git a/modules/sound/tests/nonreg_tests/bug_1926.wav b/modules/sound/tests/nonreg_tests/bug_1926.wav Binary files differnew file mode 100755 index 000000000..dbdaf413a --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_1926.wav diff --git a/modules/sound/tests/nonreg_tests/bug_4037.tst b/modules/sound/tests/nonreg_tests/bug_4037.tst new file mode 100755 index 000000000..bd31b0ecb --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_4037.tst @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 4037 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=4037 +// +// <-- Short Description --> +// waveread can not read broadcast wave format +// a error is returned + +// <-- INTERACTIVE TEST --> + +// create or download a bfw file +// try to load wavread + +namebfw = "bfw.wav" +ierr = execstr('wavread(namebfw)','errcatch'); +if ierr<> 999 then pause,end diff --git a/modules/sound/tests/nonreg_tests/bug_467.dia.ref b/modules/sound/tests/nonreg_tests/bug_467.dia.ref new file mode 100755 index 000000000..0948e1656 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_467.dia.ref @@ -0,0 +1,38 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 467 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=467 +// +// <-- Short Description --> +// Bug Report Id: 12022200362265140 +// If you don't mind, where are read_dat_pcm or read_wavedat? +// +// +// +// On Scilab 2-7 with " wavread " function +// The Error Messages are: +// !--error 4 +// undefined variable : erro +// at line 26 of function read_dat_pcm called by : +// line 6 of function read_wavedat called by : +// line 93 of function wavread called by : +// [x,y] = wavread('c:\b.wav','size'); +// +// +// !--error 246 +// function not defined for given argument type(s) +// Check arguments or define function %s_convstr for overloading +// at line 28 of function wavread called by : +// z = wavread('c:\b.wav',100000); +// ... +result = execstr("[x,y] = wavread(SCI+''/modules/sound/tests/nonreg_tests/bug_467.wav'',''size'')","errcatch","n"); +if result <> 0 then bugmes();quit;end +if result == 0 then + if execstr("z = wavread(SCI+""/modules/sound/tests/nonreg_tests/bug_467.wav"",10)","errcatch","n") <> 0 then bugmes();quit;end +end diff --git a/modules/sound/tests/nonreg_tests/bug_467.tst b/modules/sound/tests/nonreg_tests/bug_467.tst new file mode 100755 index 000000000..d1673f39f --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_467.tst @@ -0,0 +1,42 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 467 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=467 +// +// <-- Short Description --> +// Bug Report Id: 12022200362265140 +// If you don't mind, where are read_dat_pcm or read_wavedat? +// +// +// +// On Scilab 2-7 with " wavread " function +// The Error Messages are: +// !--error 4 +// undefined variable : erro +// at line 26 of function read_dat_pcm called by : +// line 6 of function read_wavedat called by : +// line 93 of function wavread called by : +// [x,y] = wavread('c:\b.wav','size'); +// +// +// !--error 246 +// function not defined for given argument type(s) +// Check arguments or define function %s_convstr for overloading +// at line 28 of function wavread called by : +// z = wavread('c:\b.wav',100000); +// ... + +result = execstr("[x,y] = wavread(SCI+''/modules/sound/tests/nonreg_tests/bug_467.wav'',''size'')","errcatch","n"); + +if result <> 0 then pause,end + +if result == 0 then + if execstr("z = wavread(SCI+""/modules/sound/tests/nonreg_tests/bug_467.wav"",10)","errcatch","n") <> 0 then pause,end +end diff --git a/modules/sound/tests/nonreg_tests/bug_467.wav b/modules/sound/tests/nonreg_tests/bug_467.wav Binary files differnew file mode 100755 index 000000000..a8b529ec7 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_467.wav diff --git a/modules/sound/tests/nonreg_tests/bug_4832.dia.ref b/modules/sound/tests/nonreg_tests/bug_4832.dia.ref new file mode 100755 index 000000000..1a17e1081 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_4832.dia.ref @@ -0,0 +1,17 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 4832 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=4832 +// +// <-- Short Description --> +// waveread can not detect RIFF with smpl chunck +// a non explicit error is returned +filename = SCI + '/modules/sound/tests/nonreg_tests/bug_4832.wav'; +ierr = execstr('wavread(filename)','errcatch'); +if ierr<> 10000 then bugmes();quit;end diff --git a/modules/sound/tests/nonreg_tests/bug_4832.tst b/modules/sound/tests/nonreg_tests/bug_4832.tst new file mode 100755 index 000000000..64735bd21 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_4832.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 4832 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=4832 +// +// <-- Short Description --> +// waveread can not detect RIFF with smpl chunck +// a non explicit error is returned + +filename = SCI + '/modules/sound/tests/nonreg_tests/bug_4832.wav'; +ierr = execstr('wavread(filename)','errcatch'); +if ierr<> 10000 then pause,end + diff --git a/modules/sound/tests/nonreg_tests/bug_4832.wav b/modules/sound/tests/nonreg_tests/bug_4832.wav Binary files differnew file mode 100755 index 000000000..fbdf657f3 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_4832.wav diff --git a/modules/sound/tests/nonreg_tests/bug_600.tst b/modules/sound/tests/nonreg_tests/bug_600.tst new file mode 100755 index 000000000..83844739e --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_600.tst @@ -0,0 +1,29 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- INTERACTIVE TEST --> +// +// <-- Non-regression test for bug 600 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=600 +// +// <-- Short Description --> +// I am not able to hear the sounds using either the 'Sound' +// or 'playsnd' functions. +// +// The sound card is working properly with all other +// software. All other wave functions are working such as +// wavread loadwave etc... + +disp("activate your sound card, and run this file"); +disp("if you hear something, that means the playsnd & PlaySnd work"); + +y=wavread('SCI/modules/sound/demos/chimes.wav'); +playsnd(y); + +PlaySound('SCI/modules/sound/demos/chimes.wav'); diff --git a/modules/sound/tests/nonreg_tests/bug_629.dia.ref b/modules/sound/tests/nonreg_tests/bug_629.dia.ref new file mode 100755 index 000000000..5446ca10f --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_629.dia.ref @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 629 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=629 +// +// <-- Short Description --> +// When trying to use the wavread function I get these errors +// that make this function totally unuseful, either calling it +// with ONE parameter (a) or calling it with two parameters. +// I made myself sure that the parameters would be of the form +// indicated by help on line. +// exec("e:\testNonReg\629.sce"); +// iReturnCode=execstr("[x,fs,bits] = wavread("e:\testNonReg\t1.wav")','errcatch'); +if execstr("wavread(SCI+''/modules/sound/tests/nonreg_tests/bug_629.wav'')","errcatch") <> 0 then bugmes();quit;end diff --git a/modules/sound/tests/nonreg_tests/bug_629.tst b/modules/sound/tests/nonreg_tests/bug_629.tst new file mode 100755 index 000000000..44f7d2b5d --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_629.tst @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 629 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=629 +// +// <-- Short Description --> +// When trying to use the wavread function I get these errors +// that make this function totally unuseful, either calling it +// with ONE parameter (a) or calling it with two parameters. +// I made myself sure that the parameters would be of the form +// indicated by help on line. + + +// exec("e:\testNonReg\629.sce"); +// iReturnCode=execstr("[x,fs,bits] = wavread("e:\testNonReg\t1.wav")','errcatch'); + +if execstr("wavread(SCI+''/modules/sound/tests/nonreg_tests/bug_629.wav'')","errcatch") <> 0 then pause,end diff --git a/modules/sound/tests/nonreg_tests/bug_629.wav b/modules/sound/tests/nonreg_tests/bug_629.wav Binary files differnew file mode 100755 index 000000000..dbdaf413a --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_629.wav diff --git a/modules/sound/tests/nonreg_tests/bug_7161.dia.ref b/modules/sound/tests/nonreg_tests/bug_7161.dia.ref new file mode 100755 index 000000000..9b7b52b31 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_7161.dia.ref @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 7161 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=7161 +// +// <-- Short Description --> +// wavread failed to load some .wav files with error 44 +filename = SCI + '/modules/sound/tests/nonreg_tests/bug_7161.wav'; +ierr = execstr('[Ip, Fs, bits] = wavread(filename);', 'errcatch'); +if ierr <> 0 then bugmes();quit;end +sIp = size(Ip); +if sIp(1) <> 1 then bugmes();quit;end +if sIp(2) <> 65536 then bugmes();quit;end +if Fs <> 8000 then bugmes();quit;end +if bits <> 16 then bugmes();quit;end diff --git a/modules/sound/tests/nonreg_tests/bug_7161.tst b/modules/sound/tests/nonreg_tests/bug_7161.tst new file mode 100755 index 000000000..3c7a2ee24 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_7161.tst @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 7161 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=7161 +// +// <-- Short Description --> +// wavread failed to load some .wav files with error 44 + +filename = SCI + '/modules/sound/tests/nonreg_tests/bug_7161.wav'; +ierr = execstr('[Ip, Fs, bits] = wavread(filename);', 'errcatch'); +if ierr <> 0 then pause, end +sIp = size(Ip); +if sIp(1) <> 1 then pause, end +if sIp(2) <> 65536 then pause, end +if Fs <> 8000 then pause, end +if bits <> 16 then pause, end diff --git a/modules/sound/tests/nonreg_tests/bug_7161.wav b/modules/sound/tests/nonreg_tests/bug_7161.wav Binary files differnew file mode 100755 index 000000000..24d20c8ed --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_7161.wav diff --git a/modules/sound/tests/nonreg_tests/bug_9280.dia.ref b/modules/sound/tests/nonreg_tests/bug_9280.dia.ref new file mode 100755 index 000000000..a861257d3 --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_9280.dia.ref @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 9280 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=9280 +// +// <-- Short Description --> +// wavread failed to read PCM 32 bit float file format. +filename = SCI + '/modules/sound/tests/nonreg_tests/bug_9280.wav'; +ierr = execstr('[Ip, Fs, bits] = wavread(filename);', 'errcatch'); +if ierr <> 0 then bugmes();quit;end +sIp = size(Ip); +if sIp(1) <> 1 then bugmes();quit;end +if sIp(2) <> 1000 then bugmes();quit;end +if Fs <> 96000 then bugmes();quit;end +if bits <> 32 then bugmes();quit;end diff --git a/modules/sound/tests/nonreg_tests/bug_9280.tst b/modules/sound/tests/nonreg_tests/bug_9280.tst new file mode 100755 index 000000000..a1e3e191e --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_9280.tst @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 9280 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=9280 +// +// <-- Short Description --> +// wavread failed to read PCM 32 bit float file format. + +filename = SCI + '/modules/sound/tests/nonreg_tests/bug_9280.wav'; +ierr = execstr('[Ip, Fs, bits] = wavread(filename);', 'errcatch'); +if ierr <> 0 then pause, end +sIp = size(Ip); +if sIp(1) <> 1 then pause, end +if sIp(2) <> 1000 then pause, end +if Fs <> 96000 then pause, end +if bits <> 32 then pause, end diff --git a/modules/sound/tests/nonreg_tests/bug_9280.wav b/modules/sound/tests/nonreg_tests/bug_9280.wav Binary files differnew file mode 100755 index 000000000..875c31d9e --- /dev/null +++ b/modules/sound/tests/nonreg_tests/bug_9280.wav diff --git a/modules/sound/tests/unit_tests/beep.dia.ref b/modules/sound/tests/unit_tests/beep.dia.ref new file mode 100755 index 000000000..6acf8ed54 --- /dev/null +++ b/modules/sound/tests/unit_tests/beep.dia.ref @@ -0,0 +1,5 @@ +old = beep(); +if beep('on') <> 'on' then bugmes();quit;end; +if beep('off') <> 'off' then bugmes();quit;end; +if beep() <> 'off' then bugmes();quit;end; +beep(old); diff --git a/modules/sound/tests/unit_tests/beep.tst b/modules/sound/tests/unit_tests/beep.tst new file mode 100755 index 000000000..8fcd3c927 --- /dev/null +++ b/modules/sound/tests/unit_tests/beep.tst @@ -0,0 +1,12 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +old = beep(); +if beep('on') <> 'on' then pause,end; +if beep('off') <> 'off' then pause,end; +if beep() <> 'off' then pause,end; +beep(old); diff --git a/modules/sound/tests/unit_tests/mapsound.dia.ref b/modules/sound/tests/unit_tests/mapsound.dia.ref new file mode 100755 index 000000000..03f8b42ff --- /dev/null +++ b/modules/sound/tests/unit_tests/mapsound.dia.ref @@ -0,0 +1,7 @@ +// At first we create 0.5 seconds of sound parameters. +t=soundsec(0.5); +// Then we generate the sound. +s=sin(440*t)+sin(220*t)/2+sin(880*t)/2; +[nr,nc]=size(t); +s(nc/2:nc)=sin(330*t(nc/2:nc)); +mapsound(s); diff --git a/modules/sound/tests/unit_tests/mapsound.tst b/modules/sound/tests/unit_tests/mapsound.tst new file mode 100755 index 000000000..374c7d77e --- /dev/null +++ b/modules/sound/tests/unit_tests/mapsound.tst @@ -0,0 +1,14 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// At first we create 0.5 seconds of sound parameters. +t=soundsec(0.5); +// Then we generate the sound. +s=sin(440*t)+sin(220*t)/2+sin(880*t)/2; +[nr,nc]=size(t); +s(nc/2:nc)=sin(330*t(nc/2:nc)); +mapsound(s); diff --git a/modules/sound/tests/unit_tests/playsnd.dia.ref b/modules/sound/tests/unit_tests/playsnd.dia.ref new file mode 100755 index 000000000..14f96b452 --- /dev/null +++ b/modules/sound/tests/unit_tests/playsnd.dia.ref @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +y = wavread('SCI/modules/sound/demos/chimes.wav'); +playsnd(y); +tab_ref = [ +"世界您好", +"азеазея", +"ハロー・ワールド", +"เฮลโลเวิลด์", +"حريات وحقوق", +"תוכנית"]; +for i = 1 : size(tab_ref,'*') + mkdir(TMPDIR + filesep() + tab_ref(i)); + copyfile(SCI+'/modules/sound/demos/chimes.wav',TMPDIR + filesep() + tab_ref(i) + filesep() + tab_ref(i) +'.wav'); + y = wavread(TMPDIR + filesep() + tab_ref(i) + filesep() + tab_ref(i) +'.wav'); + playsnd(y); + mdelete(TMPDIR + filesep() + tab_ref(i) + filesep() + tab_ref(i) +'.wav'); + rmdir(TMPDIR + filesep() + tab_ref(i)); +end diff --git a/modules/sound/tests/unit_tests/playsnd.tst b/modules/sound/tests/unit_tests/playsnd.tst new file mode 100755 index 000000000..90a1cbe29 --- /dev/null +++ b/modules/sound/tests/unit_tests/playsnd.tst @@ -0,0 +1,26 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +y = wavread('SCI/modules/sound/demos/chimes.wav'); +playsnd(y); + +tab_ref = [ +"世界您好", +"азеазея", +"ハロー・ワールド", +"เฮลโลเวิลด์", +"حريات وحقوق", +"תוכנית"]; + +for i = 1 : size(tab_ref,'*') + mkdir(TMPDIR + filesep() + tab_ref(i)); + copyfile(SCI+'/modules/sound/demos/chimes.wav',TMPDIR + filesep() + tab_ref(i) + filesep() + tab_ref(i) +'.wav'); + y = wavread(TMPDIR + filesep() + tab_ref(i) + filesep() + tab_ref(i) +'.wav'); + playsnd(y); + mdelete(TMPDIR + filesep() + tab_ref(i) + filesep() + tab_ref(i) +'.wav'); + rmdir(TMPDIR + filesep() + tab_ref(i)); +end diff --git a/modules/sound/tests/unit_tests/savewave.dia.ref b/modules/sound/tests/unit_tests/savewave.dia.ref new file mode 100755 index 000000000..ed91e4d83 --- /dev/null +++ b/modules/sound/tests/unit_tests/savewave.dia.ref @@ -0,0 +1,13 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// At first we create 0.5 seconds of sound parameters. +t=soundsec(0.5); +// Then we generate the sound. +s=sin(440*t)+sin(220*t)/2+sin(880*t)/2; +[nr,nc]=size(t); +s(nc/2:nc)=sin(330*t(nc/2:nc)); +savewave(TMPDIR+'/foo.wav',s); diff --git a/modules/sound/tests/unit_tests/savewave.tst b/modules/sound/tests/unit_tests/savewave.tst new file mode 100755 index 000000000..8cd307907 --- /dev/null +++ b/modules/sound/tests/unit_tests/savewave.tst @@ -0,0 +1,15 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// At first we create 0.5 seconds of sound parameters. +t=soundsec(0.5); +// Then we generate the sound. +s=sin(440*t)+sin(220*t)/2+sin(880*t)/2; +[nr,nc]=size(t); +s(nc/2:nc)=sin(330*t(nc/2:nc)); +savewave(TMPDIR+'/foo.wav',s); +
\ No newline at end of file diff --git a/modules/sound/tests/unit_tests/sound.dia.ref b/modules/sound/tests/unit_tests/sound.dia.ref new file mode 100755 index 000000000..b6d3fb131 --- /dev/null +++ b/modules/sound/tests/unit_tests/sound.dia.ref @@ -0,0 +1,19 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// At first we create 0.5 seconds of sound parameters. +t=soundsec(0.5); +// Then we generate the sound. +s=sin(440*t)+sin(220*t)/2+sin(880*t)/2; +[nr,nc]=size(t); +s(nc/2:nc)=sin(330*t(nc/2:nc)); +// Save the file in WAV format. +// we renormalize s in order to check that save+load is invariant +s=s-sum(s)/prod(size(s)); s=s/max(abs(s)); +savewave(TMPDIR+"/test.wav",s); +// Load it back. +s1=loadwave(TMPDIR+"/test.wav"); +if max(abs(s1-s)) > 1.e-4 then bugmes();quit;end; diff --git a/modules/sound/tests/unit_tests/sound.tst b/modules/sound/tests/unit_tests/sound.tst new file mode 100755 index 000000000..b399eff11 --- /dev/null +++ b/modules/sound/tests/unit_tests/sound.tst @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// At first we create 0.5 seconds of sound parameters. +t=soundsec(0.5); +// Then we generate the sound. +s=sin(440*t)+sin(220*t)/2+sin(880*t)/2; +[nr,nc]=size(t); +s(nc/2:nc)=sin(330*t(nc/2:nc)); +// Save the file in WAV format. +// we renormalize s in order to check that save+load is invariant +s=s-sum(s)/prod(size(s)); s=s/max(abs(s)); +savewave(TMPDIR+"/test.wav",s); +// Load it back. +s1=loadwave(TMPDIR+"/test.wav"); +if max(abs(s1-s)) > 1.e-4 then pause,end; + diff --git a/modules/sound/tests/unit_tests/soundsec.dia.ref b/modules/sound/tests/unit_tests/soundsec.dia.ref new file mode 100755 index 000000000..f2211f8f9 --- /dev/null +++ b/modules/sound/tests/unit_tests/soundsec.dia.ref @@ -0,0 +1,50 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Pierre-Aime Agnel +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Unit tests for macro soundsec.sci --> +//============================================================================== +//Check abnormal entries +non_real_time = msprintf(_("%s: Wrong type for argument #%d: Real matrix expected.\n"),"soundsec",1); +non_real_freq = msprintf(_("%s: Wrong type for argument #%d: Real matrix expected.\n"),"soundsec",2); +non_positive_time=msprintf(_("%s: Wrong value for input argument #%d: Must be >= %d.\n"),"soundsec",1,0); +non_positive_freq=msprintf(_("%s: Wrong value for input argument #%d: Must be >= %d.\n"),"soundsec",2,0); +non_scalar_time=msprintf(_("%s: Wrong size for input argument #%d: %d-by-%d matrix expected.\n"),"soundsec",1,1,1); +non_scalar_freq=msprintf(_("%s: Wrong size for input argument #%d: %d-by-%d matrix expected.\n"),"soundsec",2,1,1); +//Soundsec must be called with real scalar values +assert_checkerror("soundsec(""test"",1)",non_real_time); +assert_checkerror("soundsec(%i,1)",non_real_time); +assert_checkerror("soundsec(1,""test"")",non_real_freq); +assert_checkerror("soundsec(1,%i)",non_real_freq); +assert_checkerror("soundsec(0:10,1)",non_scalar_time); +assert_checkerror("soundsec(1,0:10)",non_scalar_freq); +//Soundsec must be called with positive parameters +assert_checkerror("soundsec(-1,10)",non_positive_time); +assert_checkerror("soundsec(1,-1)",non_positive_freq); +//============================================================================== +//Check behaviour +//Soundsec returns empty value for a 0 sec sample +assert_checkequal(soundsec(0, 100), []); +//Soundsec returns empty value for a 0 frequency sample +assert_checkequal(soundsec(100, 0), []); +//Checks default behaviour for rate +assert_checkalmostequal( soundsec(10/22050), [0:9]./22050); +//Check 1s of samples at 10hz excluding the last is [0:9] +samples_t = soundsec(1, 10); +assert_checkalmostequal(samples_t, (0:9)/10); +//Check call on non integer time +samples_t = soundsec(0.11, 100); //eleven samples 0 0.01 ... 0.09 0.1 +assert_checkalmostequal(samples_t, (0:10)/100); +//Check call on non integer frequency +samples_t = soundsec(1,5.2); //samples 0 1/5.2 2/5.2 ... 5/5.2 +assert_checkalmostequal(samples_t, (0:5)/5.2); +//Check call on non integer frequency and time +samples_t = soundsec(1.2324,50.75); +//samples 0 1/50.75 ... 50/50.75 51/51.75 ... 62/50.75 +//note that 1.2324 > 62/50.75 and 1.2324 <= 63/50.75 +assert_checkalmostequal(samples_t, (0:62)/50.75); diff --git a/modules/sound/tests/unit_tests/soundsec.tst b/modules/sound/tests/unit_tests/soundsec.tst new file mode 100755 index 000000000..ceca9613d --- /dev/null +++ b/modules/sound/tests/unit_tests/soundsec.tst @@ -0,0 +1,69 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Pierre-Aime Agnel +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Unit tests for macro soundsec.sci --> + +//============================================================================== +//Check abnormal entries +non_real_time = msprintf(_("%s: Wrong type for argument #%d: Real matrix expected.\n"),"soundsec",1); +non_real_freq = msprintf(_("%s: Wrong type for argument #%d: Real matrix expected.\n"),"soundsec",2); + +non_positive_time=msprintf(_("%s: Wrong value for input argument #%d: Must be >= %d.\n"),"soundsec",1,0); +non_positive_freq=msprintf(_("%s: Wrong value for input argument #%d: Must be >= %d.\n"),"soundsec",2,0); + +non_scalar_time=msprintf(_("%s: Wrong size for input argument #%d: %d-by-%d matrix expected.\n"),"soundsec",1,1,1); +non_scalar_freq=msprintf(_("%s: Wrong size for input argument #%d: %d-by-%d matrix expected.\n"),"soundsec",2,1,1); + + +//Soundsec must be called with real scalar values +assert_checkerror("soundsec(""test"",1)",non_real_time); +assert_checkerror("soundsec(%i,1)",non_real_time); +assert_checkerror("soundsec(1,""test"")",non_real_freq); +assert_checkerror("soundsec(1,%i)",non_real_freq); + +assert_checkerror("soundsec(0:10,1)",non_scalar_time); +assert_checkerror("soundsec(1,0:10)",non_scalar_freq); + +//Soundsec must be called with positive parameters +assert_checkerror("soundsec(-1,10)",non_positive_time); +assert_checkerror("soundsec(1,-1)",non_positive_freq); + + +//============================================================================== +//Check behaviour + +//Soundsec returns empty value for a 0 sec sample +assert_checkequal(soundsec(0, 100), []); +//Soundsec returns empty value for a 0 frequency sample +assert_checkequal(soundsec(100, 0), []); + +//Checks default behaviour for rate +assert_checkalmostequal( soundsec(10/22050), [0:9]./22050); + +//Check 1s of samples at 10hz excluding the last is [0:9] +samples_t = soundsec(1, 10); +assert_checkalmostequal(samples_t, (0:9)/10); + +//Check call on non integer time +samples_t = soundsec(0.11, 100); //eleven samples 0 0.01 ... 0.09 0.1 +assert_checkalmostequal(samples_t, (0:10)/100); + +//Check call on non integer frequency +samples_t = soundsec(1,5.2); //samples 0 1/5.2 2/5.2 ... 5/5.2 +assert_checkalmostequal(samples_t, (0:5)/5.2); + + +//Check call on non integer frequency and time +samples_t = soundsec(1.2324,50.75); +//samples 0 1/50.75 ... 50/50.75 51/51.75 ... 62/50.75 +//note that 1.2324 > 62/50.75 and 1.2324 <= 63/50.75 +assert_checkalmostequal(samples_t, (0:62)/50.75); + + + diff --git a/modules/sound/tests/unit_tests/wavread.dia.ref b/modules/sound/tests/unit_tests/wavread.dia.ref new file mode 100755 index 000000000..edb088dfc --- /dev/null +++ b/modules/sound/tests/unit_tests/wavread.dia.ref @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + a = wavread('SCI/modules/sound/demos/chimes.wav','size'); + if size(a) <> [ 1 2] then bugmes();quit;end + if a <> [ 2 13921] then bugmes();quit;end + [y,Fs,bits]=wavread('SCI/modules/sound/demos/chimes.wav'); + if Fs <> 22050 then bugmes();quit;end + if bits <> 16 then bugmes();quit;end + if size(y) <> [ 2 13921] then bugmes();quit;end + //subplot(2,1,1) + //plot2d(y(:,1)) + //subplot(2,1,2) + //plot2d(y(:,2)) + //xdel(winsid()); + y=wavread('SCI/modules/sound/demos/chimes.wav',[1 5]) //the first five samples + y = + + 0.0000610 0.0002747 0.0002136 0.0001526 0.0000916 + 0.0000916 0.0001831 0.0000610 0. 0.0000916 + if size(y) <> [2 5] then bugmes();quit;end diff --git a/modules/sound/tests/unit_tests/wavread.tst b/modules/sound/tests/unit_tests/wavread.tst new file mode 100755 index 000000000..b64231ba6 --- /dev/null +++ b/modules/sound/tests/unit_tests/wavread.tst @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + + a = wavread('SCI/modules/sound/demos/chimes.wav','size'); + if size(a) <> [ 1 2] then pause,end + if a <> [ 2 13921] then pause,end + + [y,Fs,bits]=wavread('SCI/modules/sound/demos/chimes.wav'); + if Fs <> 22050 then pause,end + if bits <> 16 then pause,end + if size(y) <> [ 2 13921] then pause,end + //subplot(2,1,1) + //plot2d(y(:,1)) + //subplot(2,1,2) + //plot2d(y(:,2)) + //xdel(winsid()); + + y=wavread('SCI/modules/sound/demos/chimes.wav',[1 5]) //the first five samples + if size(y) <> [2 5] then pause,end diff --git a/modules/sound/tests/unit_tests/wavwrite.dia.ref b/modules/sound/tests/unit_tests/wavwrite.dia.ref new file mode 100755 index 000000000..4e4123b91 --- /dev/null +++ b/modules/sound/tests/unit_tests/wavwrite.dia.ref @@ -0,0 +1,10 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + A = matrix(1:6,2,3); + wavwrite(A/6,TMPDIR+'/foo.wav'); + B = wavread(TMPDIR+'/foo.wav'); + if max(abs(A- round(B*6))) <> 0 then bugmes();quit;end diff --git a/modules/sound/tests/unit_tests/wavwrite.tst b/modules/sound/tests/unit_tests/wavwrite.tst new file mode 100755 index 000000000..eb5cd290c --- /dev/null +++ b/modules/sound/tests/unit_tests/wavwrite.tst @@ -0,0 +1,11 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + + A = matrix(1:6,2,3); + wavwrite(A/6,TMPDIR+'/foo.wav'); + B = wavread(TMPDIR+'/foo.wav'); + if max(abs(A- round(B*6))) <> 0 then pause,end |