Audio format for iOS and Android

Android and iOS use the same server to storage records. All records are saved without any extension. When Android downloads a record from the server, my app adds an “.aac” extension. When using iOS, it adds an “.m4a” extension. The same record plays good on both mobile platforms. Record on iOS: NSDictionary recorderSettings = [[NSDictionary … Read more

How to generate the AAC ADTS elementary stream with Android MediaCodec

I finally generated AAC files that are playable on both the Android device and the Windows host computer. I am posting my solution here, hoping it could help others. First, my previous assumption that the Android MediaCodec encoder generates the elementary AAC stream was not accurate. The MediaCodec encoder generates the raw AAC stream. That’s … Read more

Stream audio to a phone call Android

Writing to the phone call stream IS possible, but not from the app level on a stock (non rooted) phone. When a phone call is initiated the mic is “typically” (really depends on the specific phone) routed directly to the baseband, ie skipping the main processor altogether. For outgoing audio: mic->codec->baseband For incoming audio: baseband->codec->speaker … Read more

How to split a .wav file into multiple .wav files?

This is a python code snippet that I use for splitting files as per necessity. I use the pydub library from https://github.com/jiaaro/pydub. You can modify the snippet to suit your requirement. from pydub import AudioSegment t1 = t1 * 1000 #Works in milliseconds t2 = t2 * 1000 newAudio = AudioSegment.from_wav(“oldSong.wav”) newAudio = newAudio[t1:t2] newAudio.export(‘newSong.wav’, … Read more

Python: Making a beep noise

On Windows, if you want to just make the computer make a beep sound: import winsound frequency = 2500 # Set Frequency To 2500 Hertz duration = 1000 # Set Duration To 1000 ms == 1 second winsound.Beep(frequency, duration) The winsound.Beep() can be used wherever you want the beep to occur.