[Haskell-cafe] Sample rate inference

Henning Thielemann iakd0 at clusterf.urz.uni-halle.de
Thu Nov 11 08:16:10 EST 2004

On Thu, 11 Nov 2004, Glynn Clements wrote:

> >  The computation sample rate should be propagated through the network as
> > follows:
> >   If in a component of equal sample rate some processors have the same
> > fixed sample rate, all uncertain processors must adapt that. 
> >   If some processors have different fixed sample rates this is an error. 
> >   If no processor has a fixed sample rate, the user must provide one
> > manually.
> >  To me this looks very similar to type inference. Is there some mechanism
> > in Haskell which supports this programming structure? 
> If you define a class for sample rates, and an instance for each
> possible sample rate, then you could use type inference,

Interesting approach, though it's not good idea to restrict to some sample
rates. It's also not necessary to do the inference at compile time. 

> I doubt that this specific example wouldn't work in practice (the type
> inference would probably give the compiler a heart attack), but you
> could presumably construct an equivalent mechanism using base-N
> numerals.


How can one implement a sample rate inference that work at run-time for
arbitrary rates? This will be the only way if one works with sampled
sounds read from a file. 

More information about the Haskell-Cafe mailing list