Closed idroxid closed 11 years ago
I just run the sample code (File writing) with Xcode 4 and a iPad mini 6.3.1, same problem.
Hi @idroxid
I think the issue is that the file being written is never finalized, which only happens when calling stop
on the file writer or when the file writer instance is deallocated.
Since your code appears to be writing directly to the file writer, like in the example, at some point you need to either explicitly call stop
or dispose of the file writer instance to get it to actually finalize the file, at which point you won't be able to write to it anymore. That behavior is a bit weird, but that's how it works when you write directly to the file writer.
The other option would be to write data from the input block to the ring buffer, then implement a writer callback block on the file writer that reads new data from the ring buffer and writes it to the file. In that configuration you can use record
and stop
on the file writer instance to perform the recording.
@alexbw if any of this is wrong feel free to correct me.
Sorry I've been so silent on the issue. The audio file writers and readers are the least supported aspect of Novocaine, originally included as a bit of sugar. It makes sense to me that they're the part of the codebase getting the most comment.
Nick's comments sound correct to me.
On Mon, Sep 9, 2013 at 2:27 PM, Nick D. notifications@github.com wrote:
Hi @idroxid https://github.com/idroxid
I think the issue is that the file being written is never finalized, which only happens when calling stop on the file writer or when the file writer instance is deallocated.
Since your code appears to be writing directly to the file writer, like in the example, at some point you need to either explicitly call stop or dispose of the file writer instance to get it to actually finalize the file, at which point you won't be able to write to it anymore. That behavior is a bit weird, but that's how it works when you write directly to the file writer.
The other option would be to write data from the input block to the ring buffer, then implement a writer callback block on the file writer that reads new data from the ring buffer and writes it to the file. In that configuration you can use record and stop on the file writer instance to perform the recording.
@alexbw https://github.com/alexbw if any of this is wrong feel free to correct me.
— Reply to this email directly or view it on GitHubhttps://github.com/alexbw/novocaine/issues/59#issuecomment-24102574 .
Hi @ndonald2 Thank you for your message ! It works :) So, I just did add the declaration of the stop method to AudioFileWriter.h and just call
[self.fileWriter stop];
when I need it. It's woking perfectly ! Thank you @ndonald2 , and thank you @alexbw for this awesome lib !!!
Hi I am able to record and save audio file to documents directory, but when trying to play the file is not playing on iOS Devices, however its playing in VLC and iTunes.
Can anyone suggest me what I am doing wrong ?
Thanks,
Hi, I'm trying to use novocaine in order to record some audio from the mic and to write this audio to a m4a file.
The file is created, but it's not readable. The contents of the file looks like:
There is a lot of NULL values, and the file doesn't play in any player.
My first idea was the microphone was not working, but I tried to copy/paste your example (the one who shows the decibel levels) and I got a lot of values (from -50 to -10). I assume this is what we expect. So, the microphone is working.
Then, I tried to run your sample project itself and uncommented the code for:// AUDIO FILE WRITING YEAH! and got the same problem, the MyRecording.m4a is created, but doesn't play in any player.
I'm using Xcode 5 DP5, an iPhone5 on iOS7 beta-5 and a iPad mini on iOS6.1.3. The problem is the same on each device.
Ho, yes, and the log when I init the audio is:
If you can help, it would be very appreciated :)