Question

This problem is solved

My task:
I have a .sph file with the following file-header:

NIST_1A
1024
conversation_id -s4 2001
database_id -s25 Switchboard-1_release-2.0
channel_count -i 1
sample_coding -s4 ulaw
channels_interleaved -s4 TRUE
sample_count -i 2018387
sample_rate -i 8000
sample_n_bytes -i 1
sample_sig_bits -i 8
end_head

I want to transfer the above file to a .sph file without encoded and without the channels_interleaved behavior, so that I will have a file header look like this:

NIST_1A
1024
conversation_id -s4 2001
database_id -s25 Switchboard-1_release-2.0
channel_count -i 1
sample_count -i 2018387
sample_rate -i 8000
sample_coding -s4 pcm
sample_n_bytes -i 2
sample_sig_bits -i 16
end_head

My method:
sph2pipe -c 1 -p input output

Was it helpful?

Solution

To convert sph file to wav format with sph2pipe use

sph2pipe -f rif file.sph file.wav

To convert file with SOX use

sox file.sph file.wav

although complex compression methods like shorten might not be supported. For your particular file it will work fine:

HTK can handle such files perfectly too, for details see the section 5.11.4 NIST File Format in HTKBook. You need to configure SOURCEFORMAT=NIST in config file. For switchboard specifically you also need to split channels with STEREOMODE set to LEFT or RIGHT.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top