Skip to content

Instantly share code, notes, and snippets.

View danigb's full-sized avatar

danigb danigb

  • InVideo
  • Seville, spain
View GitHub Profile
@danigb
danigb / ffmpeg_sample_formats.txt
Last active July 26, 2024 11:32
ffmpeg sample formats
Source: https://forum.videohelp.com/threads/373264-FFMpeg-List-of-working-sample-formats-per-format-and-encoder
---------------------------------------------------------------------------------------------------------------
MP3 - MPEG Layer 3 Audio - Libmp3lame
sample_fmt="s16p,s32p,fltp"
AAC - Advanced Audio Coding - AAC (Advanced Audio Coding)
sample_fmt="fltp"
@danigb
danigb / sonl.md
Created March 13, 2022 17:50
sonl draft

Sound language compiling to WASM

Designed to be useful for writing sound formulas / audio processing code for various audio targets, such as AudioWorkletProcessor, audio engines, individual audio nodes etc.

Initially inspired by zzfx, bytebeat, hxos, web-audio-engine and others, but soon it became clear that JS limitations are no-go for sound processing and it needs something more foundational with better low-level control, which WASM perfectly provides.

Examples

Gain

@danigb
danigb / encoding-video.md
Created September 15, 2021 11:42 — forked from Vestride/encoding-video.md
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@danigb
danigb / .gitignore
Last active October 28, 2020 22:16
React playground
node_modules/
.cache
dist/
@danigb
danigb / LICENSE.txt
Last active October 25, 2020 20:16 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@danigb
danigb / 88keys.js
Created August 31, 2020 01:26
Generate 88keys sheet paper
const fs = require("fs");
const { PDFDocument, rgb } = require("pdf-lib");
const KEY_COLORS = "WBWBWWBWBWBW";
const KEYS = 88;
const MEASURES = 2 * 4;
const DIVISION = 3;
const SUBDIVISION = 3;
@danigb
danigb / viu.js
Last active November 29, 2019 13:44
An utility function to create testable views
/**
* An utility function to create views. Views are objects that abstract the DOM.
*
* It's a very thin layer that will allow to write frontend tests if
* needed and get rid of jQuery
*
* The idea of this function is to reduce boilerplate: instead of creating
* by hand the elements we need with jQuery, we just provide the selectors
* and it returns an object with the same shape.
*
@danigb
danigb / intersected_variables.rb
Last active September 10, 2019 11:43
Scoped variables localistico
# frozen_string_literal: true
##
# Variables resulting from the intersection two or more variables
# It's used by TemplateGallery to perform validation
class Variables::IntersectedVariables < Variables
def initialize(list)
@list = list
end
@danigb
danigb / readme.md
Last active August 26, 2019 13:55
find duplicates
Template.select([:name]).group(:name).having("count(name) > 1").reorder(nil).all.size
D, [2019-08-26T13:40:29.299683 #99] DEBUG -- :   Template Load (1.5ms)  SELECT  "templates"."name" FROM "templates" GROUP BY "templates"."name" HAVING (count(name) > 1) LIMIT $1  [["LIMIT", 11]]
=> #<ActiveRecord::Relation [#<Template id: nil, name: "Store Page (2510)">, #<Template id: nil, name: "business-jsonld">, #<Template id: nil, name: "Change me">, #<Template id: nil, name: "Hero Store Page (2510)">]>
irb(main):012:0> Template.select([:name]).group(:name).having("count(name) > 1").reorder(nil).all.count
D, [2019-08-26T13:40:34.657327 #99] DEBUG -- :    (1.6ms)  SELECT COUNT("templates"."name") AS count_name, "templates"."name", "templates"."name" AS templates_name FROM "templates" GROUP BY "templates"."name" HAVING (count(name) > 1)
=&gt; {"Store Page (2510)"=&gt;2, "business-jsonld"=&gt;2, "Change me"=&gt;2, "Hero Store Page (2510)"=&gt;2}
var PATTERN = new RegExp("{([a-z]+)}", "gi");
function tmpl(template, data) {
return template.replace(PATTERN, function(tag, token) {
return data[token];
});
}