alexbw / novocaine

Painless high-performance audio on iOS and Mac OS X
http://alexbw.github.com/novocaine/
MIT License
2.23k stars 273 forks source link

AudioFileReader duration not working #22

Open pdkn opened 12 years ago

pdkn commented 12 years ago

hi Alex,

Trying to get the duration value using AudioFileReader wasn't working. I fixed it but amending the .h file with below and added an empty setDuration: method. @property (getter=getDuration, setter=setDuration:) float duration;

Also using your example code I was recording and saving audio to disk, then playing it back. On playback the fileReader.currentTime incremented from 0.0 up to 4.00000 seconds and then froze (even though the sound continued to loop) The fileReader.duration printed out as 4.655601. To stop the sound looping I was hope to do something like below

if(fileReader.currentTime >= fileReader.duration) { audioManager.outputBlock = nil; [fileWriter release]; }

any suggestions how this might be solved? Many Thanks

alexbw commented 12 years ago

Something's not right in the audiofilereader code. The writer seems pretty robust, but I've recently rewritten the reader for a project of mine. The complexity that's muddling everything up is the pre-buffering that the AudioFileReader is trying to do. What I did, that I'll probably fold into Novocaine, was to do away with prebuffering entirely, and simplify the reader's purpose to simply provide samples at a given file time. If you need prebuffering, you'll build it on your own, separately. So, wait for the update. Probably next week.

On Jul 12, 2012, at 1:08 PM, pdkn wrote:

hi Alex,

Trying to get the duration value using AudioFileReader wasn't working. I fixed it but amending the .h file with below and added an empty setDuration: method. @property (getter=getDuration, setter=setDuration:) float duration;

Also using your example code I was recording and saving audio to disk, then playing it back. On playback the fileReader.currentTime incremented from 0.0 up to 4.00000 seconds and then froze (even though the sound continued to loop) The fileReader.duration printed out as 4.655601. To stop the sound looping I was hope to do something like below

if(fileReader.currentTime >= fileReader.duration) { audioManager.outputBlock = nil; [fileWriter release]; }

any suggestions how this might be solved? Many Thanks


Reply to this email directly or view it on GitHub: https://github.com/alexbw/novocaine/issues/22

pdkn commented 12 years ago

Smashing, think I'll hold off and patiently wait for your update as in no rush ;) Don't need prebuffering either, Many Thanks ;)

ghost commented 11 years ago

Any news on this one? I'm trying to use the AudioFileReader and have some problems..

Thanks in advance.

stevemckenzie commented 11 years ago

@alexbw , can you please share with us your latest version of the reader?

alexbw commented 11 years ago

The code I have developed is not under the same license as Novocaine (code was refined for a consulting job awhile back), so it can't make it to this repo here. However, I'd gladly accept contributions from the community.

On Friday, May 31, 2013 at 4:12 PM, Steve McKenzie wrote:

@alexbw (https://github.com/alexbw) , can you please share with us your latest version of the reader?

— Reply to this email directly or view it on GitHub (https://github.com/alexbw/novocaine/issues/22#issuecomment-18768896).