Sound function doesn't work

Hi everyone,
I’m in the process of learning Octave and one of my tasks is to output an audio signal. Before that I wrote a function and this should then emit a sound. But when I use the sound function, I get the following error message:

error: audioplayer: NBITS must be 8, 16, or 24
error: called from
audioplayer at line 112 column 19
sound at line 64 column 8

this is the function in the edit window:

function x = MySinus(Nsamp);


Fs = 8000;      
Ts=1/Fs;        

t = [0:Ts:Ts*(Nsamp-1)];

n = [1:Nsamp]; 
f1 = 500; f2 = 1250; f3 = 2000; 
x1 = 0.5 * sin(2*pi*f1*t);  
x2 = 0.25 * sin(2*pi*f2*t); 
x3 = 0.25 * sin(2*pi*f3*t); 
x = x1 + x2 + x3; 
plot(t,x);  
end;

Command window:

y = MySinus(8000);
sound(y);

Maybe someone has an example that works on a Mac.

My system

  • OS: macOS Big Sur Version 11.1
  • Octave version: Version 6.0.90

Version 6.0.90 is a release candidate, rather than a true release of Octave. Please upgrade to the 6.1.0 release and see if that solves the issue.

Sorry but I can’t find the 6.1.0 Version on the wiki page. Could you give me a direct link to download it?

The macOS installer bundles have no yet been updated by @apjanke . You can install the released Octave version from Homebrew for example Octave for macOS - Octave.