Message Boards Message Boards

Convert a list of local properties to a list of criteria in AudioIntervals?

Posted 8 years ago

The criteria function of the AudioIntervals only accepts #prop arguments. How can I convert a list of local properties to a list of criteria? I already have tried

prop={"RMSAmplitude" ,"Power", "Loudness"};
audio = ExampleData[{"Sound", "AltoFluteScale"}, "Audio"];
intervals = Table[AudioIntervals[audio, Slot[prop[[propId]]]< .01 &],{propId,1,3,1}];
POSTED BY: Luis Mendes
2 Replies
Posted 8 years ago

The solution from the Wolfram Premier Support:

a= ExampleData[{"Sound", "AltoFluteScale"}, "Audio"];
Function[prop, AudioIntervals[a, (Slot[prop] < .01) &]] /@ {"RMSAmplitude", "Power", "Loudness"}
POSTED BY: Luis Mendes

Hey Luis:

You basically have itÂ…

1) AudioInterval[] already dumps intervals without Table, so your construction will produce 3 sets of intervals.

2) I got it to look like you want (and produce output) by typing the command like this:

int2 = AudioIntervals[a, Slot[prop[[3]]] < 0.1 &] (* same as you had above *)

Then select the (entire) Slot[] invocation.

Use the menu item Evaluation>>Evaluate in Place. That produces this:

screen shot of tests

I have never understood how to use Front-End tokens, but you can probably use the Evaluate front-end token (i.e. ref/frontendobject/Evaluate) to automate this with Table[].

Attachments:
POSTED BY: Aeyoss Antelope
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract