Skip to content

Brian2Hears meeting notes

Victor Benichoux edited this page Jun 25, 2014 · 24 revisions

Brian2hears meeting 22/06/2014

Points to be adressed:

  1. Strategy for buffering/FIR filtering
  2. Scheduling/clocks
    • samplerates
    • relevant for control filterbank/feedback (mostly scheduling issues)
  3. Sounds
    • OnlineSounds idea
    • multichannel audio (i.e. multichannel TimedArray)
    • implement multiple backends for sound playing (get rid of pygame: portaudio?)
  4. Misc
    • ImpulseResponse and TransferFunction
    • the .process() method
  5. NotImplementedYet
    • FIR filtering with multiple IRs (be careful)

Buffering

In brian1hears, Filterbanks operate based on buffers. This means that the result of filtering is always "precomputed" for a given number of samples. This is desirable in FIR filtering, for which the most efficient computation methods are FFT-based and necessarily operate on buffers.

I can see two possible courses of action:

  • Get rid of buffering altogether

    This means relying on the current FIR filtering scheme (unefficient shift-register technique) everywhere. A plus side is that this requires no modification of B2, and currently works (incl. in standalone mode)

  • Implement buffering

    This means implementing some buffering mechanism. A plus side is that is could be used also in B2, for example in the context of StateMonitors wherein one may want to record a running average that could be computed online with FIR filtering (note that it can also be done with IIR filtering, which is more efficient)

If we choose to implement buffering, then we will need to work a bit to keep compatibility with brian2 standalone and weave. We at least need to provide an implementation of FIR filtering in each language. FFT implementations are easy to find in any language, but maybe operating on complex numbers from within b2 will be hard.

Scheduling/clock

For now all filterbank objects use the dt of the source to set their internal samplerate. This is also the case when the source is a TimedArray (and Marcel advised against doing this).

It may not be so hard to allow Filterbank objects to have a different dt than the other B2 objects. This could be useful for example when using filterbanks that have a fixed samplerate in their formulation (e.g. TanCarney), whilst still being able to freely set other B2 objects' dts.

Scheduling has to be taken care of, and I have not thought about it much. I think that in most instances it is straightforward, but may be more complex when dealing with control/feedback filterbanks. We could just always update filterbanks and _then_ control filterbank. How good of a control on this schedule do we need (Bertrand: any ideas?)?

Misc

  • Sound playing

I personally think that pygame is a pain in the a**e, so I think that it would make sense to get rid of it altogether. Other options are available for sound playing/recording on multiple platforms: JACK, portaudio. I think that portaudio would be better, yet it may also be more complicated to install on some platforms (which is also the case of pygame on e.g. OSX). Any thoughts?

  • Control filterbank and feedback

This is not hard to implement in brian2, but simply requires that we carefully think about scheduling, which hasn't been done yet.

Clone this wiki locally