![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Sep 2005
Posts: 3
Rep Power: 0
![]() |
Well, I will first mention that I am a Network Admin and not a programmer, although I am slowly but surely trying to break into that field.
Anyway, I will outline what I would like to do and hopefully someone can point me into the right direction (keep in mind i am a noob )Scenario: I have implemented a VoIP system in our call centre and we use IDEFisk. I have downloaded the latest which records calls. This works magnificently well. The recoded call gets stored as a uLAW audio format. I then have to convert that file to a WAV. No problem I found the program to do it; http://sox.sourceforge.net/. I can convert it and away we go. New Goal: To create a batch file that will ask for the user to input the uLAW file name (ie output.ul) that IDEFisk generates and also to ask the user for the name of the file to be created (ie kevin.wav), then run the sox command to convert it. The sox command runs like this: sox output.ul kevin.wav That simple. The reason I want to have this is becasue I won't be doing the recordings and want it to be as simple as can be for the girl that will be. Sample batch file look when executed: This file will convert blah blah blah blah blah blah Please enter the file to be converted: Please enter name for the new file: (here is where sox will run) And voila. So am I asking too much? Is this an easy 3 minute type job? I really appreciate any help. Even if someone has links so i can try to figure it out myself. Thanks again. Kevin |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
What Operating system do you want the file to run on? What interface do you want GUI or Command line? Are you looking for an executable(.exe) or for a batch(.sh, .bat).?
The core functionality is like you said quiet simple, we just need to more information. |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Sep 2005
Posts: 3
Rep Power: 0
![]() |
Thanks for the speedy reply!!
I would like it to be a batch file, i'll have a pause at the end. It'll also run on XP. Command line is fine. Anything else? Thanks in advance!!! Kevin |
|
|
|
|
|
#4 |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
Well, Win Xp doesn't allow user input from Batch files (it used to be done using "con").
You have two options: 1- If you have an interpreter(Python, Qbasic,...) I can easly write you a program that does the job and then write a batch file to run the program(makes it easier for the girl) 2- I can write you a program in C or C++ and give you the source as well as the executable (so you know that I'm not trying to hack you )Now I have some free time so I don't mind coding in either Qbasic or C++ but I'm rooting for option two because it is easier and it result in one file instead of two, what do you think? |
|
|
|
|
|
#5 |
|
Programming Guru
![]() |
Actually, if you use the SET command with the /p flag Windows XP does let you do input into batch files... so i'd suggest doing a simple script in BATCH to get it done. I *think* something like this will work...
echo This file will convert a uLAW audio file into a wav audio file. echo What is the input file? SET /p SOX_IN_FILE= echo What is the output file? SET /p SOX_OUT_FILE= SOX %SOX_IN_FILE% %SOX_OUT_FILE% echo File conversion done... please press any key to exit. Pause
__________________
|
|
|
|
|
|
#6 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
There's always WSH.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#7 |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
hmm... that must be a new flag, but it works fine. Here's a new and improved version based on tempest solution
@echo off if "%1" == "/?" goto usage if "%1" == "-?" goto usage echo Please enter the input file name (e.g. somefile.wav): set /p INFILE= echo Please enter the output file name (e.g. newfile.ul): set /p OUTFILE= if not exist %INFILE% goto ERROR 1 sox %OUTFILE% %INFILE% echo Done! goto end :USAGE echo. echo Converts a uLAW audio file to a WAV audio file. echo usage: convert output_file input_file echo. goto end :ERROR 1 ECHO "%INFILE%", file not found goto end :end pause |
|
|
|
|
|
#8 |
|
Programming Guru
![]() |
Nice changes OpenLoop, i hadn't seen enough bash to know some of the things you did in that... I think you got the input and output files switched on the sox command because of what cntc0de posted as one of the original arguments "output.ul" wasn't meant to be an output of sox but instead the program before sox that sox was manipulating an output file from...
sox %INFILE% %OUTFILE% Should fix the problem.
__________________
|
|
|
|
|
|
#9 |
|
Newbie
Join Date: Sep 2005
Posts: 3
Rep Power: 0
![]() |
Thank you all very much. Very very very appreciated. It is nice to be able to come to a place like this and get some wonderful help!! A1!!
I will try it on Sunday. I ahve to head out of town today. Again, thank you. Looking at the code, I think i was on the right track, just had the SET commands and a couple others in the wrong places. Again thanks. Kevin |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|