summaryrefslogtreecommitdiffstats
path: root/scilab/modules/sound
diff options
context:
space:
mode:
Diffstat (limited to 'scilab/modules/sound')
-rw-r--r--scilab/modules/sound/Makefile.in2
-rw-r--r--scilab/modules/sound/demos/mapsound.dem.sce104
-rw-r--r--scilab/modules/sound/demos/sound.dem.gateway.sce5
-rw-r--r--scilab/modules/sound/help/en_US/mapsound.xml287
-rw-r--r--scilab/modules/sound/help/ja_JP/mapsound.xml66
-rw-r--r--scilab/modules/sound/locales/ca_ES.po6
-rw-r--r--scilab/modules/sound/locales/cs_CZ.po6
-rw-r--r--scilab/modules/sound/locales/de_DE.po6
-rw-r--r--scilab/modules/sound/locales/es_ES.po6
-rw-r--r--scilab/modules/sound/locales/fr_FR.po6
-rw-r--r--scilab/modules/sound/locales/it_IT.po6
-rw-r--r--scilab/modules/sound/locales/ja_JP.po6
-rw-r--r--scilab/modules/sound/locales/pl_PL.po6
-rw-r--r--scilab/modules/sound/locales/pt_BR.po6
-rw-r--r--scilab/modules/sound/locales/ru_RU.po6
-rw-r--r--scilab/modules/sound/locales/sound.pot4
-rw-r--r--scilab/modules/sound/locales/uk_UA.po6
-rw-r--r--scilab/modules/sound/locales/zh_CN.po6
-rw-r--r--scilab/modules/sound/locales/zh_TW.po6
-rw-r--r--scilab/modules/sound/macros/mapsound.sci182
-rw-r--r--scilab/modules/sound/macros/wavread.sci2
-rw-r--r--scilab/modules/sound/tests/unit_tests/mapsound.tst108
22 files changed, 654 insertions, 184 deletions
diff --git a/scilab/modules/sound/Makefile.in b/scilab/modules/sound/Makefile.in
index e9f259c..4622374 100644
--- a/scilab/modules/sound/Makefile.in
+++ b/scilab/modules/sound/Makefile.in
@@ -401,9 +401,11 @@ NMEDIT = @NMEDIT@
401OBJDUMP = @OBJDUMP@ 401OBJDUMP = @OBJDUMP@
402OBJEXT = @OBJEXT@ 402OBJEXT = @OBJEXT@
403OCAMLC = @OCAMLC@ 403OCAMLC = @OCAMLC@
404OCAMLCFLAGS = @OCAMLCFLAGS@
404OCAMLDEP = @OCAMLDEP@ 405OCAMLDEP = @OCAMLDEP@
405OCAMLLEX = @OCAMLLEX@ 406OCAMLLEX = @OCAMLLEX@
406OCAMLOPT = @OCAMLOPT@ 407OCAMLOPT = @OCAMLOPT@
408OCAMLOPTFLAGS = @OCAMLOPTFLAGS@
407OCAMLYACC = @OCAMLYACC@ 409OCAMLYACC = @OCAMLYACC@
408OPENMPI_CC = @OPENMPI_CC@ 410OPENMPI_CC = @OPENMPI_CC@
409OPENMPI_CFLAGS = @OPENMPI_CFLAGS@ 411OPENMPI_CFLAGS = @OPENMPI_CFLAGS@
diff --git a/scilab/modules/sound/demos/mapsound.dem.sce b/scilab/modules/sound/demos/mapsound.dem.sce
new file mode 100644
index 0000000..2d5e36c
--- /dev/null
+++ b/scilab/modules/sound/demos/mapsound.dem.sce
@@ -0,0 +1,104 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) 2020 - Samuel GOUGEON
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function demo_mapsound()
12
13 idfig = 100001;
14
15 // Example #1: Standard
16 // ====================
17 fs = 22050;
18 t = 0:1/fs:1;
19 y = 0.3 + [1.5*sin(2*%pi*800*t) sin(2*%pi*1200*t)];
20 // Then: build and display its map:
21 fig = scf(idfig);
22 show_window(fig)
23 clf() // reset
24 demo_viewCode("mapsound.dem.sce");
25 mapsound(y, 0.04, 1500)
26 title "0.3 + [1.5⋅sin(2π⋅800⋅t), sin(2π⋅1200⋅t)]" fontsize 3.2
27 // Let's hear it, not too loud:
28 playsnd(y/8)
29 msg = _(["<html><h4>Example #1: Standard</h4>" ;
30 "" ;
31 "A standard sound made of 2 pure sine waves" ;
32 "of known amplitudes and frequencies is considered." ;
33 "We add a constant on demo purpose. It should not be hearable." ;
34 "" ;
35 "<b>y = 0.3 + [1.5*sin(2*%pi*800*t) sin(2*%pi*1200*t)]</b>" ;
36 "playsnd(y/8)" ;
37 "<b>mapsound(y, 0.04, 1500)</b>" ;
38 "" ;
39 "Both main frequencies and amplitudes values are reliably mapped." ;
40 "The constant appears at the zero frequency and 2×0.3 expected amplitude"
41 ]);
42 go? = messagebox(msg, "mapsound","scilab",_(["Next example" ; "Stop"]), "modal");
43 if go?==2, close(fig), return, end
44
45
46 // Example #2: Wobbling
47 // ====================
48 fs = 22050; // Sampling frequency
49 t = 0:1/fs:1;
50 f = 500*(1-t) + 2000*t;
51 y0 = sin(2*%pi*f.*t);
52 y = [y0 y0 y0];
53 // Then: build and display its map:
54 fig = scf(idfig);
55 clf reset
56 mapsound(y)
57 title "Wobbling: y = sin(2π⋅f(t)⋅t), with f=500→2000→500 Hz" fontsize 3.5
58 demo_viewCode("mapsound.dem.sce");
59 // Let's hear it, not too loud:
60 playsnd(y/8)
61 //
62 msg = ["<html><h4>Example #2: Wobbling</h4>" ;
63 "" ;
64 "Here, the sound is a sine wave whose frequency varies linearly" ;
65 "in time on the [f0=550, f1=2000] Hz interval." ;
66 "This yields some actual higher frequencies, on [f0, 2*f1-f0]." ;
67 "We repeat it 3 times one second." ;
68 "" ;
69 "fs = 22050; // Sampling frequency" ;
70 "t = 0:1/fs:1;" ;
71 "<b>f = 500*(1-t) + 2000*t</b>; // Actual instantaneous frequency" ;
72 "<b>y0 = sin(2*%pi*f.*t)</b>; // for one second" ;
73 "y = [y0 y0 y0];" ;
74 "" ;
75 "playsnd(y/8)" ;
76 "<b>mapsound(y)</b>" ;
77 ];
78 go? = messagebox(msg, "mapsound","scilab",_(["Next example" "Stop"]), "modal");
79 if go?==2, close(fig), return, end
80
81
82 // Example #3: Chimes
83 // ==================
84 [y, fs] = wavread('SCI/modules/sound/demos/chimes.wav');
85 fig = scf(idfig);
86 clf reset
87 mapsound(y,,2500,fs,parulacolormap)
88 title chimes.wav fontsize 3.5
89 demo_viewCode("mapsound.dem.sce");
90 playsnd(y)
91 msg = _(["<html><h4>Example #3: chimes.wav sound</h4>" ;
92 "" ;
93 "[y, fs] = wavread(""SCI/modules/sound/demos/chimes.wav"")";
94 "playsnd(y)" ;
95 "<b>mapsound(y, , 2500, fs, parulacolormap)</b>" ;
96 ]);
97 b = messagebox(msg, "mapsound","scilab", _(["End" ; "End & Keep the map"]), "modal");
98 if b==1, close(fig), end
99 // Otherwise: keeping the graphic figure allows to click on "View the code"
100
101endfunction
102
103demo_mapsound();
104clear demo_mapsound;
diff --git a/scilab/modules/sound/demos/sound.dem.gateway.sce b/scilab/modules/sound/demos/sound.dem.gateway.sce
index 6b57ac1..29ebb2d 100644
--- a/scilab/modules/sound/demos/sound.dem.gateway.sce
+++ b/scilab/modules/sound/demos/sound.dem.gateway.sce
@@ -9,11 +9,12 @@ function subdemolist = demo_gateway()
9 gettext("Sound file handling"); // Lets gettext() harvesting it 9 gettext("Sound file handling"); // Lets gettext() harvesting it
10 add_demo("Sound file handling", demopath + "sound.dem.gateway.sce"); 10 add_demo("Sound file handling", demopath + "sound.dem.gateway.sce");
11 11
12 subdemolist = [_("FFT on a wav file") ,"sound.dem.sce"] 12 subdemolist = [_("FFT on a wav file") , "sound.dem.sce"
13 "mapsound" , "mapsound.dem.sce"]
13 14
14 subdemolist(:,2) = demopath + subdemolist(:,2); 15 subdemolist(:,2) = demopath + subdemolist(:,2);
15 16
16endfunction 17endfunction
17 18
18subdemolist = demo_gateway(); 19subdemolist = demo_gateway();
19clear demo_gateway; \ No newline at end of file 20clear demo_gateway;
diff --git a/scilab/modules/sound/help/en_US/mapsound.xml b/scilab/modules/sound/help/en_US/mapsound.xml
index 03c6f5d..a9eae29 100644
--- a/scilab/modules/sound/help/en_US/mapsound.xml
+++ b/scilab/modules/sound/help/en_US/mapsound.xml
@@ -1,9 +1,7 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<!-- 2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) ????-2006 - INRIA - Scilab 4 * Copyright (C) 2020 - Samuel GOUGEON
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 * 5 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0, 6 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1. 7 * pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -18,19 +16,101 @@
18 xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="mapsound"> 16 xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="mapsound">
19 <refnamediv> 17 <refnamediv>
20 <refname>mapsound</refname> 18 <refname>mapsound</refname>
21 <refpurpose>Plots a sound map</refpurpose> 19 <refpurpose>
20 Computes and displays an Amplitude(time, frequency) map of a sound record
21 </refpurpose>
22 </refnamediv> 22 </refnamediv>
23 <refsynopsisdiv> 23 <refsynopsisdiv>
24 <title>Syntax</title> 24 <title>Syntax</title>
25 <synopsis>mapsound (w,dt,fmin,fmax,simpl,rate)</synopsis> 25 <synopsis>
26 mapsound(signal)
27 mapsound(signal, Dt)
28 mapsound(signal, Dt, freqRange)
29 mapsound(signal, Dt, freqRange, samplingRate)
30 mapsound(signal, Dt, freqRange, samplingRate, Colormap)
31 [times, freqs, amplitudes] = mapsound(…)
32 </synopsis>
26 </refsynopsisdiv> 33 </refsynopsisdiv>
27 <refsection> 34 <refsection>
28 <title>Arguments</title> 35 <title>Arguments</title>
29 <variablelist> 36 <variablelist>
30 <varlistentry> 37 <varlistentry>
31 <term>dt,fmin,fmax,simpl,rate</term> 38 <term>signal</term>
39 <listitem>
40 Vector or matrix of signed real numbers representing the sound signal.
41 If it's a matrix, its smallest size is considered as the number of channels.
42 Then, only the first channel is considered and mapped.
43 <para/>
44 </listitem>
45 </varlistentry>
46 <varlistentry>
47 <term>samplingRate</term>
48 <listitem>
49 Positive decimal number: Value of the sampling rate of the input
50 <varname>signal</varname>, in Hz. 22050 Hz is the default rate.
51 <para/>
52 </listitem>
53 </varlistentry>
54 <varlistentry>
55 <term>freqRange</term>
56 <listitem>
57 Specifies the interval [fmin, fmax] of positive sound frequencies to be
58 analyzed and mapped:
59 <itemizedlist>
60 <listitem>
61 If it's a scalar: It specifies the upper bound <varname>fmax</varname>.
62 Then <literal>fmin=0</literal> is used.
63 </listitem>
64 <listitem>
65 If it's a vector: It specifies [fmin, fmax].
66 </listitem>
67 </itemizedlist>
68 If a bound is > 0, it is specified in Hz. If it's negative, its absolute value
69 represents a fraction of the sampling rate. For instance, fmax=-0.2 actually
70 specifies fmax = 0.2 * samplingRate.
71 <para/>
72 The default bounds are <literal>[0, 0.2*samplingRate]</literal>.
73 <para/>
74 </listitem>
75 </varlistentry>
76 <varlistentry>
77 <term>Dt</term>
78 <listitem>
79 Specifies the time step of the map. The time step is also the
80 duration of each sound chunk considered at every time step, since the
81 <varname>signal</varname> is sliced into contiguous chunks without overlap.
82 <para/>
83 </listitem>
84 </varlistentry>
85 <varlistentry>
86 <term>times</term>
32 <listitem> 87 <listitem>
33 <para>scalars. default values dt=0.1,fmin=100,fmax=1500,simpl=1,rate=22050;</para> 88 Vector of mapped times, in seconds.
89 <para/>
90 </listitem>
91 </varlistentry>
92 <varlistentry>
93 <term>freqs</term>
94 <listitem>
95 Vector of mapped frequencies, in Hz.
96 <para/>
97 </listitem>
98 </varlistentry>
99 <varlistentry>
100 <term>amplitudes</term>
101 <listitem>
102 Matrix of mapped absolute spectral amplitudes, of size length(freqs)×length(times).
103 <para/>
104 </listitem>
105 </varlistentry>
106 <varlistentry>
107 <term>Colormap</term>
108 <listitem>
109 Identifier of the colormap function to use: autumncolormap, bonecolormap, etc.
110 The actual colormap is based on and built with it, but is not equal to it.
111 It can be inverted in order to get light colors for low amplitudes,
112 and be extrapolated to white if it does not natively include light colors.
113 <para/>
34 </listitem> 114 </listitem>
35 </varlistentry> 115 </varlistentry>
36 </variablelist> 116 </variablelist>
@@ -38,30 +118,187 @@
38 <refsection> 118 <refsection>
39 <title>Description</title> 119 <title>Description</title>
40 <para> 120 <para>
41 Plots a sound map for a sound. It does FFT at time increments dt. 121 mapsound(…) slices the input signal in consecutive chunks #0, #1,.. of equal duration
42 <literal>rate</literal> is the sampling rate. <literal>simpl</literal> points are collected for 122 <varname>Dt</varname>, up to the end of the signal. Then a discrete Fourier Transform
43 speed reasons. <literal>fmin</literal> and <literal>fmax</literal> are used for graphic 123 is computed for each chunk. The absolute value of the spectral amplitude of the chunk
44 boundaries. 124 #i is displayed at the time i*Dt, for frequencies in the chosen interval.
125 </para>
126 <para>
127 When <varname>Dt</varname> is not specified, mapsound(…) computes it in order to have
128 (almost) the same number of frequency and time bins, with the highest possible
129 (time, frequency) resolution. We may keep in mind that both time <varname>Dt</varname>
130 and frequency Δf steps are linked together by <literal>Dt.Δf=1</literal>. Thus, improving
131 one of both automatically alters the other one.
132 </para>
133 <para>
134 The (time, frequency, amplitude) values of any pixel are relative to its lower left
135 corner. The time is at the beginning of the chunk. Amplitudes are given in the
136 same unit and scale than for the input signal.
137 </para>
138 <para>
139 When the map is drawn in a new figure or a new axes alone in the figure,
140 a smart colormap is created and assigned to the figure and used for the map.
141 A colobar is displayed anyway. The number of frequency and time bins are
142 displayed below the bar. The default grid color is extracted from the sound map
143 colormap. <literal>xgrid(0)</literal> may be used to get a more visible black grid.
144 </para>
145 <para>
146 Most of input arguments are optional. To skip an argument and use its default value,
147 just omit it before the next coma. [] used as default value works as well.
45 </para> 148 </para>
46 </refsection> 149 </refsection>
47 <refsection> 150 <refsection>
48 <title>Examples</title> 151 <title>Examples</title>
152 <para>
153 <emphasis role="bold">Example #1:</emphasis> A sound made of 2 pure sine waves of
154 known amplitudes and frequencies is considered:
155 </para>
49 <programlisting role="example"><![CDATA[ 156 <programlisting role="example"><![CDATA[
50// At first we create a time vector of 0.5 seconds sampled at 22050 Hz: 157// Let's build the sound
51t = 0 : 1/22050 : 0.5*(1-%eps); 158// 1 s at 800 Hz @ amplitude=1.5, then 1 s at 1200 Hz @ amplitude = 1:
159fs = 22050;
160t = 0:1/fs:1*(1-%eps);
161y = 0.3 + [1.5*sin(2*%pi*800*t) sin(2*%pi*1200*t)];
52 162
53// Then we generate the sound. 163// Let's hear it:
54s=sin(440*t)+sin(220*t)/2+sin(880*t)/2; 164playsnd(y/4)
55[nr,nc]=size(t); 165
56s(nc/2:nc)=sin(330*t(nc/2:nc)); 166// Then: build and display its map:
57mapsound(s); 167clf
58 ]]></programlisting> 168mapsound(y, 0.04, 1500)
169title "0.3 + [1.5⋅sin(2π⋅800⋅t), sin(2π⋅1200⋅t)]" fontsize 3.2
170 ]]></programlisting>
171 <scilab:image>
172 fs = 22050;
173 t = (0:fs-1)/fs;
174 y = 0.3 + [1.5*sin(2*%pi*800*t) sin(2*%pi*1200*t)];
175 mapsound(y, 0.04, 1500)
176 title "0.3 + [1.5⋅sin(2π⋅800⋅t), sin(2π⋅1200⋅t)]" fontsize 3.2
177 </scilab:image>
178 <para>
179 Both frequencies and amplitudes values are reliably mapped, as well as the
180 average level, with the 2×0.3 amplitude at the zero frequency.
181 </para>
182 <para>
183 <emphasis role="bold">Example #2:</emphasis> Amplitude modulation: A Fc=1000 Hz
184 carrier frequency is used, modulated in a Fm=100 Hz envelope.
185 </para>
186 <programlisting role="example"><![CDATA[
187fs = 22050;
188t = (0:2*fs-1)/fs;
189y = sin(2*%pi*100*t) .* sin(2*%pi*1000*t);
190
191// Let's hear it:
192playsnd(y/4)
193
194// Then: build and display its map:
195clf
196mapsound(y, 0.05, [500 1300])
197title "sin(2π⋅100⋅t) ⋅ sin(2π⋅1000⋅t)" fontsize 3.2
198 ]]></programlisting>
199 <scilab:image>
200 fs = 22050;
201 t = (0:2*fs-1)/fs;
202 y = sin(2*%pi*100*t) .* sin(2*%pi*1000*t);
203 mapsound(y, 0.05, [500 1300])
204 title "sin(2π⋅100⋅t) ⋅ sin(2π⋅1000⋅t)" fontsize 3.2
205 </scilab:image>
206 <para>
207 As a consequence of the <literal>sin(a).sin(b)=(cos(a-b)-cos(a+b))/2</literal> formula,
208 both resulting frequencies [Fc-Fm, Fc+Fm] expected from the amplitude
209 modulation are clearly visible, with a shared amplitude=0.5
210 </para>
211
212 <para>
213 <emphasis role="bold">Example #3:</emphasis> Wobbling. Here, the frequency of a
214 sine wave is linearly varied on [f0, f1]. This yields some actual higher frequencies,
215 on [f0, 2*f1-f0]:
216 </para>
217 <programlisting role="example"><![CDATA[
218fs = 22050;
219t = (0:fs-1)/fs;
220f = 500*(1-t) + 2000*t;
221y0 = sin(2*%pi*f.*t);
222y = [y0 y0($:-1:1)];
223
224playsnd(y/4)
225
226clf
227mapsound(y)
228title "Wobbling: y = sin(2π⋅f(t)⋅t), with f=500→2000→500 Hz" fontsize 3.5
229 ]]></programlisting>
230 <scilab:image>
231 fs = 22050;
232 t = (0:fs-1)/fs;
233 f = 500*(1-t) + 2000*t;
234 y0 = sin(2*%pi*f.*t);
235 y = [y0 y0($:-1:1)];
236 mapsound(y)
237 title "Wobbling: y = sin(2π⋅f(t)⋅t), with f=500→2000→500 Hz" fontsize 3.5
238 </scilab:image>
239
240 <para>
241 <emphasis role="bold">Example #4:</emphasis> Chimes.wav : a quite structured sound
242 </para>
243 <programlisting role="example"><![CDATA[
244[s1, fs1] = wavread('SCI/modules/sound/demos/chimes.wav');
245
246playsnd([]), sleep(500), playsnd(s1/2), sleep(1000)
247
248clf
249mapsound(s1,, 2300, , parulacolormap)
250title Chimes.wav fontsize 3.5
251 ]]></programlisting>
59 <scilab:image> 252 <scilab:image>
60 t = 0 : 1/22050 : 0.5*(1-%eps); 253 [s1, fs1] = wavread('SCI/modules/sound/demos/chimes.wav');
61 s=sin(440*t)+sin(220*t)/2+sin(880*t)/2; 254 clf
62 [nr,nc]=size(t); 255 mapsound(s1,,2300,,parulacolormap)
63 s(nc/2:nc)=sin(330*t(nc/2:nc)); 256 title Chimes.wav fontsize 3.5
64 mapsound(s);
65 </scilab:image> 257 </scilab:image>
258
259 <para>
260 <emphasis role="bold">Example #5:</emphasis> Another sound, longer and more noisy
261 </para>
262 <programlisting role="example"><![CDATA[
263[s2, fs2] = wavread('SCI/modules/sound/tests/nonreg_tests/bug_467.wav');
264
265playsnd([]), sleep(500), playsnd(s2/3)
266
267clf
268mapsound(s2, , 4000)
269title Din fontsize 3.5
270 ]]></programlisting>
271 <scilab:image>
272 [s2, fs2] = wavread('SCI/modules/sound/tests/nonreg_tests/bug_467.wav');
273 mapsound(s2, , 4000)
274 title Din fontsize 3.5
275 </scilab:image>
276 </refsection>
277 <refsection role="see also">
278 <title>See also</title>
279 <simplelist type="inline">
280 <member>
281 <link linkend="fft">fft</link>
282 </member>
283 <member>
284 <link linkend="analyze">analyze</link>
285 </member>
286 <member>
287 <link linkend="intdec">intdec</link>
288 </member>
289 </simplelist>
290 </refsection>
291 <refsection role="history">
292 <title>History</title>
293 <revhistory>
294 <revision>
295 <revnumber>6.1.1</revnumber>
296 <revdescription>
297 mapsound() rewritten: fmin and fmax merged into freqRange ;
298 Colormap, times, frequencies, amplitudes arguments added ;
299 simpl removed.
300 </revdescription>
301 </revision>
302 </revhistory>
66 </refsection> 303 </refsection>
67</refentry> 304</refentry>
diff --git a/scilab/modules/sound/help/ja_JP/mapsound.xml b/scilab/modules/sound/help/ja_JP/mapsound.xml
deleted file mode 100644
index 1507126..0000000
--- a/scilab/modules/sound/help/ja_JP/mapsound.xml
+++ /dev/null
@@ -1,66 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) ????-2006 - INRIA - Scilab
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
14 *
15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="mapsound">
17 <refnamediv>
18 <refname>mapsound</refname>
19 <refpurpose>サウンドマップをプロット</refpurpose>
20 </refnamediv>
21 <refsynopsisdiv>
22 <title>呼び出し手順</title>
23 <synopsis>mapsound (w,dt,fmin,fmax,simpl,rate)</synopsis>
24 </refsynopsisdiv>
25 <refsection>
26 <title>引数</title>
27 <variablelist>
28 <varlistentry>
29 <term>dt,fmin,fmax,simpl,rate</term>
30 <listitem>
31 <para>スカラー. デフォルト値 dt=0.1,fmin=100,fmax=1500,simpl=1,rate=22050;</para>
32 </listitem>
33 </varlistentry>
34 </variablelist>
35 </refsection>
36 <refsection>
37 <title>説明</title>
38 <para>
39 音のサウンドマップをプロット. 時間増分dt毎にFFTを行います.
40 <literal>rate</literal> はサンプリング・レートです.
41 速度面を考慮して<literal>simpl</literal> 点が収集されます.
42 <literal>fmin</literal> および <literal>fmax</literal> が
43 グラフィック境界として使用されます.
44 </para>
45 </refsection>
46 <refsection>
47 <title>例</title>
48 <programlisting role="example"><![CDATA[
49// まず0.5秒分のサウンドパラメータを生成
50t = 0 : 1/22050 : 0.5*(1-%eps);
51
52// 次にサウンドを生成.
53s=sin(440*t)+sin(220*t)/2+sin(880*t)/2;
54[nr,nc]=size(t);
55s(nc/2:nc)=sin(330*t(nc/2:nc));
56mapsound(s);
57 ]]></programlisting>
58 <scilab:image>
59 t = 0 : 1/22050 : 0.5*(1-%eps);
60 s=sin(440*t)+sin(220*t)/2+sin(880*t)/2;
61 [nr,nc]=size(t);
62 s(nc/2:nc)=sin(330*t(nc/2:nc));
63 mapsound(s);
64 </scilab:image>
65 </refsection>
66</refentry>
diff --git a/scilab/modules/sound/locales/ca_ES.po b/scilab/modules/sound/locales/ca_ES.po
index 4b77624..e03e572 100644
--- a/scilab/modules/sound/locales/ca_ES.po
+++ b/scilab/modules/sound/locales/ca_ES.po
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: scilab\n" 8"Project-Id-Version: scilab\n"
9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
10"POT-Creation-Date: 2013-04-16 17:44+0100\n" 10"POT-Creation-Date: 2013-04-16 17:44+0100\n"
11"PO-Revision-Date: 2015-10-08 22:07+0000\n" 11"PO-Revision-Date: 2020-10-30 22:07+0000\n"
12"Last-Translator: Scilab.team <Unknown>\n" 12"Last-Translator: Scilab.team <Unknown>\n"
13"Language-Team: Catalan <ca@li.org>\n" 13"Language-Team: Catalan <ca@li.org>\n"
14"MIME-Version: 1.0\n" 14"MIME-Version: 1.0\n"
@@ -253,8 +253,8 @@ msgstr ""
253"%s: Hi ha hagut un error: El format de compressió de dades %s no està " 253"%s: Hi ha hagut un error: El format de compressió de dades %s no està "
254"suportat.\n" 254"suportat.\n"
255 255
256msgid "Cannot read .wav file with more than 16 bits per sample." 256msgid "Cannot read .wav file with more than 32 bits per sample."
257msgstr "No s'ha pogut llegir el fitxer .wav amb més de 16 bits per mostra." 257msgstr "No s'ha pogut llegir el fitxer .wav amb més de 32 bits per mostra."
258 258
259msgid "Sample limit vector must have 2 entries." 259msgid "Sample limit vector must have 2 entries."
260msgstr "El vector de límit de mostra ha de tenir 2 entrades." 260msgstr "El vector de límit de mostra ha de tenir 2 entrades."
diff --git a/scilab/modules/sound/locales/cs_CZ.po b/scilab/modules/sound/locales/cs_CZ.po
index d064c46..2dc4b20 100644
--- a/scilab/modules/sound/locales/cs_CZ.po
+++ b/scilab/modules/sound/locales/cs_CZ.po
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: scilab\n" 8"Project-Id-Version: scilab\n"
9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
10"POT-Creation-Date: 2013-04-16 17:44+0100\n" 10"POT-Creation-Date: 2013-04-16 17:44+0100\n"
11"PO-Revision-Date: 2015-10-08 22:03+0000\n" 11"PO-Revision-Date: 2020-10-30 22:03+0000\n"
12"Last-Translator: Scilab.team <Unknown>\n" 12"Last-Translator: Scilab.team <Unknown>\n"
13"Language-Team: Czech <cs@li.org>\n" 13"Language-Team: Czech <cs@li.org>\n"
14"MIME-Version: 1.0\n" 14"MIME-Version: 1.0\n"
@@ -245,8 +245,8 @@ msgstr "Vyba při čtení souboru .wav."
245msgid "%s: An error occurred: Data compression format %s is not supported.\n" 245msgid "%s: An error occurred: Data compression format %s is not supported.\n"
246msgstr "%s: Vyskytla se chyba: Formát komprese dat %s není podporován.\n" 246msgstr "%s: Vyskytla se chyba: Formát komprese dat %s není podporován.\n"
247 247
248msgid "Cannot read .wav file with more than 16 bits per sample." 248msgid "Cannot read .wav file with more than 32 bits per sample."
249msgstr "Nelze číst soubor .wav s více než 16 bity na vzorek." 249msgstr "Nelze číst soubor .wav s více než 32 bity na vzorek."
250 250
251msgid "Sample limit vector must have 2 entries." 251msgid "Sample limit vector must have 2 entries."
252msgstr "Vektor limitu vzorku musí mít 2 záznamy." 252msgstr "Vektor limitu vzorku musí mít 2 záznamy."
diff --git a/scilab/modules/sound/locales/de_DE.po b/scilab/modules/sound/locales/de_DE.po
index f972a0f..72795f0 100644
--- a/scilab/modules/sound/locales/de_DE.po
+++ b/scilab/modules/sound/locales/de_DE.po
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: scilab\n" 8"Project-Id-Version: scilab\n"
9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
10"POT-Creation-Date: 2013-04-16 17:44+0100\n" 10"POT-Creation-Date: 2013-04-16 17:44+0100\n"
11"PO-Revision-Date: 2019-02-17 16:02+0000\n" 11"PO-Revision-Date: 2020-10-30 16:02+0000\n"
12"Last-Translator: Stephan Woidowski <swoidowski@t-online.de>\n" 12"Last-Translator: Stephan Woidowski <swoidowski@t-online.de>\n"
13"Language-Team: German <de@li.org>\n" 13"Language-Team: German <de@li.org>\n"
14"MIME-Version: 1.0\n" 14"MIME-Version: 1.0\n"
@@ -253,8 +253,8 @@ msgstr ""
253"%s: ein Fehler ist aufgetreten: Daten-Kompression-Format %s wird nicht " 253"%s: ein Fehler ist aufgetreten: Daten-Kompression-Format %s wird nicht "
254"unterstützt.\n" 254"unterstützt.\n"
255 255
256msgid "Cannot read .wav file with more than 16 bits per sample." 256msgid "Cannot read .wav file with more than 32 bits per sample."
257msgstr "Kann keine .wav Datei mit mehr als 16 pro Abtastwert lesen" 257msgstr "Kann keine .wav Datei mit mehr als 32 pro Abtastwert lesen"
258 258
259msgid "Sample limit vector must have 2 entries." 259msgid "Sample limit vector must have 2 entries."
260msgstr "Abtast-Grenz-Vektor muß 2 Einträge haben." 260msgstr "Abtast-Grenz-Vektor muß 2 Einträge haben."
diff --git a/scilab/modules/sound/locales/es_ES.po b/scilab/modules/sound/locales/es_ES.po
index a3b637d..5374e6b 100644
--- a/scilab/modules/sound/locales/es_ES.po
+++ b/scilab/modules/sound/locales/es_ES.po
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: scilab\n" 8"Project-Id-Version: scilab\n"
9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
10"POT-Creation-Date: 2013-04-16 17:44+0100\n" 10"POT-Creation-Date: 2013-04-16 17:44+0100\n"
11"PO-Revision-Date: 2015-10-08 22:10+0000\n" 11"PO-Revision-Date: 2020-10-30 22:10+0000\n"
12"Last-Translator: Scilab.team <Unknown>\n" 12"Last-Translator: Scilab.team <Unknown>\n"
13"Language-Team: Spanish <es@li.org>\n" 13"Language-Team: Spanish <es@li.org>\n"
14"MIME-Version: 1.0\n" 14"MIME-Version: 1.0\n"
@@ -253,8 +253,8 @@ msgstr ""
253"%s: A ocurrido un error: El formato de compresión de datos %s no está " 253"%s: A ocurrido un error: El formato de compresión de datos %s no está "
254"soportado.\n" 254"soportado.\n"
255 255
256msgid "Cannot read .wav file with more than 16 bits per sample." 256msgid "Cannot read .wav file with more than 32 bits per sample."
257msgstr "No se puede leer el archivo .wav con más de 16 bits por muestra" 257msgstr "No se puede leer el archivo .wav con más de 32 bits por muestra"
258 258
259msgid "Sample limit vector must have 2 entries." 259msgid "Sample limit vector must have 2 entries."
260msgstr "El vector límite de muestra debe tener 2 entradas" 260msgstr "El vector límite de muestra debe tener 2 entradas"
diff --git a/scilab/modules/sound/locales/fr_FR.po b/scilab/modules/sound/locales/fr_FR.po
index 01e3d33..00e9b56 100644
--- a/scilab/modules/sound/locales/fr_FR.po
+++ b/scilab/modules/sound/locales/fr_FR.po
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: scilab\n" 8"Project-Id-Version: scilab\n"
9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
10"POT-Creation-Date: 2013-04-16 17:44+0100\n" 10"POT-Creation-Date: 2013-04-16 17:44+0100\n"
11"PO-Revision-Date: 2020-02-18 14:49+0000\n" 11"PO-Revision-Date: 2020-10-30 14:49+0000\n"
12"Last-Translator: CARNIS Adeline <Unknown>\n" 12"Last-Translator: CARNIS Adeline <Unknown>\n"
13"Language-Team: French <fr@li.org>\n" 13"Language-Team: French <fr@li.org>\n"
14"MIME-Version: 1.0\n" 14"MIME-Version: 1.0\n"
@@ -257,9 +257,9 @@ msgstr ""
257"%s : Une erreur est survenue : Le format de compression de données %s n'est " 257"%s : Une erreur est survenue : Le format de compression de données %s n'est "
258"pas supporté.\n" 258"pas supporté.\n"
259 259
260msgid "Cannot read .wav file with more than 16 bits per sample." 260msgid "Cannot read .wav file with more than 32 bits per sample."
261msgstr "" 261msgstr ""
262"Impossible de lire le fichier .wav avec plus de 16 bits par échantillons." 262"Impossible de lire le fichier .wav avec plus de 32 bits par échantillon."
263 263
264msgid "Sample limit vector must have 2 entries." 264msgid "Sample limit vector must have 2 entries."
265msgstr "Le vecteur des limites d'échantillonnages doit avoir 2 entrées." 265msgstr "Le vecteur des limites d'échantillonnages doit avoir 2 entrées."
diff --git a/scilab/modules/sound/locales/it_IT.po b/scilab/modules/sound/locales/it_IT.po
index 9b53bd1..0a5551a 100644
--- a/scilab/modules/sound/locales/it_IT.po
+++ b/scilab/modules/sound/locales/it_IT.po
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: scilab\n" 8"Project-Id-Version: scilab\n"
9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
10"POT-Creation-Date: 2013-04-16 17:44+0100\n" 10"POT-Creation-Date: 2013-04-16 17:44+0100\n"
11"PO-Revision-Date: 2015-10-08 22:01+0000\n" 11"PO-Revision-Date: 2020-10-30 22:01+0000\n"
12"Last-Translator: Carml <mighty.carml@gmail.com>\n" 12"Last-Translator: Carml <mighty.carml@gmail.com>\n"
13"Language-Team: Italian <it@li.org>\n" 13"Language-Team: Italian <it@li.org>\n"
14"MIME-Version: 1.0\n" 14"MIME-Version: 1.0\n"
@@ -264,9 +264,9 @@ msgstr ""
264"%s: Si è verificato un errore: Il formato %s per la compressione dei dati " 264"%s: Si è verificato un errore: Il formato %s per la compressione dei dati "
265"non è supportato.\n" 265"non è supportato.\n"
266 266
267msgid "Cannot read .wav file with more than 16 bits per sample." 267msgid "Cannot read .wav file with more than 32 bits per sample."
268msgstr "" 268msgstr ""
269"Non è possibile leggere file .wav con più di 16 bit per campione audio." 269"Non è possibile leggere file .wav con più di 32 bit per campione audio."
270 270
271msgid "Sample limit vector must have 2 entries." 271msgid "Sample limit vector must have 2 entries."
272msgstr "Il vettore del limite del campione audio deve avere 2 voci." 272msgstr "Il vettore del limite del campione audio deve avere 2 voci."
diff --git a/scilab/modules/sound/locales/ja_JP.po b/scilab/modules/sound/locales/ja_JP.po
index 610bd42..a7c527b 100644
--- a/scilab/modules/sound/locales/ja_JP.po
+++ b/scilab/modules/sound/locales/ja_JP.po
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: scilab\n" 8"Project-Id-Version: scilab\n"
9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
10"POT-Creation-Date: 2013-04-16 17:44+0100\n" 10"POT-Creation-Date: 2013-04-16 17:44+0100\n"
11"PO-Revision-Date: 2017-05-01 15:27+0000\n" 11"PO-Revision-Date: 2020-10-30 15:27+0000\n"
12"Last-Translator: Rui Hirokawa <Unknown>\n" 12"Last-Translator: Rui Hirokawa <Unknown>\n"
13"Language-Team: Japanese <z-saito@guitar.ocn.ne.jp>\n" 13"Language-Team: Japanese <z-saito@guitar.ocn.ne.jp>\n"
14"MIME-Version: 1.0\n" 14"MIME-Version: 1.0\n"
@@ -264,8 +264,8 @@ msgstr "wavファイルの読み込みエラーです。"
264msgid "%s: An error occurred: Data compression format %s is not supported.\n" 264msgid "%s: An error occurred: Data compression format %s is not supported.\n"
265msgstr "%s: エラーが起きました: データ圧縮フォーマット %s サポートされません。\n" 265msgstr "%s: エラーが起きました: データ圧縮フォーマット %s サポートされません。\n"
266 266
267msgid "Cannot read .wav file with more than 16 bits per sample." 267msgid "Cannot read .wav file with more than 32 bits per sample."
268msgstr "16ビット/サンプルを超える .wav ファイルを読み込むことはできません." 268msgstr "32ビット/サンプルを超える .wav ファイルを読み込むことはできません."
269 269
270msgid "Sample limit vector must have 2 entries." 270msgid "Sample limit vector must have 2 entries."
271msgstr "サンプル範囲ベクトルは2つのエントリを有する必要があります." 271msgstr "サンプル範囲ベクトルは2つのエントリを有する必要があります."
diff --git a/scilab/modules/sound/locales/pl_PL.po b/scilab/modules/sound/locales/pl_PL.po
index 0f17326..91a84db 100644
--- a/scilab/modules/sound/locales/pl_PL.po
+++ b/scilab/modules/sound/locales/pl_PL.po
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: scilab\n" 8"Project-Id-Version: scilab\n"
9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
10"POT-Creation-Date: 2013-04-16 17:44+0100\n" 10"POT-Creation-Date: 2013-04-16 17:44+0100\n"
11"PO-Revision-Date: 2019-02-15 22:12+0000\n" 11"PO-Revision-Date: 2020-10-30 22:12+0000\n"
12"Last-Translator: Scilab.team <Unknown>\n" 12"Last-Translator: Scilab.team <Unknown>\n"
13"Language-Team: Polish <pl@li.org>\n" 13"Language-Team: Polish <pl@li.org>\n"
14"MIME-Version: 1.0\n" 14"MIME-Version: 1.0\n"
@@ -251,9 +251,9 @@ msgstr "Błąd odczytu pliku WAV."
251msgid "%s: An error occurred: Data compression format %s is not supported.\n" 251msgid "%s: An error occurred: Data compression format %s is not supported.\n"
252msgstr "%s: Wystąpił błąd %s format kompresji danych nie jest obsługiwany.\n" 252msgstr "%s: Wystąpił błąd %s format kompresji danych nie jest obsługiwany.\n"
253 253
254msgid "Cannot read .wav file with more than 16 bits per sample." 254msgid "Cannot read .wav file with more than 32 bits per sample."
255msgstr "" 255msgstr ""
256"Nie można odczytać pliku .wav który posiada więcej niż 16 bitów na próbkę." 256"Nie można odczytać pliku .wav który posiada więcej niż 32 bitów na próbkę."
257 257
258msgid "Sample limit vector must have 2 entries." 258msgid "Sample limit vector must have 2 entries."
259msgstr "Wektor granic próbki musi posiadać dwie wartości." 259msgstr "Wektor granic próbki musi posiadać dwie wartości."
diff --git a/scilab/modules/sound/locales/pt_BR.po b/scilab/modules/sound/locales/pt_BR.po
index 12521ca..e9989ec 100644
--- a/scilab/modules/sound/locales/pt_BR.po
+++ b/scilab/modules/sound/locales/pt_BR.po
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: scilab\n" 8"Project-Id-Version: scilab\n"
9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
10"POT-Creation-Date: 2013-04-16 17:44+0100\n" 10"POT-Creation-Date: 2013-04-16 17:44+0100\n"
11"PO-Revision-Date: 2015-10-08 21:59+0000\n" 11"PO-Revision-Date: 2020-10-30 21:59+0000\n"
12"Last-Translator: Scilab.team <Unknown>\n" 12"Last-Translator: Scilab.team <Unknown>\n"
13"Language-Team: Brazilian Portuguese <pt_BR@li.org>\n" 13"Language-Team: Brazilian Portuguese <pt_BR@li.org>\n"
14"MIME-Version: 1.0\n" 14"MIME-Version: 1.0\n"
@@ -252,8 +252,8 @@ msgstr ""
252"%s: Ocorreu um erro: não há suporte para o formato %s de compressão de " 252"%s: Ocorreu um erro: não há suporte para o formato %s de compressão de "
253"dados.\n" 253"dados.\n"
254 254
255msgid "Cannot read .wav file with more than 16 bits per sample." 255msgid "Cannot read .wav file with more than 32 bits per sample."
256msgstr "Não é possível ler o arquivo .wav com mais de 16 bits por amostra." 256msgstr "Não é possível ler o arquivo .wav com mais de 32 bits por amostra."
257 257
258msgid "Sample limit vector must have 2 entries." 258msgid "Sample limit vector must have 2 entries."
259msgstr "O vetor de limite de amostra deve ter 2 entradas." 259msgstr "O vetor de limite de amostra deve ter 2 entradas."
diff --git a/scilab/modules/sound/locales/ru_RU.po b/scilab/modules/sound/locales/ru_RU.po
index ab2cdcf..9446459 100644
--- a/scilab/modules/sound/locales/ru_RU.po
+++ b/scilab/modules/sound/locales/ru_RU.po
@@ -10,7 +10,7 @@ msgstr ""
10"Project-Id-Version: sound-ru\n" 10"Project-Id-Version: sound-ru\n"
11"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 11"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
12"POT-Creation-Date: 2013-04-16 17:44+0100\n" 12"POT-Creation-Date: 2013-04-16 17:44+0100\n"
13"PO-Revision-Date: 2020-02-15 08:54+0000\n" 13"PO-Revision-Date: 2020-10-30 08:54+0000\n"
14"Last-Translator: Aleksey Kabanov <Unknown>\n" 14"Last-Translator: Aleksey Kabanov <Unknown>\n"
15"Language-Team: Russian <localization@lists.scilab.org>\n" 15"Language-Team: Russian <localization@lists.scilab.org>\n"
16"MIME-Version: 1.0\n" 16"MIME-Version: 1.0\n"
@@ -250,8 +250,8 @@ msgstr "Ошибка чтения wav файла."
250msgid "%s: An error occurred: Data compression format %s is not supported.\n" 250msgid "%s: An error occurred: Data compression format %s is not supported.\n"
251msgstr "%s: Произошла ошибка: формат сжатия данных %s не поддерживается.\n" 251msgstr "%s: Произошла ошибка: формат сжатия данных %s не поддерживается.\n"
252 252
253msgid "Cannot read .wav file with more than 16 bits per sample." 253msgid "Cannot read .wav file with more than 32 bits per sample."
254msgstr "Не удалось прочитать .wav файл с более чем 16- битами на сэмпл." 254msgstr "Не удалось прочитать .wav файл с более чем 32- битами на сэмпл."
255 255
256msgid "Sample limit vector must have 2 entries." 256msgid "Sample limit vector must have 2 entries."
257msgstr "" 257msgstr ""
diff --git a/scilab/modules/sound/locales/sound.pot b/scilab/modules/sound/locales/sound.pot
index 971d9ce..f50ce3a 100644
--- a/scilab/modules/sound/locales/sound.pot
+++ b/scilab/modules/sound/locales/sound.pot
@@ -15,7 +15,7 @@ msgstr ""
15"MIME-Version: 1.0\n" 15"MIME-Version: 1.0\n"
16"Content-Type: text/plain; charset=UTF-8\n" 16"Content-Type: text/plain; charset=UTF-8\n"
17"Content-Transfer-Encoding: 8bit\n" 17"Content-Transfer-Encoding: 8bit\n"
18"Revision-Date: 2020-02-18 16:36+0100\n" 18"Revision-Date: 2020-10-30 16:36+0100\n"
19 19
20# File: modules/sound/sci_gateway/c/sci_PlaySound.c, line: 51 20# File: modules/sound/sci_gateway/c/sci_PlaySound.c, line: 51
21# File: modules/sound/sci_gateway/c/sci_PlaySound.c, line: 59 21# File: modules/sound/sci_gateway/c/sci_PlaySound.c, line: 59
@@ -385,7 +385,7 @@ msgstr ""
385 385
386# 386#
387# File: modules/sound/macros/wavread.sci, line: 321 387# File: modules/sound/macros/wavread.sci, line: 321
388msgid "Cannot read .wav file with more than 16 bits per sample." 388msgid "Cannot read .wav file with more than 32 bits per sample."
389msgstr "" 389msgstr ""
390 390
391# 391#
diff --git a/scilab/modules/sound/locales/uk_UA.po b/scilab/modules/sound/locales/uk_UA.po
index d11f30a..c658ad3 100644
--- a/scilab/modules/sound/locales/uk_UA.po
+++ b/scilab/modules/sound/locales/uk_UA.po
@@ -9,7 +9,7 @@ msgstr ""
9"Project-Id-Version: scilab\n" 9"Project-Id-Version: scilab\n"
10"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 10"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
11"POT-Creation-Date: 2013-04-16 17:44+0100\n" 11"POT-Creation-Date: 2013-04-16 17:44+0100\n"
12"PO-Revision-Date: 2020-02-19 08:56+0000\n" 12"PO-Revision-Date: 2020-10-30 08:56+0000\n"
13"Last-Translator: Yuri Chornoivan <yurchor@gmail.com>\n" 13"Last-Translator: Yuri Chornoivan <yurchor@gmail.com>\n"
14"Language-Team: Ukrainian <translation@linux.org.ua>\n" 14"Language-Team: Ukrainian <translation@linux.org.ua>\n"
15"MIME-Version: 1.0\n" 15"MIME-Version: 1.0\n"
@@ -263,8 +263,8 @@ msgstr "Помилка читання файла wav."
263msgid "%s: An error occurred: Data compression format %s is not supported.\n" 263msgid "%s: An error occurred: Data compression format %s is not supported.\n"
264msgstr "%s: сталася помилка: формат стискання даних %s не підтримується.\n" 264msgstr "%s: сталася помилка: формат стискання даних %s не підтримується.\n"
265 265
266msgid "Cannot read .wav file with more than 16 bits per sample." 266msgid "Cannot read .wav file with more than 32 bits per sample."
267msgstr "Читання файла .wav у форматі 16 бітів на семпл неможливе." 267msgstr "Читання файла .wav у форматі 32 бітів на семпл неможливе."
268 268
269msgid "Sample limit vector must have 2 entries." 269msgid "Sample limit vector must have 2 entries."
270msgstr "Вектор обмеження семпла має складатися з двох записів 2." 270msgstr "Вектор обмеження семпла має складатися з двох записів 2."
diff --git a/scilab/modules/sound/locales/zh_CN.po b/scilab/modules/sound/locales/zh_CN.po
index 0bb2ca3..d59500d 100644
--- a/scilab/modules/sound/locales/zh_CN.po
+++ b/scilab/modules/sound/locales/zh_CN.po
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: scilab\n" 8"Project-Id-Version: scilab\n"
9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
10"POT-Creation-Date: 2013-04-16 17:44+0100\n" 10"POT-Creation-Date: 2013-04-16 17:44+0100\n"
11"PO-Revision-Date: 2017-11-02 12:53+0000\n" 11"PO-Revision-Date: 2020-10-30 12:53+0000\n"
12"Last-Translator: Webish <Unknown>\n" 12"Last-Translator: Webish <Unknown>\n"
13"Language-Team: Simplified Chinese <zh_CN@li.org>\n" 13"Language-Team: Simplified Chinese <zh_CN@li.org>\n"
14"MIME-Version: 1.0\n" 14"MIME-Version: 1.0\n"
@@ -237,8 +237,8 @@ msgstr "读wav文件时发生错误。"
237msgid "%s: An error occurred: Data compression format %s is not supported.\n" 237msgid "%s: An error occurred: Data compression format %s is not supported.\n"
238msgstr "%s:一个错误发生:不支持格式%s的数据压缩。\n" 238msgstr "%s:一个错误发生:不支持格式%s的数据压缩。\n"
239 239
240msgid "Cannot read .wav file with more than 16 bits per sample." 240msgid "Cannot read .wav file with more than 32 bits per sample."
241msgstr "无法读每个采样超过16位的.wav文件。" 241msgstr "无法读每个采样超过32位的.wav文件。"
242 242
243msgid "Sample limit vector must have 2 entries." 243msgid "Sample limit vector must have 2 entries."
244msgstr "采样限制向量必须有2个入口。" 244msgstr "采样限制向量必须有2个入口。"
diff --git a/scilab/modules/sound/locales/zh_TW.po b/scilab/modules/sound/locales/zh_TW.po
index 8d55a8e..9ca6126 100644
--- a/scilab/modules/sound/locales/zh_TW.po
+++ b/scilab/modules/sound/locales/zh_TW.po
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: scilab\n" 8"Project-Id-Version: scilab\n"
9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" 9"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
10"POT-Creation-Date: 2013-04-16 17:44+0100\n" 10"POT-Creation-Date: 2013-04-16 17:44+0100\n"
11"PO-Revision-Date: 2015-10-08 22:03+0000\n" 11"PO-Revision-Date: 2020-10-30 22:03+0000\n"
12"Last-Translator: tim loo <timloo0710@gmail.com>\n" 12"Last-Translator: tim loo <timloo0710@gmail.com>\n"
13"Language-Team: Traditional Chinese <zh_TW@li.org>\n" 13"Language-Team: Traditional Chinese <zh_TW@li.org>\n"
14"MIME-Version: 1.0\n" 14"MIME-Version: 1.0\n"
@@ -237,8 +237,8 @@ msgstr "讀取.wav 檔有誤."
237msgid "%s: An error occurred: Data compression format %s is not supported.\n" 237msgid "%s: An error occurred: Data compression format %s is not supported.\n"
238msgstr "%s: 錯誤: 未支持資料壓縮格式 %s .\n" 238msgstr "%s: 錯誤: 未支持資料壓縮格式 %s .\n"
239 239
240msgid "Cannot read .wav file with more than 16 bits per sample." 240msgid "Cannot read .wav file with more than 32 bits per sample."
241msgstr "不能用每個樣本大於16 bits 才讀.wav檔" 241msgstr "不能用每個樣本大於32 bits 才讀.wav檔"
242 242
243msgid "Sample limit vector must have 2 entries." 243msgid "Sample limit vector must have 2 entries."
244msgstr "取樣的極限向量只能有2個輸入值." 244msgstr "取樣的極限向量只能有2個輸入值."
diff --git a/scilab/modules/sound/macros/mapsound.sci b/scilab/modules/sound/macros/mapsound.sci
index 91c86f0..d2812be 100644
--- a/scilab/modules/sound/macros/mapsound.sci
+++ b/scilab/modules/sound/macros/mapsound.sci
@@ -1,7 +1,5 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) ???? - INRIA - Scilab 2// Copyright (C) 2020 - Samuel GOUGEON
3//
4// Copyright (C) 2012 - 2016 - Scilab Enterprises
5// 3//
6// This file is hereby licensed under the terms of the GNU GPL v2.0, 4// This file is hereby licensed under the terms of the GNU GPL v2.0,
7// pursuant to article 5.3.4 of the CeCILL v.2.1. 5// pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -10,39 +8,147 @@
10// For more information, see the COPYING file which you should have received 8// For more information, see the COPYING file which you should have received
11// along with this program. 9// along with this program.
12 10
13function mapsound (w,dt,fmin,fmax,simpl,rate) 11function varargout = mapsound(w, dt, frange, rate, Colormap)
14 // Plots a sound map for a sound. 12 // rate: Sampling rate [Hz]
15 // It does FFT at time increments dt. 13 // frange = fmax (with fmin=0) | [fmin fmax]
16 // rate is the sampling rate. 14 // varargout = list(dates_vector, frequencies_vector, amplitudes_matrix)
17 // simpl points are collected for speed reasons. 15 if ~isdef("rate","l") | rate==[] then
18 16 rate = 22050
19 [lhs,rhs]=argn(0); 17 end
20 if ( rhs <= 5 ) then rate=0;end 18 nSamples = max(size(w))
21 if ( rhs <= 4 ) then simpl=1; end ; 19 T = nSamples / rate
22 if ( rhs <= 3 ) then fmax=1500; end ; 20
23 if ( rhs <= 2 ) then fmin=100; end ; 21 if ~isdef("frange","l") | frange==[] then
24 if ( rhs <= 1 ) then dt=0.1; end ; 22 fmin = 0
25 n=prod(size(w)); 23 fmax = -0.2 // Could be set according to an amplitude threshold
26 defaultrate=22050; 24 elseif length(frange)==1
27 if rate==0; rate=defaultrate; end; 25 fmin = 0
28 dp=dt*rate; 26 fmax = frange
29 points=2^floor(log(dp)/log(2)); 27 else
30 ind=fmin/rate*points/simpl:fmax/rate*points/simpl; 28 [fmin, fmax]= (frange(1), frange(2))
31 f=abs(fft(w(1:points),1)); 29 end
32 f=sum(matrix(f,points/simpl,simpl),"c")'; 30 if fmin < 0
33 M=f(ind); 31 fmin = rate * abs(fmin)
34 i=1; 32 end
35 i=i+dp; 33 if fmax < 0 & abs(fmax) < 1
36 while i+points <= n; 34 fmax = rate * abs(fmax)
37 f=abs(fft(w(i:i+points-1),1)); 35 end
38 f=sum(matrix(f,points/simpl,simpl),"c")'; 36
39 M=[M;f(ind)]; 37 if ~isdef("dt","l") | dt==[] then
40 i=i+dp; 38 nspect = floor(sqrt(fmax*T)) // => nspect =~= nfreq
41 end; 39 dt = T / nspect
42 [nl,nc]=size(M); 40 elseif dt < 0 // -dt indicates the wished number of spectra
43 if nl==1 ; return;end 41 dt = abs(dt) * T
44 x_abs= (0:(nl-1))*(n/rate)/(nl-1); 42 nspect = floor(T / dt)
45 y_abs= (0:(nc-1))/(nc-1); 43 else
46 y_abs= fmin*(1-y_abs) + fmax*(y_abs) 44 nspect = floor(T / dt)
47 grayplot(x_abs,y_abs,-M) 45 end
46 if ~isdef("fmin","l") then
47 fmin = 0
48 end
49 //
50 dp = round(dt*rate)
51 [x, y] = ndgrid(1:dp, 0:(nspect-1))
52 ind = x + floor(y * dt * rate);
53
54 M = abs(fft(w(ind), -1, 1))
55 M = M(1:ceil(dp/2), :) // spectra are even, since the input signal is real
56
57 df = 1 / (dp/rate);
58 frequencies = (0:(dp-ceil(dp/2))) * df
59 sel = find(frequencies >= fmin & frequencies <= fmax)
60 M = M(sel,:) / length(frequencies)
61 frequencies = frequencies(sel)
62 dates = (0:size(M,2)-1) * dt
63
64 // Display
65 // -------
66 // Set a smart colormap if it is not disturbing:
67 gridColor = 0 // default value = black
68 // menus are not clf reset and must not prevent initializing the colormap:
69 if winsid() <> [] then
70 tmp = gca().parent.children.type
71 tmp(tmp=="uimenu") = []
72 end
73 if isdef("Colormap","l") | winsid()==[] | (size(tmp,"*")==1 & ..
74 size(gcf().color_map,1)==size(gdf().color_map,1) & ..
75 length(gca().children)==0) then
76 e = 0 // extension of the raw colormap to white (number of graded colors)
77 // e < 0 => invert the order the native colormap part
78 // in order to get lighter colors for lower amplitudes
79 if isdef("Colormap","l") then
80 select Colormap
81 case autumncolormap, e = -15
82 case bonecolormap, e = -1
83 case coolcolormap, e = 20
84 case coppercolormap, e = -15
85 case graycolormap, e = -1
86 case hotcolormap, e = -1
87 case hsvcolormap, e = 15
88 case jetcolormap, e = -20
89 case oceancolormap, e = -1
90 case parulacolormap, e = -10,
91 case pinkcolormap, e = -1
92 case rainbowcolormap, e = 20
93 case springcolormap, e = -10
94 case summercolormap, e = -10
95 case wintercolormap, e = -20
96 else
97 if type(Colormap)<>13
98 msg = _("%s: Argument #%d: Function expected.\n")
99 error(msprintf(msg, "mapsound", 5))
100 end
101 msg = _("%s: Argument #%d: A colormap function expected.\n")
102 error(msprintf(msg, "mapsound", 5))
103 end
104 tmp = Colormap(100 - abs(e))
105 if e < 0 then
106 tmp = tmp($:-1:1,:)
107 e = abs(e)
108 end
109 if e then
110 tmp = [ones(e,3) - linspace(0, 1-1/e, e)'*([1 1 1] - tmp(1,:)); tmp]
111 end
112 // grid: color closest to grey50
113 [?,k] = gsort(sum((ones(tmp)*0.5 - tmp).^2,"c"),"g","i")
114 gridColor = k(find(k>e,1))
115 else
116 tmp = hotcolormap(118)($:-1:$*0.15,:);
117 gridColor = 43
118 end
119 gcf().color_map = tmp;
120 end
121
122 // Graphical preparation
123 ax = gca();
124 ax.tight_limits = "on";
125 ax.grid_position = "foreground"
126 xlabel(_("Time [s]"), "fontsize",2)
127 ylabel(_("Frequency [Hz]"), "fontsize",2)
128
129 // Display the map
130 //surf(dates, frequencies-(frequencies(2)-frequencies(1))/2, M)
131 surf(dates, frequencies, M)
132 ax.view = "2d";
133 gce().color_mode = -2
134 xgrid(gridColor)
135
136 colorbar
137 title(gce(), _("Amplitude"))
138 xlabel(msprintf("%d × %d",size(M)), "fontsize",2)
139 set("current_entity", ax.children)
140 sca(ax)
141
142 // Results
143 lhs = argn(1)
144 varargout = list()
145 if lhs > 0 then
146 varargout = list(dates)
147 end
148 if lhs > 1 then
149 varargout($+1) = frequencies
150 end
151 if lhs > 2 then
152 varargout($+1) = M
153 end
48endfunction 154endfunction
diff --git a/scilab/modules/sound/macros/wavread.sci b/scilab/modules/sound/macros/wavread.sci
index c69cb51..eadeae9 100644
--- a/scilab/modules/sound/macros/wavread.sci
+++ b/scilab/modules/sound/macros/wavread.sci
@@ -318,7 +318,7 @@ function Data = read_dat_pcm(fid, total_bytes , nChannels, nBitsPerSample, ext,
318 end 318 end
319 else 319 else
320 mclose(fid) 320 mclose(fid)
321 msg2 = gettext("Cannot read .wav file with more than 16 bits per sample.") 321 msg2 = gettext("Cannot read .wav file with more than 32 bits per sample.")
322 error(msprintf(gettext("%s: An error occurred: %s\n"), "read_dat_pcm", msg2)); 322 error(msprintf(gettext("%s: An error occurred: %s\n"), "read_dat_pcm", msg2));
323 end// select BytesPerSample 323 end// select BytesPerSample
324 324
diff --git a/scilab/modules/sound/tests/unit_tests/mapsound.tst b/scilab/modules/sound/tests/unit_tests/mapsound.tst
index 952246d..c4f3550 100644
--- a/scilab/modules/sound/tests/unit_tests/mapsound.tst
+++ b/scilab/modules/sound/tests/unit_tests/mapsound.tst
@@ -1,17 +1,103 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) ????-2008 - INRIA 2// Copyright (C) 2020 - Samuel GOUGEON
4// 3//
5// This file is distributed under the same license as the Scilab package. 4// This file is hereby licensed under the terms of the GNU GPL v2.0,
6// ============================================================================= 5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10// ============================================================================
7// 11//
8// <-- NO CHECK REF --> 12// <-- NO CHECK REF -->
13// <-- TEST WITH GRAPHIC -->
14//
15// Unitary test or mapsound()
16// ==========================
17
18fs = 22050;
19t = 0:1/fs:1*(1-%eps);
20y = 0.3 + [1.5*sin(2*%pi*800*t) sin(2*%pi*1200*t)];
21
22// All default arguments
23// ---------------------
24clf reset
25mapsound(y)
26ax = gca();
27assert_checkalmostequal(ax.x_ticks.locations, (0:0.2:1.8)', 2*%eps);
28assert_checkequal(ax.y_ticks.locations, (0:500:4000)');
29assert_checkequal(ax.children.type, "Fac3d");
30assert_checkequal(ax.grid_position, "foreground");
31
32smap = ax.children;
33assert_checkequal(smap.type, "Fac3d");
34assert_checkequal(smap.data_mapping, "scaled");
35assert_checkequal(smap.color_flag, 4);
36
37assert_checkequal(ax.x_label.text, _("Time [s]"));
38ref = linspace(0, 1.956989247, 92);
39assert_checkalmostequal(smap.data.x(1,1:92), ref);
40
41assert_checkequal(ax.y_label.text, _("Frequency [Hz]"));
42ref = linspace(0, 4326.265823, 94);
43assert_checkalmostequal(smap.data.y(1,1:92:$), ref);
44
45cb = gcf().children(1);
46assert_checkequal(cb.title.text, _("Amplitude"));
47assert_checkequal(cb.x_label.text, "95 × 93");
48assert_checkalmostequal(cb.y_ticks.locations, (0:0.2:1.4)', 2*%eps);
49assert_checkequal(size(gcf().color_map,1), 101);
50
51
52// Setting Dt
53// ----------
54Dt = 0.04;
55clf
56[t, f] = mapsound(y, Dt);
57assert_checkequal([t(2) f(2)], [Dt 25]);
58
59clf
60[t, f] = mapsound(y, -1/20);
61assert_checkequal([t(2) f(2)], [0.1 10]);
62
63
64// Setting displayed frequencies
65// -----------------------------
66clf
67[t, f] = mapsound(y, , 1300);
68assert_checkequal([t(2), f(1), f(2), f($)], [0.04 0 25 1300]);
69
70clf
71[t, f] = mapsound(y, , [500 1300]);
72assert_checkequal([t(2), f(1), f(2)-f(1), f($)], [0.04 500 25 1300]);
73
74[t, f] = mapsound(y, , -1/11);
75assert_checkequal([f(1), f(2), f($)], [0, 31.5, 1984.5]);
76assert_checkalmostequal(t(2), 0.031746032);
77
78clf
79[t, f] = mapsound(y, , [500 -1/11]);
80assert_checkequal([f(1), f(2)-f(1), f($)], [504, 31.5, 1984.5]);
81assert_checkalmostequal([t(2) t($)], [0.031746032 1.968253968]);
82
83clf
84[t, f] = mapsound(y, , [-1/110 -1/11]);
85assert_checkequal([f(1), f(2)-f(1), f($)], [220.5, 31.5, 1984.5]);
86assert_checkalmostequal([t(2) t($)], [0.031746032 1.968253968]);
87
88
89// With Colormap
90// -------------
91clf
92mapsound(y, 0.04, , , parulacolormap)
93ref = [1 1 1
94 0.99052 0.99324 0.62152
95 0.9763 0.9831 0.0538
96 0.2081 0.1663 0.5292];
97assert_checkequal(gcf().color_map([1 5 11 $],:), ref);
9 98
10// At first we create a time vector of 0.5 seconds sampled at 22050 Hz: 99msg = msprintf(_("%s: Argument #%d: A colormap function expected.\n"), "mapsound", 5);
11t = 0 : 1/22050 : 0.5*(1-%eps); 100assert_checkerror("mapsound(y, 0.04, , , members)", msg);
12 101
13// Then we generate the sound. 102msg = msprintf(_("%s: Argument #%d: Function expected.\n"), "mapsound", 5);
14s=sin(440*t)+sin(220*t)/2+sin(880*t)/2; 103assert_checkerror("mapsound(y, 0.04, , , sin)", msg);
15[nr,nc]=size(t);
16s(nc/2:nc)=sin(330*t(nc/2:nc));
17mapsound(s);