By Allen Wu
System Requirements:
1. SCMIR. See the link http://composerprogrammer.com/code.html
2. wslib Quark
SampleDescript uses music information retrieval technique to recognize features of a sound sample file.
Creating a new SampleDescript instance. In most of case you don't need to care about other arguments besides filename.
filename |
File name to analyse. It can also be a Buffer for live recording. |
normtype |
Type of normalization for SCMIR, 0 means not to normalize the data, 1 means to normalize all datas in between 0 and 1 |
start |
Start time to analyze |
dur |
Duration to analyze |
startThresh |
Amplitude threshold to determine the starting point of each sections in the sample. The value will be multiplied by the peak amplitude. |
endThresh |
Amplitude threshold to determine the ending point of each sections in the sample. The value will be multiplied by the peak amplitude. |
onsetThresh |
Absolute amplitude threshold for onset detection. |
groupingThresh |
Temporal threshold in seconds to determine the distance of onsets to be considered as the same section. |
filenameAsNote |
Uses information from the end of file name if possible for anchored midi key note sending to sampler synthesizer. Informations can be note names like "C4" or MIDI key numbers like "60". |
loadToBuffer |
Load the sample file to a buffer while analysing. |
server |
Server to load the file. |
action |
Function to run when loading to buffer is finished. |
Open a GUI window for SampleDescript. You can drag and drop a sound file onto the drop area to show the wavetable, and switch the buttons too show/hide various of parameters. Grid lines on the wavetable indecate the SCMIR frame hop.
The instance of the SamplerDescript generated with the GUI is stored in a global variable ~temp.
Free the instance and buffer.
Play the sound sample for audition.
at |
index of sections, nil for the whole file. |
outbus |
bus for playback. |
server |
server to load the file into server. |
Load sample file to Buffer.
The file path and name of the instance loaded. If a Buffer is loaded, a tempbuffer.aiff file will be created in system temp folder.
Buffer loaded the whole file.
An array of Buffers loaded with each sections of the sample.
The server to load Buffer into.
A MIDI key number for anchoring the original pitch of the sample.
nil if there is none.
Key number found from pitch detection, if no pitch is found, it will be replaced with frequency centorid mapped down by an octave.
An Envelope with the amplitude information of the whole file.
Local informations are descripted as an Array of numbers.
An Array of Envelops for each section detected.
Global time point of each section starts within the file.
Global time point of each section ends within the file.
Global time point of each amplitude peak detected within the file.
Peak amplitude of each section.
Conventional "attack time" for an envelope
Conventional "release time" for an envelope
Meaned each time frame weighted by amplitudes. Shorter value indicates percussive sounds. Longer value indicates sustained sounds.
SampleDescript uses SCMIR to create analysis data. The default frame size for FFT and other analysis in SCMIR is 1024 samples. And default samplingrate of SCMIR is 44100Hz. Raw data methods contains analyzed datas by each frame.
The instance of SCMIRAudioFile if needed.
Data Array extracted from SCMIR grouped by features, the array of features will be:
[[RMS], [Pitch], [hasPitch], [centroid], [SensoryDissonance], [Specflatness]]
Time point to the middle of each frame.
Pitch data is stored in this format of each frame:
[[Pitch, hasPitch], [Pitch, hasPitch], ......]
Pitch is defined by MIDI key number, it can be floating point numbers. hasPitch ranges from 0 to 1, 1 means a pitch is surely founded.
Spectral centroid is weighted mean of the frequencies by amplitude.
Local centroid data of each section.
Spectral flatness is an indicator of how flat of the spectrum to a frame. 0 means sinesoid wave, 1 means white noise. This indicates the degree of noiseness.