Announcement

Collapse
No announcement yet.

Decoding MP3 to WAV

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Decoding MP3 to WAV

    Any means to do this simply?

    Overall, I got every part of this project together except that right now, to decode the MP3's, I'm having to execute a bat file which calls on LAME to preform the decoding. I would like to dispense with that step and be able to call on the decoder directly so that the process does not have to execute a waiting for something outside to finish pause.

    Overall project:
    Load schedule to generate the filelist.
    Scan the source folder for each file in the list.
    * Convert each file in the source folder matching a name from the list to WAV.
    Tagging each WAV after conversion with CART headers.
    Move each converted file from the source to destination folder.

    Bonus:
    Code:
    Public Type MYCARTPOSTTIME
        FourCc              As Long
        TimerValue          As Long
    End Type
    
    Public Type MYCARTHEADERS
        Version             As String * 4
        Title               As String * 64
        Artist              As String * 64
        CutId               As String * 64
        ClientId            As String * 64
        Category            As String * 64
        Classification      As String * 64
        OutCue              As String * 64
        StartDate           As String * 10
        StartTime           As String * 8
        EndDate             As String * 10
        EndTime             As String * 8
        ProducerAppId       As String * 64
        ProducerAppVersion  As String * 64
        UserDefinedText     As String * 64
        ZeroDbReference     As Long
        PostTime(7)         As MYCARTPOSTTIME
        Reserved            As String * 276
    End Type
    Code:
    Public Type MYWAVECHUNKHEAD
        chunkname   As String * 4
        offset      As Long
    End Type
    
    Public Type MYWAVEFILEHEAD
        magic       As String * 4
        filesize    As Long
        chunkname   As String * 4
    End Type
    Code:
    Public Function WriteCartHeaders(FileName As String, CartHead As MYCARTHEADERS) As Boolean
    Dim WaveHead As MYWAVEFILEHEAD, RiffChunk As MYWAVECHUNKHEAD, OldHead As MYWAVEFILEHEAD
    Dim FileInOut As Long
    On Error GoTo Whoops
        FileInOut = FreeFile
        Open FileName For Binary As FileInOut
        Get FileInOut, , WaveHead
        Close FileInOut
        OldHead = WaveHead
        WaveHead.filesize = WaveHead.filesize + Len(RiffChunk) + Len(CartHead)
        RiffChunk.chunkname = "cart"
        RiffChunk.offset = Len(CartHead)
        Open FileName For Binary As FileInOut
        Put FileInOut, , WaveHead
        Seek #FileInOut, OldHead.filesize + 1 + Len(RiffChunk)
        Put FileInOut, , RiffChunk
        Put FileInOut, , CartHead
    Whoops:
        Close
        If Err.Number = 0 Then
            WriteCartHeaders = True
        Else
            WriteCartHeaders = False
        End If
    End Function
    If the code looks odd, it's because it's currently running from an Excel Workbook.
    Furcadia, an interesting online MMORPG in which you can create and program your own content.
Working...
X