Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic_reader: argument 'first' ignored when 'last' is specified #27

Open
VinodKandasamy opened this issue Nov 24, 2014 · 0 comments
Open

Comments

@VinodKandasamy
Copy link

File: scikits.audiolab.pysndfile.matapi.py
Function: basic_reader(filename, last = None, first = 0)
Outer Function: _reader_factory(name, filetype, descr)

When using functions like scikits.audiolab.wavread, the argument first is ignored, when last is specified.
wavread(filename, first=0, last=48) returns the first 48 frames (frame 0 through frame 47).
wavread(filename, first=48, last=96) returns the first 96 frames. It should return frames 48 through 95, instead.

Code snippet in scikits.audiolab (0.11.0) scikits.audiolab.pysndfile.matapi.basic_reader :

    if last is None:
        nframes = hdl.nframes - first
        data    = hdl.read_frames(nframes)
    else:
        data    = hdl.read_frames(last)

Proposed solution:

    if last is None:
        last = hdl.nframes
    data = hdl.read_frames(last-first) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant