bugGNU Octave - Bugs: bug #44305, audiorecorder (8000, 8, 1) returns...


bug #44305: audiorecorder (8000, 8, 1) returns corrupted audio stream

Submitted by:  Mike Miller <mtmiller>
Submitted on:  Thu 19 Feb 2015 08:17:32 AM UTC  
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 19 Jan 2019 04:16:42 AM UTC, comment #4:

There seems to be a bug in portaudio with 8-bit formats:


But in fact there is no reason to necessarily use the different formats that portaudio offers in Octave. They just specify the buffer format portaudio will output the data to, regardless of the hardware settings.It is doing soby scaling and casting if necessary- And as in Octave the data is always returned as floats, scaled to -1..1, 8 bits can be simulated by only using the upper 8 bit of int16 before scaling.

Lars Kindermann <larskindermann>
Mon 16 Oct 2017 01:37:16 PM UTC, comment #3:

Copying info posted to the mailing list by Thomas Dean:

I used the sources from octave-4.2.1.tar.gz.

This problem in in the callback function, portaudio_record_callback.
The same problem exists in the function octave_record_callback.

The variables used to convert from 24 bit to 32 bit are not zero'd
inside the loop. Therefore, bits in the high order byte remain,
corrupting the data. Fixing portaudio_record_callback fixes my problem,
but octave_record_callback should be corrected at the same time.

> diff libinterp/dldfcn/audiodevinfo.cc.orig
< for (int j = 0; j < 3; j++)
> // 20171013 tomdean
> sample_l32 = 0; sample_r32 = 0;
> for (int j = 0; j < 3; j++)
> // 20171013 tomdean
> sample_l32 = 0; sample_r32 = 0;

John W. Eaton <jwe>
Project Administrator
Fri 13 Oct 2017 08:20:48 PM UTC, comment #2:

I have a problem with 24-bit recording that may be related to this. The number of samples returned is correct, but, the data is corrupt.

The range of values returned is from slightly greater than zero to -2.
Left Right
max 9.9385e-04 6.3944e-04
min -2 -2

I have attached a script that demonstrated this with an ASUS Xonar U5.

16-bit sampling seems correct.

(file #42140)

Thomas Dean <tomdean>
Fri 23 Dec 2016 06:57:56 PM UTC, comment #1:

Is this behavior still present in Octave 4.2.0?

(Sorry, I don't know how to check this.)

Hartmut <hardy>
Thu 19 Feb 2015 08:17:32 AM UTC, original submission:

Recording 8-bit audio does not work, the audio signal returned is formatted incorrectly. The number of samples is correct, but the values are on the wrong scale or bit-shifted or corrupted in some way.

Octave's audiorecorder is attempting to record using portaudio's paInt8 format. No errors are reported, and the correct number of samples for the requested duration are returned.

I can get back to this eventually, but doubtful before the 4.0 release, so tracking this here so it's not forgotten.

Mike Miller <mtmiller>
Project Administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #42140:  xonar.m added by tomdean (900B - text/x-objcsrc)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by larskindermann (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by tomdean (Updated the item)
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by mtmiller (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-10-13 tomdean Attached File- => Added xonar.m, #42140

    Back to the top

    Powered by Savane 3.4