Skip to content

Accessing Raw Amplitude Data from imported WAV file #538

Answered by mackron
hiraz01 asked this question in Q&A
Discussion options

You must be logged in to vote

In the simple_playback example you'll see how there's a call to ma_decoder_read_pcm_frames(). You would use that. In the example it's outputting straight to the callback's output buffer, but instead you would just output it to your own buffer and do whatever it is you need to do. Just make sure that you copy the data over to the callback's output buffer eventually or else you won't hear anything. If you need your samples in floating point format, make sure you configure the decoder to output samples as ma_format_f32:

ma_decoder_config decoderConfig = ma_decoder_config_init(ma_format_f32, channels, sampleRate);

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@mackron
Comment options

@hiraz01
Comment options

@hiraz01
Comment options

@mackron
Comment options

@hiraz01
Comment options

Answer selected by hiraz01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants