Hi!
I'm having problems with audio playback in octave, by using the player object.
I'm very new to Octave so probably I'm making mistakes somwhere but I wasn't able to understand where.
I'm using a very simple code to generate a cosine wave, then i use the player to hear it. The strange thing is that not all the frequency are played properly. I mean that if I try to play a wave at 100 Hz or 200 Hz all is fine (and so for other values of frequency). But if I try to play a 199 Hz wave, I get something distorted that sound about 40 Hz, and so happens for other frequencies. For another example, I'm not able to play 440 Hz. This should not be a problem of sampling because I'm using 8000 Hz sampling rate that should work for all frequencies up to 4 kHz.
I've also tried to plot the wave at 440 Hz and it seems to be correct, so I don't know where the problem is. I wonder if there is something wrong when i generate the wave or where I initialize the player object.
Net there is the code I'm using:
fs1 = 8000; % sampling rate
T = 3; % wave lenght in seconds
N = fs1.*T; % number of samples
fp = 440; % wave frequency
t = (0:(1/fs1):T).'; % time array from 0 to T sec, step 1/fs1
portante = 100*cos(2*pi*fp*t);
plot(portante);
player = audioplayer(portante, fs1);
play(player);
May I thank you in advance,
Best regards
Andrea Mariotti