Last active
August 29, 2015 14:03
-
-
Save fesor/9cb75622a6f32bb7c3cd to your computer and use it in GitHub Desktop.
Audio encoding/decoding
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
import audio; | |
auto soundDecoder = new Decoder(new BufferedFile("./mywave.mp3")); | |
// Decoder should implements opApply method; | |
// http://dlang.org/statement.html#opApply | |
foreach(ulong frameNumber, FrameInfo frame; soundDecoder) { | |
// so something usefull, FFT for example | |
doStuff(frame.data); | |
} | |
// or | |
soundDecoder.rewind(); | |
FrameInfo frame = soundDecoder.getFrame(); | |
// or | |
soundDecoder.rewind(); | |
FrameInfo[] frames = soundDecoder.getAllFrames(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment