First, thanks for everyone who has helped me out so far - my project (rather general voting based on xylophone notes) is going very well and I have it processing in real-time which note has been hit.
I'd like, however, to have PD record something like 5 seconds of audio and then analyze *that* for the max frequency. I envision the operator initiating a bang, PD automatically recording about 5 seconds of audio, (either to a file or to it's own array; I don't need to keep the recorded audio after it's analyzed), and filtering out a couple frequencies I'm interested in (using [bp~]?), and letting me know which frequency was louder. That is, the initial inlet would be a bang, and the final outlet would be a number (giving 1 or 2, for example) which I'm doing right now using [expr].
So I guess I have two separate questions. First, how can I get PD to record a set amount of audio, either to a file or to an array (if anyone can let me know which would be preferable and why I'd love to hear your advice).
Second, how to perform analysis on a wav file or a stored array.
I'm unsure how to do this and would appreciate any help. I've figure out, using [del] how to send delayed bangs but have been confused trying to work my way through [readsf~] [writesf~] and [soundfiller], which seemed like my best bets.
Any help would be appreciated. Thanks! -Jared
Jared wrote:
So I guess I have two separate questions. First, how can I get PD to record a set amount of audio, either to a file or to an array (if anyone can let me know which would be preferable and why I'd love to hear your advice).
[tabwrite~]
Second, how to perform analysis on a wav file or a stored array.
[tabread], [tabread4]
2 remarks: i propose to use tables because you are talking about short samples, so there is no need to put them on hard disk (which is slow and therefore only good if you need your RAM elsewhere)
[tabread] is just for starters, when you know what you are doing; while you can basically do "everything" with it, it might be uncomfortable. (but otoh it is plain pd) more advanced table analysis tools are in the vbap and the iem_tab libraries.
but imo, you really should go and try to do it with [tabread], if only for the sake of portability and learning.
fmga. IOhannes