Re: Requesting For Comments for a new simple-dsp library

Henning Thielemann <[email protected]>
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <[email protected]>
On Thu, 21 Mar 2024, Tristan Cacqueray wrote:

> I'd like to propose a new package named simple-dsp. I couldn't figure
> out how to use the existing dsp library, so I made my own version
> featuring a little GUI to try the code in realtime.
>
> I'd be happy to contribute this work directly to dsp.

The 'dsp' package is pretty old, predating any Vector data type or refined 
numeric type class hierarchies. I decided to leave it as it is, for 
educational reasons, since it contains many literal translations of signal 
processing algorithms from various text books. I have not used most of the 
contained functions myself.

> My goal is to be able to extract sensible discrete values from a sound 
> input at 60 Hz for video production. I implemented low/band/high pass 
> filters to compute 3 RMS volumes, but the values I'm getting are not 
> sharp enough, e.g. the band pass picks the low end. Ideally I would 
> extract the transient events of the percusive sound and the note pitch 
> of the melodic elements.

For a filter that computes lowpass, highpass and bandpass in one go, I use 
the "universal filter", also known as "state variable filter":
   https://hackage.haskell.org/package/synthesizer-core-0.8.3/docs/Synthesizer-Plain-Filter-Recursive-Universal.html

You can see running examples here:
   https://hackage.haskell.org/package/synthesizer-core-0.8.3/docs/src/Synthesizer.Plain.Filter.Recursive.Test.html#universalTest

Frequencies are specified as ratio with respect to the sampling rate, e.g. 
440 Hz resonance frequency at 44100 Hz sampling rate translates to 
440/44100. For working on storable vectors you would instead use 
Universal.causal and apply this to Data.StorableVector.Lazy. For very fast 
processing I have the synthesizer-llvm package, which however depends on 
the LLVM package in a compatible version. (LLVM-16 currently preferred.)


Unfortunately I do not understand your application well, thus I do not 
know whether the state variable filter is the right choice for your 
application.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.