Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET mp3
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 11-Aug-12 7:48am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
iismoove at 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 at 11-Aug-12 14:59pm
   
This could perhaps make it easyer for you:
http://www.developerfusion.com/tools/convert/csharp-to-vb/
iismoove at 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 at 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 at 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)



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 11 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100