Hello list,
I'm feeling a little bit odd with my question because it may look kind of like I'm tool lazy to try for myself. But I will have a free (= patching) day tomorrow at my studio where I don't have internet and email access; so I would like to have some ideas that presumably will work before I go there.
I have to find the exact positions of audio events in an array. Or more concrete: I will record sounds - a number of single, discrete sounds produced on (or in) a piano - into an array. I need a way to analyze this array to store the positions of the individual attacks to play them back in arbitrary order afterwards.
BTW: what is the best solution to measure the time between two bangs in samples (i.e. the number of samples recorded into an array (when the recording is started and stopped manually))?
I would be thankful for any helping ideas.
Best Urs
[bonk~] detects sudden changes in frequency or amplitude or both...not sure,. but it is pretty good at finding beats and sounds
if you have silence between your sounds, then you can use [env~] to get the amplitude, and just set it to bang when it goes above a threshold
both of these solutions require that you playback your audio at least once to find the points where it is triggering sounds.
then, you just attach a [timer] object to record how long each bang takes since the original bang, which you will trigger at the same time as starting to play the file.
if your file is huge, and you don't have time to play it through once to find the sounds, then you can use tabread4~ to play it much faster than the original speed, and still hopefully be able to detect the points where the sound increases.
i would store the info from [timer] into an array, and then later you can just use [tabread] to trigger your sounds.
good luck.
BTW: what is the best solution to measure the time between two bangs in
samples (i.e. the number of samples recorded into an array (when the recording is started and stopped manually))?<<
use [timer] to get the time, and then just multiply that by your sample rate.
ie, if you have a sample at 44100hz, and you get a bang at 500ms and 4000ms
then you go: 4000 - 500 = 3500ms = 3.5 sec
3.5sec * 44100 hz = 154350 samples
(i think sometimes the bit rate might come into play, but a simple multiplication or division by 2, 4, 8 etc will sort that out.)
But this gives me an accuracy of about 44.1 samples, isn't it? Well, generally this should be good enough, but is there no solution to measure the time with (1) sample accuracy?
Urs
hard off schrieb:
BTW: what is the best solution to measure the time between two bangs in
samples (i.e. the number of samples recorded into an array (when the recording is started and stopped manually))?<<
use [timer] to get the time, and then just multiply that by your sample rate.
ie, if you have a sample at 44100hz, and you get a bang at 500ms and 4000ms
then you go: 4000 - 500 = 3500ms = 3.5 sec
3.5sec * 44100 hz = 154350 samples
(i think sometimes the bit rate might come into play, but a simple multiplication or division by 2, 4, 8 etc will sort that out.)
Urs Liska wrote:
But this gives me an accuracy of about 44.1 samples, isn't it?
no, it is 64 samples
Well, generally this should be good enough, but is there no solution to measure the time with (1) sample accuracy?
no. as soon as you are in message-domain everything is quantized to 64 samples (which is the default blocksize of the signal-vectors)
there are some libraries (like iem_t3_lib) that provide special objects to have (timestamped) messages with sample accuracy, but in general you are bound to that limit.
mfg.asd.r IOhannes
hi IOhannes,
IOhannes m zmoelnig wrote: ...
as soon as you are in message-domain everything is quantized to 64 samples (which is the default blocksize of the signal-vectors)
except that there is a subsample-accurate notion of "now". When a clock-delayed message is served, the "now" is set to the exact time stamp assigned to a clock-serving method in the clock queue.
Thus, time is not quantized for messages triggered by clocks, i.e. initiated by metro, delay, qlist, etc., although it is for ui-triggered messages. It is up to tilde objects to do some extra work and respect the "now".
Krzysztof
Hallo, Krzysztof Czaja hat gesagt: // Krzysztof Czaja wrote:
except that there is a subsample-accurate notion of "now". When a clock-delayed message is served, the "now" is set to the exact time stamp assigned to a clock-serving method in the clock queue.
Thus, time is not quantized for messages triggered by clocks, i.e. initiated by metro, delay, qlist, etc., although it is for ui-triggered messages. It is up to tilde objects to do some extra work and respect the "now".
Thank you, this also answers my question in the vline~ vs. line~ thread.
Frank Barknecht _ ______footils.org_ __goto10.org__
a REALLY easy way though, assuming you will use adc~ to record....
use makefilename and a counter so that you will make filenames like 1-piano.wav 2-piano.wav etc...
and then add [env~] after [adc~]
if [env~] goes above the threshold level of your room noise, then trigger a bang to the counter to make your filename, and then trigger a bang to open the file, and then finally trigger a bang to [writesf~] (or whatever object you prefer to use to record)
when env~ returns below the threshold, you wanna trigger a close to your write object.
eventually you get a whole bunch of files 0-piano.wav, 1-piano.wav, 2-piano.wav..etc
much more user friendly!
Thanks for another good idea. I thought of somehow distributing the sounds to different arrays, but didn't think of your solution.
I will try to make this work. Probably I'll record to the array nevertheless, because I want also to be able to play back the whole recording with all features of tabread-ing (like forward/backward, any time manipulation...)
Thanks Urs
hard off schrieb:
a REALLY easy way though, assuming you will use adc~ to record....
use makefilename and a counter so that you will make filenames like 1-piano.wav 2-piano.wav etc...
and then add [env~] after [adc~]
if [env~] goes above the threshold level of your room noise, then trigger a bang to the counter to make your filename, and then trigger a bang to open the file, and then finally trigger a bang to [writesf~] (or whatever object you prefer to use to record)
when env~ returns below the threshold, you wanna trigger a close to your write object.
eventually you get a whole bunch of files 0-piano.wav, 1-piano.wav, 2-piano.wav..etc
much more user friendly!
SORRY!!!!
keep remembering things:
here's how to trigger your write on/off 's
[env~] | [moses 0.1] <---add your threshold here | [change] | [sel 0 1]
etc
hard off schrieb:
[bonk~] detects sudden changes in frequency or amplitude or both...not sure,. but it is pretty good at finding beats and sounds
if you have silence between your sounds, then you can use [env~] to get the amplitude, and just set it to bang when it goes above a threshold
both of these solutions require that you playback your audio at least once to find the points where it is triggering sounds.
OK, I'll try these (I'd thought of them already, but as I mentioned, I'd like to have some hints before I go to the studio).
then, you just attach a [timer] object to record how long each bang takes since the original bang, which you will trigger at the same time as starting to play the file.
if your file is huge, and you don't have time to play it through once to find the sounds, then you can use tabread4~ to play it much faster than the original speed, and still hopefully be able to detect the points where the sound increases.
I didn't know that, nice to know. Am I right that you mean driving the tabread4~ with a phasor~ that rises faster than 44100/sec? OTOH: I can play back while still recording, isn't it? Then I'd have just a small amount of latency.
i would store the info from [timer] into an array, and then later you can just use [tabread] to trigger your sounds.
good luck.
Thanks (for the wish and the ideas) Urs
hi urs,
i personally recommend the use of 'vasp' for analysis of arrays and manipulation of arrays. there should be enough tips in its documentation to get you started. if you are after a real time approach there is always bonk~ and fiddle~ that ship with pd (in the extras folder).
vasp = http://grrrr.org/ext or you can also find it in the externals cvs..
i'm not sure what you mean by the 'measure the time between bangs' but you may want [timer] which is part of pd..
hope this helps..
dmotd
Urs Liska wrote:
Hello list,
I'm feeling a little bit odd with my question because it may look kind of like I'm tool lazy to try for myself. But I will have a free (= patching) day tomorrow at my studio where I don't have internet and email access; so I would like to have some ideas that presumably will work before I go there.
I have to find the exact positions of audio events in an array. Or more concrete: I will record sounds - a number of single, discrete sounds produced on (or in) a piano - into an array. I need a way to analyze this array to store the positions of the individual attacks to play them back in arbitrary order afterwards.
BTW: what is the best solution to measure the time between two bangs in samples (i.e. the number of samples recorded into an array (when the recording is started and stopped manually))?
I would be thankful for any helping ideas.
Best Urs
-- Urs Liska Glümerstr. 5 D-79102 Freiburg
www.graft-music.com www.suonomobile.de
[Pd 0.39.0, WinXP]
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
dmotd schrieb:
hi urs,
i personally recommend the use of 'vasp' for analysis of arrays and manipulation of arrays. there should be enough tips in its documentation to get you started. if you are after a real time approach there is always bonk~ and fiddle~ that ship with pd (in the extras folder).
vasp = http://grrrr.org/ext or you can also find it in the externals cvs..
Thank you for the tip. I'll download it and take it with me to have a look.
i'm not sure what you mean by the 'measure the time between bangs' but you may want [timer] which is part of pd..
Maybe, maybe not (see my answer to hard off)
Urs
hope this helps..
dmotd