This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- melody generator | |
-- based on https://gist.github.com/schollz/e2cc49425d54336b422e144e7eeb34cc | |
function init() | |
ii.jf.mode(1) | |
local chords={"I","vi","IV","iii"} -- change to any chords | |
local move_left=6 -- change to 0-12 | |
local move_right=6 -- change to 0-12 | |
local stay_on_chord=0.95 -- change to 0-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.DS_Store | |
*.pbxuser | |
*.perspectivev3 | |
*.xcbkptlist | |
*.xccheckout | |
xcuserdata | |
/Builds/MacOSX/build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSArray* audioDevices() { | |
AudioObjectPropertyAddress propertyAddress = { | |
kAudioHardwarePropertyDevices, | |
kAudioObjectPropertyScopeGlobal, | |
kAudioObjectPropertyElementMaster | |
}; | |
UInt32 dataSize = 0; | |
OSStatus status = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |