[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Understanding SCMIR





//note, uses local normalization per file, not global. You'll find a bigger example in the SCMIRAudioFile help file which first runs global normalisation checks, then does the feature extraction with that global normalisation.
(
{

~indices = [
"/data/audio/mirdata/EMcorpus/electro/19.wav",
"/data/audio/mirdata/EMcorpus/electro/Axel F.wav",
"/data/audio/mirdata/EMcorpus/electro/Bassline (Stretched)1986.wav",
"/data/audio/mirdata/EMcorpus/electro/Beat Box.wav",
"/data/audio/mirdata/EMcorpus/electro/Clear.wav",
"/data/audio/mirdata/EMcorpus/electro/Close (To The Edit).wav",
"/data/audio/mirdata/EMcorpus/electro/Cosmic Cars.wav",
"/data/audio/mirdata/EMcorpus/electro/Let The Music Play.wav",
"/data/audio/mirdata/EMcorpus/electro/Pack Jam (12_ Remix).wav",
"/data/audio/mirdata/EMcorpus/electro/Planet Rock.wav"
].collect {|path|

//Tartini defaults to one output, pitch in MIDI note values
a = SCMIRAudioFile(path,[\Tartini]);

a.extractFeatures(true);

b = List[];

a.featuredata.do{|val,index| if((val>=0.4) && (val<=0.44),{b.add(SCMIR.frameTime(index))}) };

b
}

}.fork;

)


~indices.postcs

[ List[ 117.74839002268, 121.57968253968, 129.33514739229 ], List[ 6.0139682539683, 6.6409070294785, 6.664126984127, 6.6873469387755, 13.212154195011, 14.048072562358, 14.164172335601, 14.187392290249, 14.81433106576, 14.837551020408, 14.860770975057, 14.883990929705, 14.907210884354, 59.07156462585, 92.276099773243, 100.44952380952, 158.3833106576, 165.92979591837, 168.50721088435, 168.530430839, 168.55365079365, 168.5768707483, 168.60009070295, 168.6233106576, 176.70385487528 ], List[  ], List[ 10.100680272109, 11.215238095238, 12.306575963719, 12.329795918367, 12.353015873016, 44.721632653061, 45.83619047619, 93.7389569161, 102.58575963719, 102.60897959184, 111.38612244898, 113.66167800454, 130.8212244898, 130.84444444444, 253.58512471655, 257.99691609977, 258.02013605442, 262.43192743764, 264.6610430839, 266.86693877551, 271.27873015873, 271.30195011338, 273.50784580499, 275.73696145125, 280.14875283447, 282.65650793651, 284.58376417234 ], List[ 3.8545124716553, 3.8777324263039, 82.895238095238, 82.918458049887, 92.229659863946, 105.88299319728, 125.06267573696, 127.91873015873, 149.95446712018, 153.78575963719, 175.82149659864, 175.84471655329, 190.19464852608, 191.03056689342, 197.85723356009, 197.88045351474, 198.69315192744, 199.41297052154, 201.6885260771, 201.71174603175, 239.76925170068, 244.32036281179, 245.76, 271.65024943311, 283.07446712018 ], List[ 4.852970521542 ], List[  ], List[ 9.1951020408163, 12.097596371882, 12.120816326531, 14.535691609977, 16.161088435374, 17.089886621315, 20.224580498866, 22.221496598639, 22.291156462585, 27.678185941043, 27.701405895692, 27.72462585034, 32.461496598639, 32.484716553288, 34.411972789116, 34.435192743764, 37.059047619048, 44.071473922902, 44.094693877551, 50.758820861678, 51.107120181406, 51.803718820862, 60.116462585034, 63.0189569161, 73.142857142857, 77.810068027211, 78.437006802721, 79.621224489796, 79.644444444444, 79.667664399093, 79.690884353741, 79.71410430839, 88.862766439909, 93.088798185941, 93.11201814059, 97.593469387755, 98.197188208617, 100.58884353741, 104.39691609977, 109.55174603175, 112.15238095238, 122.76390022676, 125.96825396825, 125.9914739229, 126.01469387755, 126.17723356009, 126.82739229025, 136.53333333333, 136.55655328798, 141.59528344671, 141.64172335601, 149.81514739229, 149.97768707483, 154.18049886621, 162.02884353741, 165.3725170068, 166.1852154195 ], List[ 4.5743310657596, 34.202993197279, 95.735873015873, 286.25560090703 ], List[ 0.046439909297052, 0.069659863945578, 0.092879818594104, 0.11609977324263, 0.13931972789116, 0.16253968253968, 0.18575963718821, 0.20897959183673, 9.1951020408163, 36.664308390023, 36.687528344671, 36.71074829932, 36.757188208617, 36.780408163265, 36.803628117914, 37.059047619048, 37.128707482993, 37.151927437642, 37.17514739229, 37.244807256236, 56.470929705215, 66.501950113379, 66.525170068027, 66.548390022676, 66.873469387755, 66.896689342404, 67.128888888889, 67.337868480726, 67.361088435374, 89.698684807256, 89.721904761905, 89.745124716553, 89.814784580499, 89.838004535147, 89.861224489796, 218.63909297052, 218.66231292517, 218.68553287982, 236.82031746032, 236.84353741497, 236.86675736961, 236.88997732426, 236.91319727891, 236.93641723356, 236.95963718821, 241.34820861678, 241.44108843537, 241.46430839002, 251.35600907029, 251.37922902494, 251.40244897959, 264.19664399093, 290.11011337868, 290.13333333333, 290.22621315193, 290.24943310658, 290.5977324263, 290.71383219955, 291.08535147392, 291.15501133787, 291.17823129252, 291.75873015873, 291.78195011338, 291.80517006803, 291.82839002268, 291.85160997732, 291.89804988662, 292.57142857143, 292.59464852608, 292.94294784581, 292.96616780045, 293.05904761905, 293.0822675737, 293.66276643991, 293.68598639456, 293.70920634921, 293.73242630385, 293.7556462585, 293.77886621315, 293.87174603175, 293.89496598639, 293.91818594104, 294.01106575964, 294.26648526077, 294.35936507937, 294.38258503401, 294.49868480726, 294.5219047619, 294.75410430839, 294.87020408163, 294.96308390023, 295.56680272109, 295.65968253968, 295.68290249433, 320.27283446712, 320.29605442177, 422.64961451247, 434.60789115646, 448.00580498866, 450.37424036281 ] ]


On 5 Dec 2019, at 06:52, stepan.kayukov@xxxxxxxxx wrote:

Thank you - Nick. If I may ask now, how might I organize the data of multiple SCMIR analyses? 

For instance, if I wanted to use Tartini to do Pitch Analysis of 10 audio files. And I wanted to access all of the files (and their specific indices) that returned a value between 0.4 and 0.44.  

Is this something built in to the language? Is there a a tutorial on SCMIR for the beginners? 

Thank you again. 


On Wed, Nov 27, 2019 at 9:41 AM <clicksonnil@xxxxxxxxx> wrote:
Hi,

[170,5,11].order
gives
[ 1, 2, 0 ]

You're asking for the indices into an array if the values were sorted in order from lowest to highest.

e.featuredata is the actual Loudness output values, across your soundfile, according to a stepsize in time given in samples by SCMIR.framehop
To recover time in seconds from a given frame, use:
SCMIR.frameTime(frame)

Best
Nick





> On 27 Nov 2019, at 14:12, stepan.kayukov@xxxxxxxxx wrote:
>
> Hi all -
> I'm trying to work more closely with the SCMIR plugins in SC - and I'm just a little confused about the nature of the data that I'm processing.
>
> Let's say you use a basic analysis snippet..something like this:
>
> (
> {
> e = SCMIRAudioFile(~filename, [Loudness]);
> e.extractFeatures(normalize:true);
> ~ordered = e.featuredata.order;
> }.fork;
> )
>
> Well, ~ordered produces a long string of whole numbers (based on a short waveform test):
> [ 83, 85, 84, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 4, 11, 18, 25, 27, 34, 41, 2, 9, 20, 32, 6, 13, 36, 39, 16, 23, 0, 22, 29, 7, 15, 30, 37, 8, 14, 38, 1, 21, 28, 31, 3, 5, 12, 17, 24, 33, 35, 40, 10, 19, 26, 42, 45, 44, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 43, 94, 93, 92, 91, 90, 89, 88, 87, 86 ]
>
> These do not seem "ordered" necessarily.  Although, comparatively, the e.featuredata gives me an (even-longer?) float array.
>
> Maybe I missed this in the documentation, but can anyone help me understand what these numbers represent specifically? And perhaps, where does timing information enter the picture?
>
> Thanks.


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/