aboutsummaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2023-09-22Stream:evkey(): result stream will now contain the key id if the key is ↵Robin Haberkorn1-1/+1
pressed, as it was previously documented
2023-09-19added Stream:print() for tracking control values streamsRobin Haberkorn1-0/+19
2023-09-16evdev.lua: support more ABS_X constantsRobin Haberkorn1-1/+24
2023-09-16minor SubStream optimizationRobin Haberkorn1-9/+11
2023-09-15fixed SubStream of cached streamsRobin Haberkorn2-7/+11
* in particular: SndfileStream(...):sub(...) for multi-channel audio files. * The fix is more of a workaround just like the initial skipping of samples by sub() is a workaround. I couldn't yet think of a way how to seek in streams elegantly.
2023-09-15documentation updateRobin Haberkorn6-19/+34
2023-09-13added LDoc documentationRobin Haberkorn12-314/+1369
* 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.
2023-09-09Stream:jdump() prints less unrelated traces nowRobin Haberkorn1-2/+6
2023-09-09cache the value in simple value streamsRobin Haberkorn1-1/+3
* analyzing the bytecode via tostream(...):jdump() has shown that this might be more efficient
2023-09-05added README and TODORobin Haberkorn3-0/+105
2023-09-05sampleCache should be global so that the other Lua modules can access it ↵Robin Haberkorn1-1/+1
directly as well
2023-09-05replaced math.pow(x, y) with x^yRobin Haberkorn1-1/+1
2023-09-05moved common definitions into applause.hRobin Haberkorn3-27/+17
2023-09-05libsndfile related classes moved into sndfile-stream.luaRobin Haberkorn2-100/+101
2023-09-05factored out filters into filters.luaRobin Haberkorn2-371/+362
2023-09-05MIDI stuff has been moved into midi.luaRobin Haberkorn4-245/+248
* common definitions are now in midi.h
2023-09-05MIDIStream is now an ordinary class that caches internallyRobin Haberkorn1-21/+15
2023-09-05Added HID support via EvdevRobin Haberkorn7-8/+333
* This works for relative, absolute and keyboard devices * devices can be grabbed, so they do not interfere with the rest of the system
2017-10-21Fix crashes on terminationRobin Haberkorn1-2/+3
* some internal datastructures were freed, but Jack was not properly shut down. This resulted in occasional crashes on shutdown. * The (incomplete) cleanup code has been commented out, which should work for the time being. Of course, the program should clean up properly but this is tedious and the internal datastructures will change in the forseeable future.
2017-10-21added DelayXStream (work in progress)Robin Haberkorn1-1/+50
2017-01-26revised MIDI supportRobin Haberkorn2-277/+108
* introduced MIDIStream which provides a raw stream of MIDI messages (mangled into a single integer). * MIDIVelocityStream has been replaced by MIDIStream:mvelocity() * MIDICCStream has been replaced by MIDIStream:CC() * MIDIStreams can be directly passed to DSSIStreams
2017-01-26added DSSI supportRobin Haberkorn3-520/+849
* The LADSPA module has been extended to support DSSI plugins as well. If DSSI support is detected, the first input stream is considered a MIDI event stream. * The MIDI event handling must be updated to allow streams of MIDI messages for this to be useful. * ladspa.lua has been subsequently renamed to dssi.lua
2016-09-27fixed the minus, div, mod and pow operations for streamsRobin Haberkorn1-8/+27
* this has long been broken. ZipStream implicitly assumes an associative operation when "inlining" nested ZipStreams. Since the above mentions operations are not associative, the result was a faulty calculation. Example: s1 - (s2 - s3) was calculated like (s1 - s2) - s3. * For the time being, the inlining is avoided by using unique lambdas.
2016-09-27MIDI primitive optimizations and added ntof() and fton() shortcutsRobin Haberkorn1-11/+20
2016-09-26LADSPAStream: limited DSSI supportRobin Haberkorn1-8/+103
* only really useful for DSSI plugins that do not expose a LADSPA entry point and do not need MIDI NOTE commands (ie. effects). * full DSSI support might be added in a subclass that adds a MIDI command stream. Applause's MIDI handling could be extended to directly provide such streams (ie. by having a queue of these events and producing 0 if they are empty) with MIDICCStream and MIDIVelocityStream being refactored into pure Lua classes which extract the relevant information and cache the previous value.
2016-09-26LADSPAStream: fixed input port mappingRobin Haberkorn1-1/+4
* User-provided arguments should correspond to the n'th input port instead of the n'th overall port. This failed if output ports were mixed with input ports (or come first) in the list of ports that the LADSPA plugin defines.
2016-09-26LADSPAStream: limited support for multi-channel input streamsRobin Haberkorn1-0/+24
* When specified as part of a port-mapping array or list, they are automatically expanded. I.e. if `stream` is stereo, LADSPAStream(..., stream) is equivalent to LADSPAStream(..., stream:demux(1), stream:demux(2)) * This is often handy because stereo input ports are usually defined consecutively by LADSPA plugins.
2016-09-26LADSPAStream: Special optimization for constant input port mappingsRobin Haberkorn1-26/+52
* Constants were converted to infinite streams. This allows them to be handled specially. They are stored in their own input buffer now, initialized and connected once but need no ticking. * In contrast to the Applause primitives, this can be done centrally and for all possible LADSPA plugins. * This gives a speed increase of up to 20% if all input ports are mapped to constants (measured with the "sine" plugin).
2016-09-26added LADSPA plugin host (LADSPAStream and Stream:LADSPA())Robin Haberkorn2-1/+380
* E.g. LADSPAStream("sine", 880):play(). The sine plugin is currently twice as fast as the native Applause implementation even though a block size of 1 sample is used (ie. compared to Stream.SinOsc). * all LADSPA features should be supported * Takes arbitrary Streams as input and produces a normal Applause stream. * multi-channel output plugins supported * LADSPA port mapping is possible by array, by name and by argument list. * Even though LADSPAStream is not muxable (it is more like SndfileStream), every input stream or default value is currently converted to a Stream. This can be optimized by storing scalars in their own arrays. They don't have to be ticked.
2016-09-25build applause binary with debug informationRobin Haberkorn1-1/+1
it should have no runtime penalty and eases debugging core dumps
2016-09-25fixed HPF, BPF and BRF filters and allow the quality factor to be a streamRobin Haberkorn1-23/+17
* all of these filters were ticking the input stream twice, effectively resulting in the input signal to be pitched. * the quality factor should be allowed to be a stream since there is no technical reason against it.
2016-09-25added Stream:tonumber() and Stream:tostring() and simplified the __tostring ↵Robin Haberkorn1-7/+6
metamethod
2016-09-25changed semantics of ZipStream (ie. multiply, add operators): the left ↵Robin Haberkorn1-110/+149
stream determines the length * this makes them compatible with the scalar operations like Stream:mul(), Stream:add() etc when the right stream is a scalar turned into an infinite stream. * Consequently, both operations could be merged: Stream:mul() and the __mul operator are now synonymous. The methods are kept since they are sometimes handy to avoid braces when writing from left to right. Since the old way of mapping a stream for scalars is still a bit faster compared to using a ZipStream, this method is still applied for scalars as an optimization. Both the methods and the operators will now work with scalars and arbitrary streams, though. * This means that many primitives based on scalar operations previously will now work with streams as well. This applies to Stream:scale(), Stream:ccscale(), Stream:mix(), Stream:pan() and even line(). * Added Stream:min() and Stream:max() as shortcuts for binary operations from the math package. * All the binary operations from the math and bit packages will work with streams now as well (without performance penalties). * Stream:clip() has been revised and works with stream arguments now as well. * Optimized ConcatStream, MapStream, ScanStream, FoldStream and esp. ZipStream. * The new ZipStream semantics allow for new useful idioms. For instance, to add an envelope to an infinite stream (stream*env), a SubStream was often necessary to restrict the resulting stream to the length of the envelope as in (stream*env):sub(1,env:len()). This can now be written more elegantly as (env*stream). To extend a stream to infinite length, you may still write 0+stream or stream..0
2016-09-15fixed SawOsc and support a scalar phase argument for all oscillatorsRobin Haberkorn1-13/+17
* SawOsc has been broken for a long time * phases are useful since they are trivial to implement at the Phasor level and cumbersome to emulate using SubStream (basically you would need :sub(sec(1)/freq*phase)). Also, this way, phases will work even for modulated frequencies or if the frequency is unknown. They should come with no additional runtime overhead.
2016-09-15fixed multichannel SndfileStreams and :toplot()Robin Haberkorn1-9/+11
2016-09-05added Stream:pan(), fixed typo in MuxableStream and improved ↵Robin Haberkorn1-3/+28
InstrumentStream for finite on-streams
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 Haberkorn2-4/+23
channels and libsndfile format
2016-08-02options are now passed in POSIX style (ie. -o and -b)Robin Haberkorn1-7/+25
command line help is provided using -h or when specifying an unknown option
2016-07-18fixed Stream:resample()Robin Haberkorn1-1/+1
2016-07-04added ntom() and mton() for converting from note names to MIDI numbers and ↵Robin Haberkorn1-15/+53
vice versa * mton() can handle MIDINoteStream values just like mtof() * both are exposed as Stream methods as well (e.g. Stream:mton()) * MIDIVelocityStream accepts note names now as well in addition to MIDI note numbers * added scoping to the cache used by mtof()
2016-07-04fixup: InstrumentStreamRobin Haberkorn1-4/+19
2016-07-03simplified code: the Streams.streams array is no longer mandatoryRobin Haberkorn1-79/+70
* properly named attributes can be used instead of putting all stream arguments into a `streams` attribute. This is no longer necessary since there is no more Stream:reset() method.
2016-07-03renamed Stream:tick() to Stream:gtick()Robin Haberkorn1-58/+58
* this function is not the tick function itself but rather a generator (returning the tick function). * Calling these methods gtick() is less confusing but still concise.
2016-07-03added InstrumentStream (Stream:instrument)Robin Haberkorn1-0/+58
* allows a stream of note velocities to trigger a note-on and note-off stream. * usually used on a MIDIVelocityStream * allows a single note to be triggered including attack, sustain and decay phases * by letting the note-on and note-off streams depend on the note/velocity stream, the note can use the NOTE ON velocity. * The InstrumentStream constructor will also accept functions on the note_stream, so it is possible to define the note-on/off streams depending on the velocity stream on a single line of source code. * A NOTE OFF velocity is currently not used, though that could be achieved by letting MIDIVelocityStream generate negative numbers for NOTE OFF velocities. * This will only work with a single note (ie. a fixed frequency); when wanting to play polyphony, users will have to mix many different InstrumentStreams, e.g. iota(69, 79):map(function(note) return MIDIVelocityStream(note, 1):instrument(function(v) return InstOn(note, v) end, InstOff(note)) end):fold(function(x,y) return x+y end):ravel()
2016-06-05revised stream syncing: stream samples are cached nowRobin Haberkorn1-81/+65
* the syncing had some serious issues: It was not possible to repeat a synced stream since its tick() iterators were not independant. E.g. Foo = Bar:sync(); (Foo..Foo):play() would not have the expected result (Bar..Bar):play() * syncing required the Stream.reset() mechanism * instead of syncing, we now do caching (CachedStream) in a dedicated sampleCache table. Instead of alternating the clock signal, the cache is now simply table.clear()ed for each output sample. This results in some allocation overhead on the first sample since sampleCache will not yet have its final size. (Although this overhead could be avoided by counting the number of cached streams recursively and allocating sampleCache using table.new()) * SndfileStream suffered from similar problems, it could not be repeated because every object's tick() shared the same handle. Instead every tick() now opens its own handle. This means that using the same SndfileStream multiple times no longer requires explicit syncing/caching and SndfileStreams can be repeated. On the down-side we must check whether the file changed after the initial object construction.
2016-06-01added a few APLish unicode shortcuts for some of the primitives/Stream methodsRobin Haberkorn1-1/+7
* Unicode identifiers allowed in LuaJIT 2 * We add the shortcuts directly to applause.lua but using Unicode escapes. Thus we don't have to maintain a separate file and we can still edit applause.lua using a non-UTF editor like SciTECO * Stream:sub (subtract) renamed to Stream:minus. This was previously overwritten by the SubStream wrapper.
2016-06-01implemented delay lines and echo effectRobin Haberkorn1-0/+51
* DelayStream must currently have a constant length (ie. duration) * Stream:mix() allows mixing two streams by a constant wet/dryness factor. 0 means only the first stream, while 1 is only the second stream. * Stream:echo() builds on this for an echo effect with constant delay and wetness factor. The source stream is automatically synced.
2016-01-26allow client connections to be terminated prematurelyRobin Haberkorn2-11/+81
* use socat now for SciTECO integration. It correctly shuts down the connection when interrupted. This has the effect as cancelling the current command, just as ^C would on the Applause command line.
2016-01-25fixed command server: unterminated stringRobin Haberkorn1-1/+2