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

 
 

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

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

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 31 Dec 2019 06:22:08 PM UTC, comment #9: 

Instead of using division by 256 on integer data I changed the patch to use a right shift by 8 (>> 8) which should be faster, and is clearer that the code is trying to discard the lower 8 bits.  I also updated the FIXME notes and the changeset message and checked it in under Lars's credentials.  See https://hg.savannah.gnu.org/hgweb/octave/rev/65a54ab6ceaa.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Fri 13 Dec 2019 04:24:54 PM UTC, comment #8: 

Ok, this was due to sr #110158: All files attached to the bug or patch tracker of GNU Octave are lost

Here is the patch again.

(file #48055)

Lars Kindermann <larskindermann>
Tue 10 Dec 2019 12:50:36 PM UTC, comment #7: 

Hello, I'm a Savannah admin.  Your file from comment #6 was lost; could you re-attach it?

Ineiev <ineiev>
Sun 24 Nov 2019 12:13:33 PM UTC, comment #6: 

I have attached a patch here which provides just a workaround for the portaudio 8 bit bug. It does so by calling portaudio with 16 bit and rescaling the data to 8 bit resolution for Octave.

So bug #55530 can be fixed separately afterwards.

(file #47927)

Lars Kindermann <larskindermann>
Thu 24 Jan 2019 02:48:34 AM UTC, comment #5: 

I've submitted a patch to work around the portaudio problem in bug #55530

Lars Kindermann <larskindermann>
Sat 19 Jan 2019 04:16:42 AM UTC, comment #4: 

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

https://portaudio.music.columbia.narkive.com/McNZ8eJe/pauint8-and-paint8-always-get-zero-data-in-audio-input-callback-function

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
libinterp/dldfcn/audiodevinfo.cc
1347c1347,1349
<           for (int j = 0; j < 3; j++)
---
 >                 // 20171013 tomdean
 >                 sample_l32 = 0; sample_r32 = 0;
 >                 for (int j = 0; j < 3; j++)
1423a1426,1427
 >                 // 20171013 tomdean
 >                 sample_l32 = 0; sample_r32 = 0;


John W. Eaton <jwe>
Group 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>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #47927:  portaudio_8bit.cset added by larskindermann (5KiB - application/octet-stream)
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 rik5 (Posted a comment)
  • -email is unavailable- added by ineiev (Posted a comment)
  • -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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-12-31 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2019-12-13 larskindermann Attached File- Added Audiorecorder_8Bit.patch, #48055
    2019-11-24 larskindermann Attached File- Added portaudio_8bit.cset, #47927
    2019-02-18 mtmiller Carbon-CopyRemoved 80942 -
    2017-10-13 tomdean Attached File- Added xonar.m, #42140

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code