Default sampling rate for sound(), soundsc() and Matlab compatibility

I happened to be reviewing sound and soundsc m-files and the default rate at which they send sound to an audio card is 8,192 Hz. The default in Octave is 8,000 Hz.

I assume 1) that Matlab used to be 8,000 Hz and 2) that we might as well transition to this new default.

Are there any objections?

This would be on the development branch and there would have to be a note in the NEWS file because existing invocations in the code will be shifted in pitch by a little over 2%.

Answering my own question, I don’t think it is worth following Matlab here. The audiorecorder object defaults to recording at 8000 Hz. If a programmer then extracts the audio data with getaudiodata and uses sound to play it there will be a pitch shift. It seems better to just use the same default for recording and for playback and let users change it if they want.

1 Like