<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hello Antoine,<br>
<br>
Le 24/04/2015 16:31, Antoine Monmayrant a écrit :<br>
</div>
<blockquote cite="mid:553A53AE.9070809@laas.fr" type="cite">Hi
everyone,
<br>
<br>
I'm trying to use Scilab to generate a soundwave with a given
frequency and output it continuously.
<br>
Basically, I'd like to get a simple "software-based" function
generator: a slider to set the frequency and the sound being
played continuously in the background.
<br>
Is this possible in Scilab?
<br>
I'm fine with the gui & callback part, but for sound output
'playsnd' and 'sound' do not seem to be able to loop over a given
sample without any gap.
<br>
<br>
Any suggestion or alternative software I could use?
<br>
</blockquote>
If you are successful in installing Python 2.7 and NumPy, you may
try using the PIMS module and execute the following code with
pyEvalStr(..):<br>
<pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><span style="color:rgb(0,0,0);">import</span> <span style="color:rgb(0,0,0);">audiere</span>
<span style="color:rgb(0,0,0);">d</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">audiere</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">open_device</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(0,0,0);">t</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">d</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">create_tone</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">17000</span><span style="color:rgb(74,85,219);">)</span> <span style="color:rgb(0,0,0);">#</span> <span style="color:rgb(188,143,143);">17</span> <span style="color:rgb(0,0,0);">KHz</span>
<span style="color:rgb(0,0,0);">t</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">play</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span> <span style="color:rgb(0,0,0);">#</span> <span style="color:rgb(0,0,0);">non</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(0,0,0);">blocking</span> <span style="color:rgb(50,185,185);">call</span>
<span style="color:rgb(0,0,0);">import</span> <span style="color:rgb(0,0,0);">time</span>
<span style="color:rgb(0,0,0);">time</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">sleep</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">5</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(0,0,0);">t</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">stop</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span></pre>
This Python's code is taken from <br>
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/974071/python-library-for-playing-fixed-frequency-sound#answers-header">http://stackoverflow.com/questions/974071/python-library-for-playing-fixed-frequency-sound#answers-header</a>
<br>
<br>
May i guess (i do not know Python's language) that the
time.sleep(..) instruction may be dropped in order to get a
continuous sound, lasting as long as t.stop() is not called. It can
be called only after other Scilab instructions and callbacks and so
on. <br>
For my part, i did not succeed in installing NumPy on my win7_x64
(The well installed Python 2.7 is not detected by NumPy installer).
PIMS is well loaded, but then i get an error when executing the
pyEvalStr() example. <br>
<br>
Have nice trials<br>
Regards<br>
Samuel<br>
<br>
</body>
</html>