convert WAV to ALAC - iphone

Can we convert from WAV format to apple's ALAC audio recording format ?

See the ConvertFile sample project: http://developer.apple.com/mac/library/samplecode/ConvertFile/Introduction/Intro.html

Related

Flutter Audio Recorder Plugin records M4A as WAV file

When trying to extract a section of audio using FFMPEG I discovered that the .M4A file I thought was recorded by Flutter Audio Recorder was actually being recorded as a WAV file. Here's what FFMPEG reports;
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from 'myaudio.m4a':
Duration: 00:00:04.02, bitrate: 705 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
I'm guessing it's because I've boosted the sample rate in Flutter Audio recorder up from the default 16K to 44K in order to achieve higher quality.
_recorder = FlutterAudioRecorder(customPath, audioFormat: AudioFormat.AAC, sampleRate: 44100);
So does the 44K boost mean I lose the benefit of the AAC compression and its smaller file size?
Here's a sample of the M4A file recorded by Flutter Audio Recorder;
https://speaktestbucket.s3.us-east-2.amazonaws.com/63-talk-87.m4a
Here's the actual Flutter Audio Recorder plugin I'm using;
https://github.com/meghead/flutter_audio_recorder2
Which is a fork of;
https://github.com/hanyska/flutter_audio_recorder2
Which is itself a fork of the original Flutter Audio Recorder;
https://github.com/rmbrone/flutter_audio_recorder
Looks like there is a fork of rmbones' Flutter_Audio_Recorder which records a properly encoded M4A file.
https://github.com/hnvn/flutter_audio_recorder
Some of the dependencies were out of date so I ended up forking hnvn's fork with an updated pubspec.yaml;
https://github.com/meghead/flutter_audio_recorder
The resulting short file is an impressive 8.2k in size.
https://speaktestbucket.s3.us-east-2.amazonaws.com/290-628.m4a

What kind of encoder is suitable for AVIREAD in Matlab?

I have a raw video (no header, just Y-channel).
I want do some denoise algorithm on this video.
I convert this raw video by useing ffmpeg with several encoders.
But fail to open with function AVIREAD.
Error using aviread, Unable to locate decompressor to decompress video stream
r210 Uncompressed RGB 10-bit
v210 Uncompressed 4:2:2 10-bit
v308 Uncompressed packed 4:4:4
v410 Uncompressed 4:4:4 10-bit
y41p Uncompressed YUV 4:1:1 12-bit
yuv4 Uncompressed packed 4:2:0
mjpeg MJPEG (Motion JPEG)
ffmpeg -f rawvideo -vcodec rawvideo -s 1920x1080 -r 25 -pix_fmt gray -i WKA00002.y -c:v v308 WKA00002_UnCompAVI.avi
What kind of encoder is suitable for AVIREAD in Matlab?
Thanks a lot
AVIREAD has been removed from the latest versions of MATLAB. Use VIDEOREADER instead.
Motion JPEG AVI is supported by VideoReader.
if you want to try other formats, first check that the file can be opened using Windows Media Player? If so, use VideoReader to try and read the file. If this does not work, can you provide a link to the file that you are using?
Hope this helps.
Dinesh

How to change caf High quality(sample rate) to caf Low quality(sample rate)

I'm using AVAudioRecorder. I record the audio in caf format with 44100 sample rate. It recorded successfully. After recording I want to convert already recorded caf audio file with 11025 and 22050 sample rate. Is it possible to change high to low & medium sample rate.
As of iOS 6, AVAudioSession can take that input and can likely convert it via this method:
setPreferredSampleRate: error:.

How to get headless raw audio data from iPhone's mic into NSData

I need to record 3 sec of headles raw audio data: PCM 11025 samples per second, 16 bit mono and then send it as base64 encoded string.
With AVAudioRecorder I can record .CAf file and access it at any time, but the question is: how can I get headless raw audio data from recorded file into NSData object?
Thanks!

PCM to WAV file

I am using
http://www.subfurther.com/blog/2010/12/13/from-ipod-library-to-pcm-samples-in-far-fewer-steps-than-were-previously-necessary/
to convert m4a file to caf, i was try to look in the setting of the export and didn't find way to convert it to wav instead.
there is a way to convert the caf to wav? there is a more good way to convert m4a to wav?
Sorry if i am quite late to the party. Though i am answering and sharing my knowledge on this issue if it helps anyone.
Converting caf file to wav file isn't too hard. caf and wav both format contains raw PCM data, the only difference is their header info. So if you just replace caf header with wav then it will do the tricks. Just get the PCM data from the caf file and add the wav header on top of the extracted PCM data. To add wav header with PCM data, check this link.
peek at the AudioFile and ExtAudioFile APIs (in AudioToolbox).