denjello / pi-DJex

This is a project for creating visal feebdack when the DJ gets too loud.
GNU Affero General Public License v3.0
0 stars 2 forks source link

drop the puredata dependency #2

Closed dasantonym closed 9 years ago

dasantonym commented 9 years ago

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?

denjello commented 9 years ago

no - i believe peer just wasn't sure how to do it.

Peersen commented 9 years ago

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

dasantonym commented 9 years ago

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)

Peersen commented 9 years ago

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.

dasantonym commented 9 years ago

added in complete rewrite https://github.com/denjello/pi-DJex/pull/10