bugGNU Octave - Bugs: bug #50315, audioplayer.play stops playback...

 
 

bug #50315: audioplayer.play stops playback before end of input array

Submitter:  Georg Wiora <gwiora>
Submitted:  Wed 15 Feb 2017 03:03:02 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Confirmed Assigned to:  None
Originator Name:  gwiora Open/Closed:  * Open
Release:  * 4.2.0 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 08 Nov 2021 09:33:21 AM UTC, comment #3: 

This still seems to be a problem in octave 6.3.0. Any plans to remove it?

Georg Wiora <gwiora>
Wed 15 Feb 2017 10:02:52 PM UTC, comment #2: 

I can confirm something similar on Debian. Using your examples of tones at a sample rate of 8 kHz, the second tone is not played at all if it is about 150 ms or less in duration.

Since sound() is just a wrapper around the audioplayer class, here is an example that shows the same behavior for me using audioplayer.play directly:


fs = 8000;
y = [cos(2 * pi * 440 * (0:0.2 * fs) / fs), cos(2 * pi * 880 * (0:0.125 * fs) / fs)];
p = audioplayer (y, fs, 8);
play (p)


The truncation may be in the way Octave is feeding data to portaudio or it may be in the portaudio library or in a lower layer. It should be possible to debug the portaudio interaction in audiodevinfo.cc to see what conditions cause the audio stream to stop, and whether Octave needs to make an additional call to flush remaining data for example.

Mike Miller <mtmiller>
Group Member
Wed 15 Feb 2017 03:04:58 PM UTC, comment #1: 

P.S.: If you think it is worth to include you may add the beepcode() function to future releases of octave.

Georg Wiora <gwiora>
Wed 15 Feb 2017 03:03:02 PM UTC, original submission:  

The sound function seems to stop the sound playback too early. This shows up espacially with short sounds below one second. I guess that the sound length is shortened by around 200 milliseconds.

Attached there is a small function for creating configurable beep patterns. It is suitable for testing this behavior. See inline documentation for usage.

The following call should play two short beeps a lower and a higher one. The second beep in the example is not played on my windows system:

beepcode([700,100;1400,200])

When adding a time of silence to the end of the beep sequence the second beep is played depending on the length of silence:

beepcode([700,100;1400,200;0,50])
beepcode([700,100;1400,200;0,100])
beepcode([700,100;1400,200;0,150])
beepcode([700,100;1400,200;0,200])
beepcode([700,100;1400,200;0,300])


Georg Wiora <gwiora>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #39761:  beepcode.m added by gwiora (1KiB - application/octet-stream - Sample function to play beeps.)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by gwiora (Submitted the item)
  •  

    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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-09-13 mtmiller Dependencies- bugs #54660 is dependent
    2017-02-15 mtmiller StatusNone Confirmed
        Summarysound() function stops playback too early audioplayer.play stops playback before end of input array
    2017-02-15 gwiora Attached File- Added beepcode.m, #39761

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code