Closed dasantonym closed 9 years ago
no - i believe peer just wasn't sure how to do it.
I guess I didn`t find a easy way to do the db rms calculation with python libs. the [env~] Object does that and lets the user set windows sizes and so forth. Its not just a matter of taking several snapshots of the input level and calculating the average.
imho it was also a better idea to let a compiled dsp core do the real time stuff rather then an interpreted script.
nevertheless ther might be simpler ways
i thought so, too. but we are working with very little data here and the low level audio functions in python should be native bindings anyway.
did you check out the rms function of the audoop module? https://docs.python.org/3.4/library/audioop.html
if this is not sufficient for you then we might be better off with pd but it would be easier to maintain and much more stable like this (there are other native, more complex libs for python as well)
reading through the doc i remember why i went for PD, it`s simpler... audioop.rms(fragment, width) seems to do the job, PD is also using Hanning-windowing on the audio samples, i assume this only affects the frequency distribution or so... Using that lib would be a good idea.
added in complete rewrite https://github.com/denjello/pi-DJex/pull/10
there are multiple libs for python that can extract the volume and sound pressure level so using puredata for that seems overly complicated to me. was there another reason for pd that i just didn't get?