Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
There is a article in here that has a class that puts a wrapper around "Lame.exe" so you can use Lame to convert .wav files to .mp3. It works great, but I cannot seem to get it to loop through a directory and convert all files in that directory. Does anyone know how to do it with this method, or have another way of doing it?
Posted

1 solution

The write a loop that goes through all the separate files in the directory and convert them one by one:
http://msdn.microsoft.com/en-us/library/bb513869.aspx[^]

The example code is in C# but you could easily convert it to VB.
 
Share this answer
 
Comments
iismoove 11-Aug-12 14:56pm    
Thanks! I am looking through it now. Sorry, I am new at software development and have not worked with recursion that much. But it looks like this may be what i need.(if i can figure out how to code it).
Kenneth Haugland 11-Aug-12 14:59pm    
This could perhaps make it easyer for you:
http://www.developerfusion.com/tools/convert/csharp-to-vb/
iismoove 11-Aug-12 15:28pm    
Yea, i did convert it to VB. I am going to try it in about 10 minutes......I will let you know how I make out.
iismoove 12-Aug-12 11:12am    
Ok, so I have it going through the folder and getting each folder name. I am using LameSHell from Qualtar. I guess with Lame, you have to loop through it with a DO LOOP. Because when I do just a FOR EACH, it just converts the first file. When I do a DO UNTIL, it goes through but hangs up the program. Maybe you can take a look at my code?

Private Sub btnConvert_Click(sender As System.Object, e As System.EventArgs) Handles btnConvert.Click
Dim cNumber As ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles("C:\Temp")
Dim count As Integer = CInt(cNumber.Count)
Dim index As Integer = 1
Dim c As Integer = 0
Dim oPath = "C:\Temp\"
Dim dInfo As New DirectoryInfo(oPath)
Dim fArr As FileInfo() = dInfo.GetFiles()
Dim fri As FileInfo

Do
For Each fri In fArr
index += 1
Dim sfname = GetFileName(oPath + fri.Name)
ConvertFiles(oPath + sfname + ".wav", "C:\_ConvertedFiles\" + sfname + ".mp3")
lblConverted.Text = c + 1
Next fri
Loop Until index = count
iismoove 12-Aug-12 20:45pm    
I figured it out. I noticed that I was NOT starting a new instance of the converter in my converter function.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900