From: StackOverflow Question:
import os
def memory_usage():
pid=os.getpid()
return next(line for line in open('/proc/%s/status'%pid).read().splitlines()
if line.startswith('VmSize')).split()[-2]"
Ideas and exploration about High performance computing and Computer science in general
Search This Blog
Wednesday, July 27, 2011
Thursday, July 14, 2011
How to decode Vorbis from a Webm audio stream
I had to decode audio in vorbis format from a webm file, here are some notes on what is involved in the process.
First of all you need to extract the AudioTrack from the WebM file.
Then from an AudioTrack Extract the privateData from it getPrivateData(size);
This PrivateData is the Header that libvorbis needs to initialize the internals of the VorbisDecoder
The VorbisDecoder needs 3 Ogg packets. This ogg packets have to be extracted from the PrivateData.
You have to unpack them as described in
Vorbis 3 Packets Specification (Xiph Laced format)
Then you are ready to follow the process described in :
Vorbis Decoding worflow
Pay attention that the internal buffer is limited so you have to call vorbis_synthesis_pcmout
after vorbis_synthesis_blockin. Always check for the return values of this functions.
The buffer returned by vorbis_synthesis_pcmout is in FLOAT32. To covert them to int16 you have to
multiply by 2 ** 15 - 1 and then clip them between - 2 ** 15 and 2 ** 15.
Pay attention to the number of channels as the data is stored as sample_ch1, sample_ch2, sample_ch1, sample_ch2.
Have fun !
First of all you need to extract the AudioTrack from the WebM file.
Then from an AudioTrack Extract the privateData from it getPrivateData(size);
This PrivateData is the Header that libvorbis needs to initialize the internals of the VorbisDecoder
The VorbisDecoder needs 3 Ogg packets. This ogg packets have to be extracted from the PrivateData.
You have to unpack them as described in
Vorbis 3 Packets Specification (Xiph Laced format)
Then you are ready to follow the process described in :
Vorbis Decoding worflow
Pay attention that the internal buffer is limited so you have to call vorbis_synthesis_pcmout
after vorbis_synthesis_blockin. Always check for the return values of this functions.
The buffer returned by vorbis_synthesis_pcmout is in FLOAT32. To covert them to int16 you have to
multiply by 2 ** 15 - 1 and then clip them between - 2 ** 15 and 2 ** 15.
Pay attention to the number of channels as the data is stored as sample_ch1, sample_ch2, sample_ch1, sample_ch2.
Have fun !
Wednesday, July 13, 2011
Git Command
# How to list git untracked files
javascript:void(0)
git ls-files --other --exclude-standard >> .gitignore
javascript:void(0)
git ls-files --other --exclude-standard >> .gitignore
Subscribe to:
Posts (Atom)