[NumPy-Tickets] [NumPy] #2212: Add the 24 bit support in numpy.fromstring

NumPy Trac numpy-tickets@scipy....
Wed Sep 5 14:47:24 CDT 2012


#2212: Add the 24 bit support in numpy.fromstring
-------------------------------+--------------------------------------------
 Reporter:  bred               |       Owner:  somebody   
     Type:  enhancement        |      Status:  new        
 Priority:  normal             |   Milestone:  Unscheduled
Component:  numpy.core         |     Version:  1.6.2      
 Keywords:  24 bit fromstring  |  
-------------------------------+--------------------------------------------
 In some real world applications, like audio or image processing should be
 possible that data in organized in words of 24 bit.

 So would be useful to have an efficient 24bit string decoder.

 Actually the situation is a bit depressing, for example if we read a 24bit
 audio file, we generate a string that is very difficult and slow to be
 reeded.

 For example the code should look like ... :


 {{{
 import wave

 wave_read = wave.open( file_name , 'r' )
 sample_width = wave_read.getsampwidth()
 # sample_width == 3 !!!!

 X = wave_read.readframes( wave_read.getnframes() )
 Y = numpy.fromstring(X, dtype="int24" ).reshape( nframes , 2 )
 }}}



 If the sample width is 3 (24bit) this very simple procedure don't work.


 Tnx

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2212>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list