https://github.com/DamRsn/NeuralNote
https://github.com/BShakhovsky/PolyphonicPianoTranscription
The C++ standard library containers are nice. Like, really nice. As the kind of person who worries about performance to the point that they were shy of anything other than a raw data array I've come to appreciate the usability (and speed!) of ye olde std::vector. Does that many me sound like a wannabe oldie?
Recently I came across a situation where I had, say, a vector [a, b, c, d] and wanted to create the vectors [a, b, c], [a, b, d], [a, c, d], and [b, c, d]. I didn't want to actually allocate O(N(N-1)) additional memory but learned that std::vector didn't support holding references. That's when I came across std::reference_wrapper.
From the Cppreference page:
| // Sobel Edge Detection Filter | |
| // GLSL Fragment Shader | |
| // Implementation by Patrick Hebron | |
| uniform sampler2D texture; | |
| uniform float width; | |
| uniform float height; | |
| void make_kernel(inout vec4 n[9], sampler2D tex, vec2 coord) | |
| { |
| from numpy import float32, load | |
| from vispy.geometry import MeshData | |
| from vispy.gloo import VertexBuffer | |
| from vispy.io.image import write_png | |
| from vispy.plot import Fig | |
| from vispy.scene.visuals import create_visual_node | |
| from vispy.visuals import Visual | |
| # download https://dl.dropboxusercontent.com/u/66601/fsaverage.npz | |
| surf = load('fsaverage.npz') |
Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative
float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
| #pragma once | |
| #include <exception> | |
| #include <memory> | |
| #include <typeinfo> | |
| #include <type_traits> | |
| class any; | |
| template<class Type> Type any_cast(any&); |
| /* | |
| 2D Angle Interpolation (shortest distance) | |
| Parameters: | |
| a0 = start angle | |
| a1 = end angle | |
| t = interpolation factor (0.0=start, 1.0=end) | |
| Benefits: | |
| 1. Angles do NOT need to be normalized. |
| // Heapsort with Java | |
| // Heap properties: | |
| // Left child of h[i] is h[2i + 1] (given 2i + 1 < h.size) | |
| // Right child of h[i] is h[2i + 2] (given 2i + 2 < h.size) | |
| // parent of h[i] is h[(i-1)/2] (given i > 0) | |
| public class Heap { | |
| int[] heap; | |
| int size; |