<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hello Frederico,<br>
<br>
On Windows, you should open your file in binary mode, with "rb".<br>
--> fd = mopen("440Hz_0.2s.wav", "rb");<br>
--> h = mgeti(1000, "uc", fd);<br>
--> size(h)<br>
ans =<br>
1. 1000.<br>
<br>
--> dec2hex(h(1:5))<br>
ans =<br>
!52 49 46 46 84 !<br>
<br>
Regards,<br>
Antoine<br>
<div class="moz-cite-prefix">Le 30/01/2019 à 23:02, Federico Miyara
a écrit :<br>
</div>
<blockquote type="cite" cite="mid:5C521F0C.6090402@fceia.unr.edu.ar">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<br>
Dear all,<br>
<br>
I'm trying to read data from a file (in this case a wave file)
with the following code (Scilab 6.0.1)<br>
<pre style="font-family:Monospaced;font-style:normal;font-size:14.0;"><span style="color:rgb(0,0,0);">fid</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">mopen</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">g:\Mis documentos\Ondas\440Hz_0.2s.wav</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">r</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(50,185,185);">mseek</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">0</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">fid</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(0,0,0);">h</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">mgeti</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1000</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">uc</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">fid</span><span style="color:rgb(74,85,219);">)</span></pre>
I should get a vector with 1000 unsigned 1 byte integer components
but I end with only 164 entries. Viewing the file with an hex
viewer, the last correctly read data are<br>
<br>
34 3E 34 3E <br>
<br>
(decimal 52 62 52 62)<br>
<br>
Then the following data and further data<br>
<br>
1A 3D 1A 3DÂ ...<br>
<br>
are not read at all. No warning like having reached EOF. By the
way, the repeated pairs are because it is a stereo file with
identical left and right channels.<br>
<br>
The same happens changing the way the file data are to be decoded.
Seems to get stuck when 1A or 1A 3D appears.<br>
<br>
Any idea of what may be going on and how to solve it?<br>
<br>
Federico Miyara<br>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"> <br>
<br>
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1"
height="1" moz-do-not-send="true"> </a></div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>