aboutsummaryrefslogtreecommitdiffhomepage
path: root/sndfile.lua
AgeCommit message (Collapse)AuthorFilesLines
2023-09-13added LDoc documentationRobin Haberkorn1-0/+4
* gives a useful overview of everything supported right now * especially the type documentation is useful, as these things are not self-evident in Lua (because of dynamic typing). * The LDoc page can later be published as the Github pages of the project. This can even be done automatically by a Github action. However, we should first make sure that it's okay to publish the project before defending the thesis since Github pages will always be public even for private repositories. * Documentation of command-line parameters is lacking (TODO). * It may be possible to use types like "Stream(number)" to describe streams of numbers. The LDoc documentation mentions boxed types. Perhaps there can even be Streamable(number)? * We are also lacking good example programs and/or introductory material.
2016-09-03fixed garbage collection of libsndfile handlesRobin Haberkorn1-9/+6
* an explicit FFI finalizer must be used. * fixes "Too many open files" errors
2016-09-03SndfileStream() supports raw files now, by passing through samplerate, ↵Robin Haberkorn1-1/+3
channels and libsndfile format
2016-01-25multi-channel stream supportRobin Haberkorn1-3/+14
* This is implemented without introducing the notion of frames into the tick() methods since most multi-channel stream operations can be understood as duplicating the operation on each channel. * Instead there is only ONE explicitly multi-channel stream: MuxStream. It can be used to construct a multi-channel stream from various normal mono streams and is also used internally. * MuxStreams can still be used just like any other stream since the new base class MuxableStream will automatically apply the class constructors on each channel in order. The channels of streams being combined must be equal, unless mono streams are involved. * Mono-streams are automatically blown-up to multi-channel streams when involved in operations with a multi-channel stream. * The remaining multi-channel specific code has been isolated in Stream:foreach() which now receives frames instead of individual samples. * When playing() a multi-channel stream, the applause output ports are played in order. I.e. playing a mono-stream fills output_1. A stereo stream, output_1 and output_2. * The number of Jack output ports can be specified on the applause command line. * All system playback ports are tried to be connected to corresponding applause output ports.
2016-01-03SyncedStream optimization: Allow streams to be reused within one stream ↵Robin Haberkorn1-0/+15
graph without recomputation * Since it comes with an overhead, it has to be enabled by constructing a SyncedStream or calling Stream:sync() * Reusing samples works by sharing generator functions and caching samples until a clock signal changes. The clock signal is currently a global variable "clock_signal" that oscillates between true and false. * This means that all sample generating methods like :play() or :totable() will have to advance the clock using the global clockCycle() function. It is a global function, so it can be invoked more or less efficiently by the :play() implementation (currently using the old-school Lua/C API). These restrictions might fall when using the LuaJIT way of interacting with native code. * Since playback must begin from the beginning for every :play(), an explicit reset() mechanism has been introduced which can usually be ignored in Stream implementations. It does however allow SyncedStream to reset the generator closure. * SndfileStream has been simplified since now it is possible to keep the file handle open. However as long as Stream synchronization is not automatic, SndfileStreams must be explicitly synced when using one stream multiple times. * Syncing is thought to be performed automatically by an optimizer when one object is used more than once e.g. in a :play() call. * Non-synced streams are currently slightly slower than before this commit, probably because of the additional clockCycle() call.
2015-04-30added Stream.save() and SndfileStream based on FFI wrapper around libsndfileRobin Haberkorn1-0/+197