Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

Load wav file into ofSoundBuffer

$
0
0

There is a copyFrom() method which takes a raw float * and asks you to set the channel count & sample rate metadata:

void copyFrom(const float * floatBuffer, std::size_t numFrames, std::size_t numChannels, unsigned int sampleRate)

..Or you could access the underlying buffer if you'd like to use std::vector methods like assign() or begin() / end()

std::vector<float>& getBuffer()

If you get the raw buffer like this, you should set the sample rate and channel count later, or things like resampling or playback won't work correctly.

For reading the buffer, you can use operator[] to access the underlying std::vector<float> directly, or use getSample() to handle the (frameIndex * channels) + channel calculation for you.

ofSoundBuffer doesn't include any file I/O at the moment


Viewing all articles
Browse latest Browse all 40524

Trending Articles


Practice Sheet of Right form of verbs for HSC Students


TYKEMA GLEATON


The Conjuring 2 (Tamil Dubbed)


Woman stabbed 12 times and dumped in ditch


Moondru Mudichu 07-06-2016 – Polimer tv Serial


Trio remanded on gun, other serious charges


Rick Ross & Etana – Kiss Of Judas – Single [iTunes Plus M4A]


The 6 Best Sex Scenes in Nollywood Movies


Take this week's NJ.com Local News Quiz


Angeline Yap kym?



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>