Created
May 26, 2015 19:21
-
-
Save prisonerjohn/4b635baf3eb94830c162 to your computer and use it in GitHub Desktop.
ofxAudioDecoder to libsndfile
This file contains 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
sfInfo.frames = audioDecoder.getNumFrames(); | |
sfInfo.samplerate = audioDecoder.getSampleRate(); | |
sfInfo.channels = audioDecoder.getChannels(); | |
sfInfo.format = SF_FORMAT_WAV; | |
sfInfo.sections = 1; | |
sfInfo.seekable = SF_TRUE; | |
SNDFILE * f = sf_open(ofToDataPath("testies.wav", true).c_str(), SFM_WRITE, &sfInfo); | |
// int err = sf_error(f); | |
// cout << "error " << err << endl; | |
const char* err = sf_strerror(f); | |
cout << "error is " << err << endl; | |
cout << "writing " << audioDecoder.getNumSamples() << " float samples" << endl; | |
int count = sf_write_float(f, audioDecoder.getRawSamples().data(), audioDecoder.getNumSamples()); | |
cout << "count is " << count << endl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment