TWOEARS / blackboard-system

Two!Ears Auditory Model - Blackboard system module
http://docs.twoears.eu/en/latest/blackboard/
GNU General Public License v2.0
3 stars 2 forks source link

Easier ways to request data by knowledge sources #3

Closed hagenw closed 8 years ago

hagenw commented 8 years ago

This was reported by @ningma97:

As we discussed, it'd be nice to have an easy means to request data of a certain length from the blackboard. Currently it's not straightforward to retrieve data from the end of the last processing block used by a KS but only since last triggering time. Therefore some data can be lost (as I just came to realise).

Suggestions:

Add a method such as "HasData(dataObject, duration_sec)" which returns true if there is enough data from the dataObject available from the end of the last processing block (used by the KS) rather than since last trigger time as currently implemented. This can be used in the CanExcute() method. Add a method "GetData(dataObject, duration_sec)" in order to retrieve data of duration_sec long from dataObject, again from the end of the last processing block used by the KS. When not enough data is available, this method should give some warning and only return the actual amount of data, rather than padding zeros at the beginning, i.e. padding can be done outside the method if necessary, but the user needs to know how much data is retrieved. This allows us to retrieve two half-second long blocks by a KS if we define a one-second long simulated signal, regardless the block size used by the binaural simulator (4096 samples at 44.1kHz).

I hope this is straightforward to implement, but it'd be really important.

hagenw commented 8 years ago

@ivo--t repsonded:

Hey @ningma97

please

then

and give feedback on whether you think this is what you needed, plus, while your at it, maybe do a short code changes review. When you confirm these changes, I'll merge into master.

hagenw commented 8 years ago

For an example of the problems related to the different block lengths, see also: https://dev.qu.tu-berlin.de/issues/2733.

ningma97 commented 8 years ago

Hi Ivo

I've tested the fix and it is working nicely. Could you please merge relevant branches into their masters, please?

Thanks for doing this. Ning

hagenw commented 8 years ago

@ivo--t : this is relatively simple in github, you just have to press the "Merge pull request" button and can delete the branch afterwards with another button.

The same can then be done for AFE, here: https://github.com/TWOEARS/auditory-front-end/pull/2

ningma97 commented 8 years ago

I just notice when I request multi-stream signals such as "time" signals, the newly created AuditoryFrontEndDepKS.getSignalBlock() produces an error. I added a not-so-elegant fix for now. Perhaps Ivo could have a look at this, please.