octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Audio playback and classes


From: Vytautas Jancauskas
Subject: Re: Audio playback and classes
Date: Mon, 2 Sep 2013 17:17:17 +0300

> Hello,
>
> The problem doesn't come from aliasing, but from the signal reaching the max
> value (1). The following shows the problem :
>
> octave:1> fs = 44100;
> octave:2> t = 0:1/fs:1;
> octave:3> ycos = cos (2*pi*440*t);
> octave:4> ysin = sin (2*pi*440*t);
> octave:5> length (ycos (ycos == 1))
> ans =  21
> octave:6> length (ysin (ysin == 1))
> ans = 0
> octave:7> ycos(abs (ycos) == 1) *= (1-eps);
> octave:8> ap = audioplayer (ycos, fs);
> octave:9> play (ap) # Here the sound is clean
>
> There is no problem if I send the data in the form of uint8, even if the
> signal reaches the max value 255 :
>
> octave:10> ycos = uint8 ((cos (2*pi*440*t) + 1) / 2 * 2^8) ;
> octave:11> max (ycos)
> ans = 255
> octave:12> ap = audioplayer (ycos, fs);
> octave:13> play (ap) # Here the sound is also clean
>
> There may be a problem in the conversion from double to int value before
> passing data to the sound card ?
>
> Pantxo
>

The latest change should fix this problem.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]