[Scilab-users] strange sounds repeated over and over in scilab 6.1.0

classic Classic list List threaded Threaded
5 messages Options
Perrichon Perrichon
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] strange sounds repeated over and over in scilab 6.1.0

 

Hello

 

Few years ago, I got routines producing sounds in threads

 

With Scilab 5.5.2, sounds are produced once.

 

With Scilab 6.1.0, sounds are repeated endlessly.

 

 

Best regards

 

W10 x64

 

function Sound1()

    // by Gary Scavone, McGill University, 2004

// Bell-like sound

    fs = 22050;

    T = 1/fs;

    dur = 4;

    t = 0:T:dur;

    T60 = 0.5;

    env = 0.95*exp(-t/T60);

    // FM parameters

    fc = 200;

    fm = 280;

    Imax = 10;

    I = Imax.*env;

    y = env.*sin(2*%pi*fc*t + I.*sin(2*%pi*fm*t));

               sound(y, fs);

 

endfunction

 

 

function Sound3()

    x=1e2:1e4; b=0.6; y=window('hm',length(x)).*sin(x.^b.*log(x)); sound(y,9944)

endfunction

 

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: strange sounds repeated over and over in scilab 6.1.0

Le 02/03/2020 à 14:52, Perrichon a écrit :

 

Hello

 

Few years ago, I got routines producing sounds in threads

 

With Scilab 5.5.2, sounds are produced once.

 

With Scilab 6.1.0, sounds are repeated endlessly.


No no, "only" 16 times :-)
You can stop it with playsnd([]) or CTRL+C.

I have proposed to remove sound(), that is a duplicate of playsnd() and brings nothing.
But finally this has not been done for 6.1.0.
playsnd() has been upgraded. In the change, its nbits argument has been removed.
But we have forgotten to update sound() calling playsnd().
So you hear the sound the default nbits=16 times.

You must directly use playsnd() instead.

Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Perrichon Perrichon
Reply | Threaded
Open this post in threaded view
|

Re: strange sounds repeated over and over in scilab 6.1.0

Ok but this is a strange way to handle backward compatibility

 

 

De : users <[hidden email]> De la part de Samuel Gougeon
Envoyé : lundi 2 mars 2020 16:15
À : [hidden email]
Objet : Re: [Scilab-users] strange sounds repeated over and over in scilab 6.1.0

 

Le 02/03/2020 à 14:52, Perrichon a écrit :

 

Hello

 

Few years ago, I got routines producing sounds in threads

 

With Scilab 5.5.2, sounds are produced once.

 

With Scilab 6.1.0, sounds are repeated endlessly.

 

No no, "only" 16 times :-)
You can stop it with playsnd([]) or CTRL+C.

I have proposed to remove sound(), that is a duplicate of playsnd() and brings nothing.
But finally this has not been done for 6.1.0.
playsnd() has been upgraded. In the change, its nbits argument has been removed.
But we have forgotten to update sound() calling playsnd().
So you hear the sound the default nbits=16 times.

You must directly use playsnd() instead.

Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: strange sounds repeated over and over in scilab 6.1.0

Le 02/03/2020 à 16:45, Perrichon a écrit :

Ok but this is a strange way to handle backward compatibility


I agree. This is why i asked for confirmation to a second reviewer before removing nbits,
when the first reviewer asked me to remove it.
nbits was never implemented (never actually used in the function), just present as a dead input.
But it was not disturbing.
Now, i guess that sometimes it's useful to clean the code. I think that the next input argument "aplay"
after nbits is (very) rarely used (it addresses "only" Linux and MacOS users (15%), and only if
its default value is not convenient (? 5% of 15% ?). Most often, only the first 2 arguments are used.




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
fmiyara fmiyara
Reply | Threaded
Open this post in threaded view
|

Re: strange sounds repeated over and over in scilab 6.1.0


Just a thought: nbits should never have been an input argument of a playback function, since the precision of the internal data is much higher than even 24 bit, the higher bit resolution usually found in audio playback systems (not to be confused with the internal representation of many digital signal processors; I mean D/A converters). By the way, 24 bit means 144 dB signal/noise ratio, much higher than currently attainable analog performance. 

The only situation where that could be of some interest would be to demonstrate in the classroom the effects of reducing the number of bits per sample. But as such case is very specific and quite rare, it would be better just to requantize de original signal getting entire control of the situation, being able to measure noise and /or distortion, plot the stair-like waveform and listen to the result.

Federico Miyara


On 02/03/2020 13:03, Samuel Gougeon wrote:
Le 02/03/2020 à 16:45, Perrichon a écrit :

Ok but this is a strange way to handle backward compatibility


I agree. This is why i asked for confirmation to a second reviewer before removing nbits,
when the first reviewer asked me to remove it.
nbits was never implemented (never actually used in the function), just present as a dead input.
But it was not disturbing.
Now, i guess that sometimes it's useful to clean the code. I think that the next input argument "aplay"
after nbits is (very) rarely used (it addresses "only" Linux and MacOS users (15%), and only if
its default value is not convenient (? 5% of 15% ?). Most often, only the first 2 arguments are used.




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users