I have problems encoding AAC/M4A audio files on iPhone (iOS) and in simulator in a way so that
mono/stereo and
the track duration
are recognized correctly by external players like VLC.
For closing in on the problems on various devices, I have written code which generates test files for various encoding configurations. The encoded sound is a generated sine wave which is identical all the time. This works nicely. In the next step, I do a binary comparison of these test files which were generated on different divices and in the simulator. To my surprise, the .m4a files are never identical (the aac files are identical all the time). I use the ExtAudioFile...() methods for writing the files and I use the file type identifier kAudioFileM4AType.
I suspect that there is a timestamp included in these files which confuses my binary comparison.
Can anybody confirm or refute that there is a timestamp in M4A files, which will always confuse a binary comparison?
M4A is a container format, and would almost certainly contain some metadata. It's very likely some of this metadata is different from one encoding to another, as you suspect.
You might do better writing some kind of algorithm to see if your M4A file contains a byte stream that matches the AAC data you have. One way to approach this would be to compare both files (M4A and AAC with same raw sound data) manually in a Hex editor and try to find the offset where the AAC data begins and/or ends, and then just compare that data.
Related
I realized that my GoPro videos are very large and that I can compress them by around 80% by loading the video in Quicktime and exporting the video in the 1080p format.
I found this automation for my problem: applescript to batch export with quicktime pro
Unfortunately, I use to batch rename my video files according to the date & time taken (e.g. "2022-10-12, 15.24.13.mp4"). For the compressed video file, the creation & modification timestamp is not copied from the original file.
Any idea, how I can keep the original creation & modification timestamp for the compressed file? Or copy the creation & modification timestampe later from the original file into the compressed file? Maybe it helps that the files are named similarly except that the extension changes from "mp4" to "mov".
Thanks a lot in advance for any help!
I am recording audio file. It is recorded with .caf extension.
How can I convert this format into .mp3 format?
There is a open source project lame . The challenge would be making it work for iphone. This would give a direction towards cross compiling for ios.
There is also an iOSMp3Recorder available on GIT and one another example
Record and audio conversion in internet.
I hope above examples may help you.
Using Lame, you can do this. Ther is no default function for this. It will also reduce the file size also. For 60 second audio file .caf will take approx 5mb - 10mb but after converting to .mp3 it will take 0.6mb to 0.7mb. Set 'Enable Bitcode' to 'NO' in build setting for new xocde, otherwise you will get error.
For sample code use this LINK.
I have 3000 small sized audio files in my iphone project. File sizes are generally between 1kb and 50kb. I copied all files to one directory and I can play them. To decrease project size what should I do? What about compressing files to a zip file and then unzip on iphone for the first run? Is there any way to combine all of these files and play from one file? What is the ideal solution?
If your files are mp3s, there is little chance that you could make them smaller by compressing them. Indeed, mp3 is a format that allows you to obtain very high compression rates.
What you could do is reducing the encoding, and you could get a substantial gain. E.g., if your files are 256kbps, you could go to 192, or 128... another option that would provide a huge advantage is converting the file to a mono audio file.
I am not saying that all this could be done sensibly for your app, they are just options.
In any case, I would not be too much worried at the 20MB, and you can surely keep all of those files in the resource directory of the app.
I am doing a lot of DSP work on iOS
So frequently I need to dump a file of raw floats, and pick it up in something like Audacity, to look at the waveform.
Even working on the simulator, this is a PITA. I need to log the destination folder to console, open up Finder, CTRL+CMD+G, paste the destination folder, drag drop all of the files onto the desktop, open up Audacity, import them one by one manually correcting the format.
( Why can't I just point Audacity to the right folder once? because the iPhone simulator stores its data somewhere hideously deeply nested that involves a hidden folder, so I can't see it with the audacity file browser )
( Why is the format wrong? Because audacity tries to figure out the most likely format, and if my data starts off random which it often does, it will invariably get it wrong )
However, working on the device, I can't even see a way to get at these files.
What are my options? I am looking for maximum automation, as I do this typically hundreds of times in a particular job.
I am looking for a good gem/plugin to convert user-uploaded audio files to different formats. One format in particular that I am interested in is converting to Apple .caf with ima4 compression for inclusion in an iPhone app.
I have been using afconvert on my mac for this so far, but I need to do it on my linux box, server-side. Ideally, I would be able to work into paperclip.
As an additional solution, ffmpeg could work, but I have not seen any .caf options for it. Anybody know of one?
The Sound eXchange project supports lots of audio file conversions. I've used this in the past to convert aiff files output by the OS X "say" program to ulaw files for Asterisk. This yields rather nice text-to-speech. For my purposes, I also found a Ruby extension on github called sox-ruby that wraps the libsox functions directly.