Skip to content

Instantly share code, notes, and snippets.

View mhroth's full-sized avatar

Martin Roth mhroth

  • @supersg559
  • Zürich
View GitHub Profile
@mhroth
mhroth / movemask.c
Created October 21, 2015 17:48
A basic NEON implementation of SSE _mm_movemask_ps
uint32_t _mm_movemask_ps(float32x4_t x) {
uint32x4_t mmA = vandq_u32(
vreinterpretq_u32_f32(x), (uint32x4_t) {0x1, 0x2, 0x4, 0x8}); // [0 1 2 3]
uint32x4_t mmB = vextq_u32(mmA, mmA, 2); // [2 3 0 1]
uint32x4_t mmC = vorrq_u32(mmA, mmB); // [0+2 1+3 0+2 1+3]
uint32x4_t mmD = vextq_u32(mmC, mmC, 3); // [1+3 0+2 1+3 0+2]
uint32x4_t mmE = vorrq_u32(mmC, mmD); // [0+1+2+3 ...]
return vgetq_lane_u32(mmE, 0);
}
@mhroth
mhroth / Heavy_heavy.h
Last active August 29, 2015 14:14
Heavy API: Patch
/**
* Creates a new patch instance.
* @param sampleRate Must be positive and in Hertz.
*
* @returns An allocated instance of the heavy patch.
* DO NOT manually free this instance. Use hv_heavy_free() below.
*/
Hv_heavy *hv_heavy_new(double sampleRate);
/** Frees a patch instance. */
@mhroth
mhroth / gist:2e13b73bf4126f55cbfd
Created November 1, 2014 20:30
Notes about a Procedural Audio Forum

Notes about a Procedural Audio Forum

My recent guest post at Designing Sound, What's the Deal with Procedural Game Audio?, made a call for a forum for designers to discuss and trade information about creating procedural (reactive, interactive, generative, etc.) sound and music. @kcmyoung asked what I meant by that, so here goes.

An Online Forum

Like all of us thinking about this topic, I love music and sound. Given my training as a software developer, my way of contributing to the field isn't by making sound, but rather by making tools for people to make sound with. One step removed, but close enough. As a developer I take a lot of inspiration from the developer-oriented forums such as musicdsp or Stackoverflow.

Ideally I'd like to see a forum where I can go to ask "How do I make this sound?", "How can I m

@mhroth
mhroth / Tannhauser_tann.h
Last active August 29, 2015 14:00
Tannhäuser API: Patch
#pragma mark - Tannhäuser Tann Patch
#ifndef _TANNHAUSER_TANN_H_
#define _TANNHAUSER_TANN_H_
typedef struct Tann_tann Tann_tann;
/**
* Creates a new patch instance. Block size should be a power of two.
* Sample rate should be positive and in Hertz.
@mhroth
mhroth / Tannhauser_tann.h
Last active August 29, 2015 14:00
Tannhäuser API: Common
#pragma mark - Tannhäuser Common
#ifndef _TANNHAUSER_COMMON_H_
#define _TANNHAUSER_COMMON_H_
typedef void Tannhauser;
/** Returns the block size with which this patch has been configured. */
int th_getBlockSize(Tannhauser *c);
@mhroth
mhroth / Tannhauser_tann.h
Last active August 29, 2015 14:00
Tannhäuser API: PdMessage
#pragma mark - Tannhäuser Message
#ifndef _TANNHAUSER_MESSAGE_H_
#define _TANNHAUSER_MESSAGE_H_
#include <stdbool.h>
typedef struct PdMessage PdMessage;
/** Returns the byte size of a PdMessage with a number of elements on the heap. */
@mhroth
mhroth / Tannhauser_tann.h
Last active August 29, 2015 14:00
Tannhäuser API: PdTable
#pragma mark - Tannhäuser Table
#ifndef _TANNHAUSER_TABLE_H_
#define _TANNHAUSER_TABLE_H_
typedef struct PdTable PdTable;
/**
* Resizes the table to the given length. Length must be positive.
* Existing contents are copied to the new table. Remaining space is cleared.