Ticket #67 (new enhancement)

Opened 3 months ago

feature request: convenience function for writing files in the same format as other files.

Reported by: alsuren Assigned to: cdavid
Priority: minor Milestone:
Component: audiolab Version:
Keywords: convenience function, writer_like() Cc:

Description

I would like to propose a convenience function, which will create an empty sndfile for writing, with the filename specified explicitely, and all other properties copied from another file.

An example use would look like this:

input = audiolab.sndfile(input_filename, 'read') data = a.read_frames(1e4) audiolab.wavwrite(data, output_filename, like=input_filename)

or like this: input = audiolab.sndfile(input_filename, 'read') data = a.read_frames(1e4) output = audiolab.sndfile(output_filename, 'write', like=input) output.write_frames(data)

The idea of this is a bit like the ones_like(matrix) function in scipy, and would simplify the process of writing files.

I'm using your library in my own project, so I will probably implement this functionality in a wrapper module in my program.

David Laban.