### Install Documentation and Code Directories Source: https://github.com/flucoma/flucoma-max/blob/main/CMakeLists.txt Installs local documentation, code examples, and vignettes into the Max package. ```cmake install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/local_docs/" DESTINATION "${MAX_PACKAGE_ROOT}/docs") install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/code/" DESTINATION "${MAX_PACKAGE_ROOT}/code") install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/vignettes" DESTINATION "${MAX_PACKAGE_ROOT}/docs") ``` -------------------------------- ### Install Package Metadata Files Source: https://github.com/flucoma/flucoma-max/blob/main/CMakeLists.txt Installs essential metadata and graphical assets for the Max package, including toolbar icons, package info, and quick start guides. ```cmake install(FILES FluidCorpusManipulation_toolbar.svg DESTINATION "${MAX_PACKAGE_ROOT}/misc") install(FILES icon.png package-info.json QuickStart.md DESTINATION ${MAX_PACKAGE_ROOT}) ``` -------------------------------- ### Install License File Source: https://github.com/flucoma/flucoma-max/blob/main/CMakeLists.txt Installs the distribution license file, renaming it to LICENSE.md within the Max package root. ```cmake install(FILES ${flucoma-core_SOURCE_DIR}/distribution.lic DESTINATION ${MAX_PACKAGE_ROOT} RENAME LICENSE.md) ``` -------------------------------- ### Install Max Package Directories Source: https://github.com/flucoma/flucoma-max/blob/main/CMakeLists.txt Installs common directories for a Max package, including examples, extras, help, and code. ```cmake foreach(PACKAGE_DIRECTORY examples;extras;help;init;patchers;interfaces;javascript;jsui;misc) install(DIRECTORY ${PACKAGE_DIRECTORY} DESTINATION ${MAX_PACKAGE_ROOT}) endforeach(PACKAGE_DIRECTORY) ``` -------------------------------- ### Build the Max Objects Library Source: https://github.com/flucoma/flucoma-max/blob/main/README.md Execute these commands in the terminal to configure and build the project. Replace with the actual path to your Max SDK installation. ```bash mkdir -p build && cd build cmake -DMAX_SDK_PATH= .. make install ``` -------------------------------- ### Install Audio and Data Resources Source: https://github.com/flucoma/flucoma-max/blob/main/CMakeLists.txt Installs audio files and data directories into the Max package. Resources are copied from the core Flucoma distribution. ```cmake install(DIRECTORY "${flucoma-core_SOURCE_DIR}/Resources/AudioFiles/" DESTINATION "${MAX_PACKAGE_ROOT}/media") install(DIRECTORY "${flucoma-core_SOURCE_DIR}/Resources/Data/" DESTINATION "${MAX_PACKAGE_ROOT}/misc") ``` -------------------------------- ### Install Waveform Source Directory Source: https://github.com/flucoma/flucoma-max/blob/main/CMakeLists.txt Installs the entire source directory for the fluid-waveform component into the Max package root. ```cmake install(DIRECTORY "${fluid_waveform_SOURCE_DIR}/" DESTINATION ${MAX_PACKAGE_ROOT}) ``` -------------------------------- ### Install XML Documentation and Interface JSON Source: https://github.com/flucoma/flucoma-max/blob/main/CMakeLists.txt Conditionally installs XML documentation and interface JSON files if the DOCS variable is set. These are typically generated during the build process. ```cmake if(DOCS) install(DIRECTORY "${MAX_DOC_OUT}/" DESTINATION "${MAX_PACKAGE_ROOT}/docs" PATTERN "*.xml") install(FILES "${MAX_DOC_OUT}/../interfaces/flucoma-obj-qlookup.json" "${MAX_DOC_OUT}/../interfaces/max.db.json" DESTINATION "${MAX_PACKAGE_ROOT}/interfaces") endif() ``` -------------------------------- ### Build Toolkit with CMake Source: https://context7.com/flucoma/flucoma-max/llms.txt Standard build process for the FluCoMa Max toolkit. ```bash # Clone the repository git clone https://github.com/flucoma/flucoma-max.git cd flucoma-max # Create build directory mkdir -p build && cd build # Configure with Max SDK path cmake -DMAX_SDK_PATH=/path/to/max-sdk .. # Build and install make install # The package will be assembled in release-packaging/ # Copy FluidCorpusManipulation folder to ~/Documents/Max 8/Packages/ ``` -------------------------------- ### Configure and Build Flucoma Max with CMake Source: https://github.com/flucoma/flucoma-max/wiki/In-a-Hurry Use this command to configure and build the Flucoma Max library. Ensure you replace `` with the actual path to your Max SDK and set `DOCS` to `ON` or `OFF` as needed. ```bash mkdir -p build && cd build cmake -DMAX_SDK_PATH= -DDOCS= .. make install ``` -------------------------------- ### Optimize Build for Performance Source: https://context7.com/flucoma/flucoma-max/llms.txt Configures compilation for specific CPU architectures. ```bash # Build with native CPU optimizations cmake -DMAX_SDK_PATH=/path/to/max-sdk \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_FLAGS="-march=native -mtune=native -O3" .. make -j8 install ``` -------------------------------- ### Build Universal Binary for Apple Silicon Source: https://github.com/flucoma/flucoma-max/wiki/Configuring-Compilation-for-Maximum-Performance To build a universal (fat) binary on newer Apple Silicon Macs, explicitly pass both x86_64 and arm64 architectures to CMake. ```bash cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" ``` -------------------------------- ### Enable Documentation Generation with CMake Source: https://github.com/flucoma/flucoma-max/wiki/Generating-Documentation Use this CMake command to enable the generation of documentation files, including `maxref.xml`, when building the Flucoma Max project. Ensure the `DOCS=ON` flag is passed. ```bash cmake -DDOCS=ON .. ``` -------------------------------- ### Build for Native CPU Optimization (GCC/Clang) Source: https://github.com/flucoma/flucoma-max/wiki/Configuring-Compilation-for-Maximum-Performance Use this flag with CMake to enable optimal settings for your specific CPU when using GCC or Clang. This may improve performance but reduce portability. ```bash cmake -DCMAKE_CXX_FLAGS=-march=native .. ``` -------------------------------- ### Build for Native CPU Optimization (ARM GCC/Clang) Source: https://github.com/flucoma/flucoma-max/wiki/Configuring-Compilation-for-Maximum-Performance On ARM architectures, use `-mcpu=native` with CMake for CPU-specific optimizations. This flag is an alternative to `-march=native` for ARM processors. ```bash cmake -DCMAKE_CXX_FLAGS=-mcpu=native .. ``` -------------------------------- ### Configure CMake Build for Flucoma Max Library Source: https://github.com/flucoma/flucoma-max/blob/main/source/projects/fluid.buf2list/CMakeLists.txt This CMake script sets up the build environment for a Max module library. It specifies the minimum required CMake version, includes pre-build configuration scripts, defines the library target, and includes post-build configuration scripts. ```cmake cmake_minimum_required(VERSION 3.11) include(${CMAKE_CURRENT_SOURCE_DIR}/../../script/max-pretarget.cmake) add_library( ${PROJECT_NAME} MODULE ${THIS_FOLDER_NAME}.cpp ) include(${CMAKE_CURRENT_SOURCE_DIR}/../../script/max-posttarget.cmake) ``` -------------------------------- ### Convert Buffers and Lists Source: https://context7.com/flucoma/flucoma-max/llms.txt Utilities for moving data between Max buffers and lists. ```max // Convert buffer data to list [buffer~ my_features 10 1] // 10 samples, 1 channel [bang] | v [fluid.buf2list @source my_features @startframe 0 @numframes -1] | v [print feature_list] // Outputs list of 10 values ``` ```max // Convert list to buffer [buffer~ destination 0 1] [1. 0.5 0.8 0.3 0.9] // List of values | v [fluid.list2buf @destination destination @autosize 1] | v [bang] // Triggers when complete ``` -------------------------------- ### Specify Local Dependency Paths with CMake Source: https://github.com/flucoma/flucoma-max/wiki/Using-Manual-Dependencies Use this command to tell the build system where your local copies of required libraries are located. Replace placeholders with your actual paths. ```bash cmake -DMAX_SDK_PATH= -DFLUID_PATH= .. ``` -------------------------------- ### Visualize Large Datasets with fluid.jit.plotter Source: https://context7.com/flucoma/flucoma-max/llms.txt High-performance OpenGL-based plotter for large datasets. ```max // Plot large dataset with GPU acceleration [fluid.dataset~ large_corpus] [fluid.labelset~ labels] // Reference datasets directly by name [refer large_corpus] | v [fluid.jit.plotter] // Left inlet [refer labels] | v [fluid.jit.plotter] // Right inlet // Customize appearance [colorscheme paired] [pointsizescale 0.5] [shape circle] // or square [bgcolor 0.1 0.1 0.1 1.0] // Dark background | v [fluid.jit.plotter] // Highlight specific points [highlight point_001 point_002 point_003] | v [fluid.jit.plotter] ``` -------------------------------- ### Generate Max Source for Client Groups Source: https://github.com/flucoma/flucoma-max/blob/main/CMakeLists.txt Iterates through client groups to generate Max source files. Requires client list, headers, and classes for each client. ```cmake get_client_group(NONE client_list) foreach(client ${client_list}) get_core_client_header(${client} header) get_core_client_class(${client} class) generate_max_source( CLIENTS ${client} HEADERS ${header} CLASSES ${class} ) endforeach() ``` -------------------------------- ### Analyze pitch content of a buffer Source: https://context7.com/flucoma/flucoma-max/llms.txt Perform buffer pitch analysis using fluid.bufpitch~. It outputs pitch and confidence values over time to a destination buffer. Configure algorithm, min/max frequency as needed. ```max // Analyze pitch content of a buffer [buffer~ audio melody.wav] [buffer~ pitch_analysis 0 2] // 2 channels for pitch and confidence [fluid.bufpitch~ @source audio @features pitch_analysis @algorithm 1 @minfreq 50 @maxfreq 2000] | v [bang] // When done | v [fluid.buf2list @source pitch_analysis @startchan 0] | v [print pitches_Hz] ``` -------------------------------- ### Collect Audio Files with fluid.audiofilesin Source: https://context7.com/flucoma/flucoma-max/llms.txt Collects all audio files from a directory path into a list. ```max // Get all audio files in a folder [/Users/me/sounds] // Path as symbol | v [fluid.audiofilesin] | v [zl group 100] | v [print audiofiles] // List of file paths ``` -------------------------------- ### Build for 32-bit macOS Source: https://github.com/flucoma/flucoma-max/wiki/Configuring-Compilation-for-Maximum-Performance To build for 32-bit macOS, specify both x86 and x86_64 architectures. Note that 32-bit builds may not always function correctly and require Xcode versions prior to 10. ```bash cmake -DCMAKE_OSX_ARCHITECTURES="x86;x86_64" ``` -------------------------------- ### Concatenate Audio Files with fluid.concataudiofiles Source: https://context7.com/flucoma/flucoma-max/llms.txt Concatenates multiple audio files into a single buffer. ```max // Build a corpus buffer from multiple files [buffer~ corpus_buffer] [fluid.audiofilesin] // Get file list | v [fluid.concataudiofiles @destination corpus_buffer] | v [bang] // Done loading ``` -------------------------------- ### Real-time Pitch Detection with fluid.pitch~ Source: https://context7.com/flucoma/flucoma-max/llms.txt Tracks fundamental frequency and confidence level in real-time using algorithms like YIN or HPS. ```max // Basic real-time pitch tracking with confidence output // Create a patch with these objects connected: [adc~ 1] // Audio input | v [fluid.pitch~ @algorithm 1 @minfreq 100 @maxfreq 5000] | | v v [unpack f f] // Unpack pitch and confidence | | v v [number~] [number~] // Display Hz and confidence (0-1) ``` -------------------------------- ### Decompose audio into components using NMF Source: https://context7.com/flucoma/flucoma-max/llms.txt Apply Non-Negative Matrix Factorization with fluid.bufnmf~ to decompose spectral data into user-defined components. Specify source/resynth buffers, number of components, and iterations. ```max // Decompose audio into 3 components using NMF [buffer~ source drums.wav] [buffer~ resynth 0 3] // 3 components [fluid.bufnmf~ @source source @resynth resynth @components 3 @iterations 100] | v [bang] | v // Play individual components [play~ resynth 1] // Component 1 [play~ resynth 2] // Component 2 [play~ resynth 3] // Component 3 ``` -------------------------------- ### Copy and transform buffer regions Source: https://context7.com/flucoma/flucoma-max/llms.txt Manipulate buffer data with fluid.bufcompose~ for copying, combining, and transforming regions. Flexible source/destination mapping is provided. Use @destgain and @destoffset for precise control. ```max // Copy and transform buffer regions [buffer~ source drumloop.wav] [buffer~ destination] // Copy with gain and offset [fluid.bufcompose~ @source source @destination destination @startframe 0 @numframes 22050 // First 0.5s at 44.1kHz @destgain 0.8 // Apply gain @destoffset 0] // Write at beginning | v [print "Copy complete"] // Overlay (add) a second copy [fluid.bufcompose~ @source source @destination destination @startframe 0 @numframes 22050 @destgain 0.5 @destoffset 11025] // Offset by 0.25s ``` -------------------------------- ### Manage Labels with fluid.labelset~ Source: https://context7.com/flucoma/flucoma-max/llms.txt Associates categorical labels with data point identifiers for supervised learning tasks. ```max // Create labels for classification [fluid.labelset~ my_labels] // Add labels [addlabel point_001 kick] [addlabel point_002 snare] [addlabel point_003 kick] | v [fluid.labelset~ my_labels] // Get label [getlabel point_001] | v [fluid.labelset~ my_labels] | v [print label] // Outputs: kick ``` -------------------------------- ### Slice a buffer based on amplitude Source: https://context7.com/flucoma/flucoma-max/llms.txt Use fluid.bufampslice~ to analyze an entire buffer for amplitude-based slice points. The results are returned as a buffer of slice indices. Ensure minimum slice length is considered. ```max // Slice a buffer based on amplitude [buffer~ source_audio drumloop.wav] [buffer~ slice_points] // Trigger analysis [fluid.bufampslice~ @source source_audio @indices slice_points @onthreshold -24 @offthreshold -28 @minslicelength 2205] // Minimum 50ms at 44.1kHz | v [print "Analysis complete"] // Bang when done | v [fluid.buf2list @source slice_points] | v [print slice_indices] // List of sample indices ``` -------------------------------- ### Real-time Loudness Analysis with fluid.loudness~ Source: https://context7.com/flucoma/flucoma-max/llms.txt Computes perceptual loudness in dB LUFS and True Peak levels. ```max // Loudness monitoring setup [adc~ 1] | v [fluid.loudness~ @hopsize 64 @windowsize 1024] | | v v [number~] [number~] // Output 1: Loudness (dB LUFS) // Output 2: True Peak (dB) ``` -------------------------------- ### Real-time Spectral Descriptors with fluid.spectralshape~ Source: https://context7.com/flucoma/flucoma-max/llms.txt Computes various spectral shape descriptors to characterize sound brightness and texture. ```max // Compute spectral descriptors [adc~ 1] | v [fluid.spectralshape~ @windowsize 4096] | | | | | | | v v v v v v v [multislider] // 7 outputs: centroid, spread, skewness, // kurtosis, rolloff, flatness, crest ``` -------------------------------- ### Slice audio based on amplitude Source: https://context7.com/flucoma/flucoma-max/llms.txt Use fluid.ampslice~ to detect segment boundaries based on amplitude envelope changes. Outputs bang messages when onsets are detected. ```max // Slice audio based on amplitude [adc~ 1] | v [fluid.ampslice~ @fastrampup 1 @fastrampdown 1 @slowrampup 100 @slowrampdown 100 @onthreshold -40 @offthreshold -50] | v [counter] // Count slices | v [print slice_index] ``` -------------------------------- ### Normalize Datasets with fluid.normalize~ Source: https://context7.com/flucoma/flucoma-max/llms.txt Normalizes datasets to a specified range for machine learning preprocessing. ```max // Normalize a dataset [fluid.dataset~ raw_features] [fluid.dataset~ normalized_features] // Fit normalizer and transform [fitTransform raw_features normalized_features @min 0 @max 1] | v [fluid.normalize~ my_normalizer] // Transform new data using learned parameters [transform new_data transformed_data] | v [fluid.normalize~ my_normalizer] ``` -------------------------------- ### Transient Extraction with fluid.transients~ Source: https://context7.com/flucoma/flucoma-max/llms.txt Isolates transient attacks from sustaining audio portions for independent manipulation. ```max // Extract transients from audio [adc~ 1] | v [fluid.transients~ @order 20 @blocksize 256] | | v v [*~ 1.5] [*~ 0.8] // Boost transients, reduce residual | | v v [+~] // Recombine with new balance | [dac~ 1 2] ``` -------------------------------- ### Compute Statistics with fluid.stats Source: https://context7.com/flucoma/flucoma-max/llms.txt Computes statistics on lists of numbers. ```max // Compute statistics on feature list [0.5 0.3 0.8 0.2 0.9 0.1 0.7] | v [fluid.stats @numderivs 1] // Include first derivative stats | v [print mean_std_skew_kurt_min_med_max] ``` -------------------------------- ### Search with K-D Tree Source: https://context7.com/flucoma/flucoma-max/llms.txt Builds a spatial index for efficient nearest neighbor searches on large datasets. ```max // Build KD-tree and query nearest neighbors [fluid.dataset~ corpus] // Build the tree [fit corpus] | v [fluid.kdtree~ my_tree] // Query k nearest neighbors [knearest query_buffer 5] // Find 5 nearest | v [fluid.kdtree~ my_tree] | v [print nearest_ids distances] // Returns IDs and distances ``` -------------------------------- ### Generate Max Source for MANIPULATION Group Source: https://github.com/flucoma/flucoma-max/blob/main/CMakeLists.txt Generates Max source files specifically for the MANIPULATION client group. Aggregates clients, headers, and classes into lists before generation. ```cmake get_client_group(MANIPULATION client_list) foreach(client ${client_list}) get_core_client_header(${client} header) get_core_client_class(${client} class) list(APPEND MANIPULATION_CLIENTS ${client}) list(APPEND MANIPULATION_HEADERS ${header}) list(APPEND MANIPULATION_CLASSES ${class}) endforeach() generate_max_source( CLIENTS ${MANIPULATION_CLIENTS} HEADERS ${MANIPULATION_HEADERS} CLASSES ${MANIPULATION_CLASSES} FILENAME fluid.libmanipulation ) ``` -------------------------------- ### Multi-function onset detection Source: https://context7.com/flucoma/flucoma-max/llms.txt Employ fluid.onsetslice~ for specialized note onset detection using various methods like complex domain, high-frequency content, and spectral flux. The @function parameter selects the detection method. ```max // Multi-function onset detection [adc~ 1] | v [fluid.onsetslice~ @function 0 @threshold 0.5] // function 0 = energy // function 1 = HFC (high frequency content) // function 2 = SpectralFlux // function 3 = MKL (modified Kullback-Leibler) // function 4 = IS (Itakura-Saito) // function 5 = Cosine // function 6 = PhaseDev // function 7 = WPhaseDev // function 8 = ComplexDev // function 9 = RComplexDev | v [print onset] ``` -------------------------------- ### Compute statistics on feature analysis Source: https://context7.com/flucoma/flucoma-max/llms.txt Calculate statistical summaries for buffer data using fluid.bufstats~. It computes mean, standard deviation, skewness, kurtosis, min, max, etc., across frames or channels. Specify source and stats buffers. ```max // Compute statistics on feature analysis [buffer~ features] // Multi-channel feature data [buffer~ stats 0 7] // 7 statistics per channel [fluid.bufstats~ @source features @stats stats @numderivs 0] | v [bang] | v [fluid.buf2list @source stats] | v [print "mean stddev skew kurtosis min median max"] ``` -------------------------------- ### Detect musical phrase boundaries Source: https://context7.com/flucoma/flucoma-max/llms.txt Utilize fluid.noveltyslice~ for detecting segment boundaries using spectral novelty, suitable for complex material. It finds points where spectral content changes significantly. ```max // Detect musical phrase boundaries [adc~ 1] | v [fluid.noveltyslice~ @threshold 0.5 @kernelsize 3 @filtersize 1] | v [uzi 10] // Trigger a sequence on each slice | v [print novelty_slice] ``` -------------------------------- ### Real-time MFCC Extraction with fluid.mfcc~ Source: https://context7.com/flucoma/flucoma-max/llms.txt Extracts Mel-Frequency Cepstral Coefficients for timbral analysis and machine learning applications. ```max // Extract 13 MFCCs for timbre analysis [adc~ 1] | v [fluid.mfcc~ @numcoeffs 13 @numbands 40] | v [fluid.stats @numderivs 1] // Compute statistics over time | v [fluid.dataset~ my_features] // Store in dataset for ML ``` -------------------------------- ### Sinusoidal Modeling with fluid.sines~ Source: https://context7.com/flucoma/flucoma-max/llms.txt Decomposes audio into sinusoidal and residual components via spectral peak tracking. ```max // Separate sinusoidal and residual components [adc~ 1] | v [fluid.sines~ @bandwidth 76 @birthhighthreshold -60 @birthlowthreshold -90] | | v v [dac~ 1] [dac~ 2] // Output 1: Sinusoids (pitched content) // Output 2: Residual (noise/texture) ``` -------------------------------- ### Manage Datasets with fluid.dataset~ Source: https://context7.com/flucoma/flucoma-max/llms.txt Stores multi-dimensional data points with string identifiers for use in corpora and ML workflows. ```max // Create and populate a dataset [fluid.dataset~ my_corpus] // Add a point [addpoint point_001 0.5 0.3 0.8 0.2] | v [fluid.dataset~ my_corpus] // Get point data [getpoint point_001] | v [fluid.dataset~ my_corpus] | v [print point_data] // Outputs: point_001 0.5 0.3 0.8 0.2 // Dump all data as dictionary [dump] | v [fluid.dataset~ my_corpus] | v [dict.view] // View as dictionary ``` -------------------------------- ### Reduce Dimensions with fluid.pca~ Source: https://context7.com/flucoma/flucoma-max/llms.txt Projects high-dimensional data into fewer dimensions while preserving variance. ```max // Reduce dimensions from 13 MFCCs to 2D for visualization [fluid.dataset~ mfcc_features] // 13-dimensional [fluid.dataset~ reduced_features] // Will be 2-dimensional [fitTransform mfcc_features reduced_features @numdimensions 2] | v [fluid.pca~ my_pca] | v [bang] | v [fluid.plotter] // Visualize in 2D ``` -------------------------------- ### Harmonic-Percussive Source Separation with fluid.hpss~ Source: https://context7.com/flucoma/flucoma-max/llms.txt Separates audio into harmonic and percussive components using spectral median filtering. ```max // Real-time harmonic-percussive separation [adc~ 1] | v [fluid.hpss~ @harmfiltersize 17 @percfiltersize 31] | | v v [dac~ 1] [dac~ 2] // Output 1: Harmonic component // Output 2: Percussive component ``` -------------------------------- ### Perform K-Means Clustering Source: https://context7.com/flucoma/flucoma-max/llms.txt Clusters datasets into groups and predicts cluster assignments for new data points. ```max // Cluster a dataset into 4 groups [fluid.dataset~ my_data] [fluid.labelset~ cluster_labels] // Fit the model [fit my_data cluster_labels @numclusters 4] | v [fluid.kmeans~ my_kmeans] | v [print "Clustering complete"] // Predict cluster for new point (via buffer) [buffer~ query_point 4 1] [0.5 0.3 0.8 0.2] | [fluid.list2buf @destination query_point] | v [predictpoint query_point] | v [fluid.kmeans~ my_kmeans] | v [print cluster_id] ``` -------------------------------- ### Define fluid.plotter object Source: https://github.com/flucoma/flucoma-max/blob/main/init/fluid-jsui-init.txt Configures the fluid.plotter object as a jsui component with specific file and border settings. ```Max max objectfile fluid.plotter fluid.plotter; max definesubstitution fluid.plotter jsui @filename fluid.plotter @border 0; ``` -------------------------------- ### Visualize 2D Data with fluid.plotter Source: https://context7.com/flucoma/flucoma-max/llms.txt Plots 2D datasets with support for labels and interactive controls. ```max // Visualize a 2D dataset [fluid.dataset~ my_2d_data] [fluid.labelset~ my_labels] // Dump dataset to plotter [dump] | v [fluid.dataset~ my_2d_data] | v [dict.serialize] | v [fluid.plotter] // Left inlet: data ^ | // Colors from labels [dump] | [fluid.labelset~ my_labels] | [dict.serialize] | [fluid.plotter] // Right inlet: labels // Configure appearance [range 0. 1.] // Set x and y range [pointsizescale 2.0] // Scale point size [colorscheme tableau] // Use tableau color scheme | v [fluid.plotter] ``` -------------------------------- ### Add Max External Source: https://github.com/flucoma/flucoma-max/blob/main/CMakeLists.txt Registers a C++ source file as a Max external. Used for individual externals like list2buf and buf2list. ```cmake add_max_external(fluid.list2buf "${CMAKE_CURRENT_SOURCE_DIR}/source/projects/fluid.list2buf/fluid.list2buf.cpp") add_max_external(fluid.buf2list "${CMAKE_CURRENT_SOURCE_DIR}/source/projects/fluid.buf2list/fluid.buf2list.cpp") ``` -------------------------------- ### Classify with K-Nearest Neighbors Source: https://context7.com/flucoma/flucoma-max/llms.txt Classifies data based on the labels of the k nearest neighbors in a training set. ```max // Train a KNN classifier [fluid.dataset~ training_data] [fluid.labelset~ training_labels] // Fit the classifier [fit training_data training_labels] | v [fluid.knnclassifier~ my_knn @numneighbors 5] | v [print "Training complete"] // Classify new point [predictpoint query_buffer] | v [fluid.knnclassifier~ my_knn] | v [print predicted_label] ``` -------------------------------- ### Regress with Multi-Layer Perceptron Source: https://context7.com/flucoma/flucoma-max/llms.txt Neural network regressor for mapping input features to continuous output values. ```max // Train regression model for parameter mapping [fluid.dataset~ input_features] // e.g., audio descriptors [fluid.dataset~ output_params] // e.g., synth parameters [fluid.mlpregressor~ my_regressor @hiddenlayers 8 4 @maxiter 500] // Train [fit input_features output_params] | v [fluid.mlpregressor~ my_regressor] | v [print loss] // Predict continuous values [predict input_dataset output_dataset] | v [fluid.mlpregressor~ my_regressor] ``` -------------------------------- ### Perform Non-linear Reduction with fluid.umap~ Source: https://context7.com/flucoma/flucoma-max/llms.txt Provides non-linear dimensionality reduction for complex data visualization. ```max // UMAP dimensionality reduction for visualization [fluid.dataset~ high_dim_data] [fluid.dataset~ embedded_data] [fitTransform high_dim_data embedded_data @numdimensions 2 @numneighbors 15 @minDist 0.1] | v [fluid.umap~ my_umap] | v [fluid.plotter] // Visualize clusters ``` -------------------------------- ### Classify with Multi-Layer Perceptron Source: https://context7.com/flucoma/flucoma-max/llms.txt Neural network classifier supporting multiple hidden layers for non-linear classification. ```max // Configure and train an MLP classifier [fluid.dataset~ features] [fluid.labelset~ labels] // Setup network architecture [fluid.mlpclassifier~ my_mlp @hiddenlayers 10 5 @activation 1 @maxiter 1000] // Train the network [fit features labels] | v [fluid.mlpclassifier~ my_mlp] | v [print error] // Training error // Make predictions [predictpoint query_buffer] | v [fluid.mlpclassifier~ my_mlp] | v [print predicted_class] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.