WaveBeans / wavebeans

Audio Processing. On scale.
https://wavebeans.io
Apache License 2.0
24 stars 0 forks source link

Table Sink #37

Closed asubb closed 4 years ago

asubb commented 4 years ago

Implementation for https://github.com/WaveBeans/wavebeans/issues/35

Streaming data into a memory table and then reading specific time range as another stream:

Creating the sample stream:

440.sine().toTable("440sine")
//or define custom retention period, by default it is 1 day
440.sine().toTable("440sine", 60.s)

Querying the data:

val table = TableRegistry.instance().byName<Sample>("440sine")

// last period
table.last(5.s)

// or time range in seconds
table.timeRange(1.s, 3.s)

// or in milliseconds and nanoseconds
table.timeRange(1000.ms, 3e9.ns)

Time markers are measured from the beginning of the stream which is 0.s