Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 23rd, 2005, 12:36 PM   #1
cntc0de1
Newbie
 
Join Date: Sep 2005
Posts: 3
Rep Power: 0 cntc0de1 is on a distinguished road
Talking I am sure someone will get this quickly ...

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
cntc0de1 is offline   Reply With Quote
Old Sep 23rd, 2005, 2:22 PM   #2
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
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.
OpenLoop is offline   Reply With Quote
Old Sep 23rd, 2005, 2:47 PM   #3
cntc0de1
Newbie
 
Join Date: Sep 2005
Posts: 3
Rep Power: 0 cntc0de1 is on a distinguished road
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
cntc0de1 is offline   Reply With Quote
Old Sep 23rd, 2005, 4:42 PM   #4
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
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?
OpenLoop is offline   Reply With Quote
Old Sep 23rd, 2005, 4:59 PM   #5
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
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
__________________

tempest is offline   Reply With Quote
Old Sep 23rd, 2005, 5:07 PM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Sep 23rd, 2005, 5:21 PM   #7
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
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
OpenLoop is offline   Reply With Quote
Old Sep 23rd, 2005, 8:37 PM   #8
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
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.
__________________

tempest is offline   Reply With Quote
Old Sep 24th, 2005, 7:42 AM   #9
cntc0de1
Newbie
 
Join Date: Sep 2005
Posts: 3
Rep Power: 0 cntc0de1 is on a distinguished road
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
cntc0de1 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:43 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC