/ Data / Fundamentals / Production / Tutorials / Software / Home
2.2.2 File Conversion: Converting SPHERE Files to Raw Format
Section 2.2.2: File Conversion

You must follow two critical steps to convert speech files from a SPHERE to a raw format. In preparation for this step, you will need to download and install the NIST SPHERE software. For this conversion process, we will use the tools w_decode and h_strip contained in this package.

For our example, we will convert the audio file speech.sph from SPHERE to raw format.

  1. Go to the directory:

      $ISIP_TUTORIAL/sections/s02/s02_02_p02/

  2. Convert the SPHERE file's binary data to 16-bit linear samples using w_decode as shown in the following syntax:

         w_decode -o pcm speech.sph speech-nb.sph

  3. Strip the file's header using h_strip with the following syntax:

          h_strip speech-nb.sph speech.raw
The new file is now in raw format and should be identical to speech.raw. Note that the only difference between these two files is that the raw file is missing the first 1024-bytes of the SPHERE file. As explained previously, the first 1024 bytes in a SPHERE file contain header information.
Section 2.2.2: File Conversion
To avoid intermediate files (e.g., speech-nb.sph in the example above), the commands can be piped. You may use Unix pipes to create one command for file conversion rather than typing three different commands. The syntax below shows the use of the Unix pipe symbol "|" to achieve this:

      w_decode -o pcm speech.sph - | h_strip - - > speech.raw

Notice that the two commands, w_decode and h_strip, now reside in one command. The resulting file produced by each command becomes the input for the command which follows the "|" symbol. We typically add the downsampling process, described in Section 2.3.1 to this pipe so that we can strip the header and downsample the data, all in one command with no intermediate files.
   
Table of Contents   Section Contents   Previous Page Up Next Page
      Glossary / Help / Support / Site Map / Contact Us / ISIP Home