Skip to content

Instantly share code, notes, and snippets.

Avatar
🎹

Will Pragnell goonzoid

🎹
View GitHub Profile
@goonzoid
goonzoid / .gitignore-JUCE_OSX
Last active Nov 27, 2019
.gitignore for OS X JUCE projects
View .gitignore-JUCE_OSX
.DS_Store
*.pbxuser
*.perspectivev3
*.xcbkptlist
*.xccheckout
xcuserdata
/Builds/MacOSX/build
@goonzoid
goonzoid / audio_devices.m
Created Apr 1, 2018
List audio devices on OS X
View audio_devices.m
NSArray* audioDevices() {
AudioObjectPropertyAddress propertyAddress = {
kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster
};
UInt32 dataSize = 0;
OSStatus status = 0;
@goonzoid
goonzoid / monoSumming.c
Created Aug 6, 2013
Naively sum a non-interleaved buffer of stereo, floating-point audio to mono using the Accelerate framework. See http://dsp.stackexchange.com/a/2485 for suggestion of a more sophisticated approach.
View monoSumming.c
@import Accelerate;
static float* monoDataFromStereoNonInterleaved(const float *stereoData, size_t length) {
vDSP_Length numberOfSamples = length / sizeof(float) / 2;
const float *leftChannel = stereoData;
const float *rightChannel = leftChannel + numberOfSamples;
size_t monoDataLength = length / 2;
float *monoData = malloc(monoDataLength);
vDSP_vadd(leftChannel, 1, rightChannel, 1, monoData, 1, numberOfSamples);
float scale = 0.5;
@goonzoid
goonzoid / audioPlayback.m
Created Oct 26, 2012
Audio Queue Playback Callback
View audioPlayback.m
typedef struct FCAudioPlayer {
AudioStreamBasicDescription asbd;
AudioBuffer fileBuffer;
UInt32 playbackPosition;
UInt32 totalFrames;
} FCAudioPlayer;
static void FCAudioOutputCallback(void *inUserData, AudioQueueRef inAudioQueue, AudioQueueBufferRef inCompleteAudioQueueBuffer)
{
FCAudioPlayer *audioPlayer = (FCAudioPlayer *)inUserData;
You can’t perform that action at this time.