syedhali / EZAudio

An iOS and macOS audio visualization framework built upon Core Audio useful for anyone doing real-time, low-latency audio processing and visualizations.
Other
4.94k stars 822 forks source link

Recorded file duration is negative #286

Closed Dino4674 closed 8 years ago

Dino4674 commented 8 years ago

Hi Syed,

great library first of all. I run through examples and they are pretty straight forward.

But I am having difficulties trying to replicate record+play example. I literally copy/pasted code from "RecordFile" example and I get crash when I try to payback.

I can see in logs that generated audio file has length set to negative:

Play: <EZAudioFile: 0x1546d5150> {
    url: file:///var/mobile/Containers/Data/Application/11F3F419-0614-4214-A3AE-3726C542F7C4/Documents/test.m4a,
    duration: -0.047868,
    totalFrames: -2111,
    metadata: {
    "approximate duration in seconds" = "-0.048";
},
    fileFormat: { 
Sample Rate:            44100,
Format ID:                 aac ,
Format Flags:                 0,
Bytes per Packet:             0,
Frames per Packet:         1024,
Bytes per Frame:              0,
Channels per Frame:           1,
Bits per Channel:             0,
IsInterleaved:       1,
IsFloat:             0, },
    clientFormat: { 
Sample Rate:            44100,
Format ID:                 lpcm,
Format Flags:                21,
Bytes per Packet:             4,
Frames per Packet:            1,
Bytes per Frame:              4,
Channels per Frame:           2,
Bits per Channel:            32,
IsInterleaved:       0,
IsFloat:             1, } 
}

Error: Failed to read audio data from file (-66567)

Any ideas why is this happening?

I did all the setup in viewDidLoad like in the example.

Dino4674 commented 8 years ago

I am stupid stupid stupid. After 4 hours of trying I opened this issue and then I realized I did not set self.isRecording in my app. Thats what you get with c/p coding :) Closing this