Friday, December 16, 2011

Companding or Compandsion

Companding (compression and expansion of transfer data) can be found in many different
applications, especially in digital telephone systems. A digital telephone system converts an
analog speech signal to a digital signal. This digital signal is referred to as linear—meaning
without compression. Instead of transmitting this linear digital signal across the telephone
network, this digital signal is usually first compressed before being transmitted to reduce the
transmission bandwidth. The receiver needs to expand this non-linear, compressed signal back
to a linear digital signal. Companding refers to this combined process of compression and
expansion.
Two companding format for G.711 Audio are a law and u law.

Saturday, December 10, 2011

SoX raw audio data converter. wav to/from mulaw

Utility SoX (Sound Exchange)

Convert mulaw to wav:
    sox.exe -t ul input_mulaw_file output_wav_file


Convert wav to mulaw:
    sox.exe input_wav_file -r 8000 -c 1 -t ul output_mulaw_file

Thursday, November 24, 2011

Friday, November 11, 2011

Xcode build setting variables


For all the build setting variables, refers to http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html

To reference a build setting value in a build setting specification, use the name of the build setting surrounded by parentheses and prefixed by the dollar-sign character ($). For example, the specification of a build setting that refers to the value of the Product Name build setting could be similar to The name of this target's product is $(PRODUCT_NAME).

Friday, October 14, 2011

Prevent SIGPIPE from crashing the program

To do so, add following code to your program.
   signal( SIGPIPE, SIG_IGN ) ;

If debugging with GDB, GDB captures it and paused the process. To avoid this, run following command in gdb. For detailed information about handle, type "handle help" in gdb.
   handle SIGPIPE nostop print pass

Thursday, October 13, 2011

How to convert p12 files to pem files for Push Notification

Example: Development certificate
1. Download the certificate from iOS Provisioning Portal. Double click to install it.
2. Once installed, it should get listed in Certificates of Keychain Access.
3. Locate "Apple Development IOS Push Services:" and right click on it, select "Export xxx" and name it  dev-cert.p12 (leave the password blank for exporting)
4. Expand "Apple Development IOS Push Services:" to find the private key. Right click on it, select "Export xxx" and name it dev-key.p12 (leave the password blank for exporting)
5. Convert certificate to pem file format
   openssl pkcs12 -clcerts -nokeys -out dev-cert.pem -in dev-cert.p12
6. Convert private key to pem file format (password cannot be left blank, so key in 1234 and we will remove it in next step)
   openssl pkcs12 -nocerts -out dev-key-password.pem -in dev-key.p12
7.  To remove the password of dev-key-password.pem, run following command. (password will be asked, enter 1234 as we set in step 6)
  openssl rsa -in dev-key-password.pem -out dev-key.pem
8. Now we have both the certificate and private key (no password) converted in pem format.
9. That's it!

Monday, August 29, 2011

How to compile FFMPEG in 32 bit mode for Mac OS X

./configure --extra-cflags="-arch i386" --extra-ldflags='-arch i386' --arch=x86_32 --target-os=darwin --enable-cross-compile 

Check clients which connect to Mac OS X Wi-Fi Internet Sharing

arp -i bridge100 -a bridge100 may be different on your Mac OSX