octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #64379] audioplayer creation fails


From: John Donoghue
Subject: [Octave-bug-tracker] [bug #64379] audioplayer creation fails
Date: Mon, 3 Jul 2023 15:25:10 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?64379>

                 Summary: audioplayer creation fails 
                   Group: GNU Octave
               Submitter: lostbard
               Submitted: Mon 03 Jul 2023 07:25:08 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error or Warning
                  Status: None
             Assigned to: None
         Originator Name: lotsbard
        Originator Email: 
             Open/Closed: Open
                 Release: stable
         Discussion Lock: Any
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Mon 03 Jul 2023 07:25:08 PM UTC By: John Donoghue <lostbard>
Documenttation for audioplayer allows for creation of a audioplayer object
using the audiorecorder class however there are two failures.

The first, is that calling audioplayer with the recorder returns a usage
rather than the audio player. 


> a = audiorecorder;
2> p = audioplayer(a)
error: Invalid call to audioplayer.  Correct usage is:

 -- PLAYER = audioplayer (Y, FS)
 -- PLAYER = audioplayer (Y, FS, NBITS)
 -- PLAYER = audioplayer (Y, FS, NBITS, ID)
 -- PLAYER = audioplayer (RECORDER)
 -- PLAYER = audioplayer (RECORDER, ID)

3> 


The issue is that the check for valid arguments does not check if the inputs
is a audiorecorder just if its a function handle or char.


  if (nargin < 1 || nargin > 4
      || (nargin < 2 && ! (is_function_handle (varargin{1})
                           || ischar (varargin{1}))))
    print_usage ();
  endif


It should be something like:


  if (nargin < 1 || nargin > 4
      || (nargin < 2 && ! (is_function_handle (varargin{1})
                           || ischar (varargin{1})
                           || isa (varargin{1}, "audiorecorder"))))
    print_usage ();
  endif


The second issue may also occur in matlab ?
When getplayer that is called in audioplayer constructor (or when called
independtanly)


octave:3> a = audiorecorder;
octave:4> p = getplayer(a)
error: index (1,_): out of bound 0 (dimensions are 0x1)
error: called from
    audioplayer at line 145 column 19
    getplayer at line 36 column 10
octave:5> 


The getplayer function calls audioplayer with the audiodata of the recorder
object and samplerate and bits per sample:


  data = getaudiodata (recorder);
  player = audioplayer (data,
                        get (recorder, "SampleRate"),
                        get (recorder, "BitsPerSample"));


According to the documentation data should not be empty, and the documentation
also says getplayer returns a audioplayer object populated with the data from
the recorder - so the error may also occur in matlab?










    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64379>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]