How to play audios in HPC
Prof Steen installed Sox for us. Sox is a powerful tool for audio editting. However, for some reasons I didn’t know, I couldn’t use Sox in my image, but I can use it on my local computer. Prof Steen advised me to use netcat. This method didn’t solve the problem directly, but it’s efficient.
Netcat is a featured networking utility which reads and writes data across network connections, using the TCP/IP protocol. You can transfer all the audios to my computers and I found it really helpful for I don’t need to edit text in cluster. I can edit all the texts and transfer back to HPC. It’s less time-comsuming because there are often delays in cluster and sometimes my connection will automatically break in an hour.
Finally, this is my way to solve the problem, and I can play the audio in my local computer.
How to use netcat to transfer the whole directory
Suppose that A is going to transfer files to B.
Firstly, B starts the listening
nc -l port | tar xfvz -
Notice that defining a new folder is not accepted. You might as well create a folder first.
Secondly, A starts packing all files under the current directory and sending to B
tar cfz - * |nc IPaddress Port
Use Chrome to play the audio
Qibin told us this method. It’s simple and convenient.
Firstly,start the server
python -m SimpleHTTPServer
Secondly,open Chrome and input hpclogin.case.edu:8000
And you can access to the directory and play the audio by Chrome.
One problem is that it needs uploading. A ten-second audio needs 10 seconds to upload and it’s definitely not a good experience.
If you want to check one or two audios, it’s best to use Chrome. But if you need to check all the audios like me, transfering to local is the best choice.
Combining audios
Also use SOX to combine audios.
In terminal
sox file1.wav file2.wav file3.wav output.wav
In python
import sox
cbn=sox.Combiner()
cbn.build(['file1.wav','file2.wav','file3.wav'],'output.wav','concatenate')