Results 1 to 6 of 6

Thread: wave editor

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    8

    wave editor

    i have a wave editor but i cant do a cut and paste...could someone help me....
    Attached Files Attached Files

  2. #2
    Frenzied Member Shawn N's Avatar
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    1,631
    All you have on this form is a dialog box and some menus.

    VB Code:
    1. 'WavEditor
    2. 'by: Paul Bryan in 2002
    3. 'Allows for graphical isolation of sample ranges
    4. 'will Paste Selected Data Into New Files
    5. ' I hope this helps, feel free to re-use this code.
    6.  
    7. Private Sub mnuAbout_Click()
    8.     frmAbout.Show , Me
    9. End Sub
    10.  
    11. Private Sub mnuOpenItem_Click()
    12.     CommonDialog1.Filter = "Wave Files (*.wav)|*.wav"
    13.     CommonDialog1.CancelError = True
    14.     On Error GoTo Errhandler
    15.     CommonDialog1.ShowOpen
    16.     If CommonDialog1.FileName <> "" Then
    17.         MousePointer = 11 'hourglass
    18.         LoadNewFile (CommonDialog1.FileName)
    19.         MousePointer = 0
    20.         Exit Sub
    21.     End If
    22. Errhandler:
    23.     Exit Sub
    24.  
    25. End Sub
    26.  
    27. Private Sub mnuExitItem_Click()
    28.     End
    29. End Sub

    What is anyone supposed to do with this?! What do you mean you want to cut & paste? Can we get some elaboration?
    Please rate my post.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    8
    im sorry this is the complete file. my prob is this...i want the user to select a certain part and then cut and paste it into the same file. just like the nero wave editor...please help...thanks shawn
    Attached Files Attached Files

  4. #4
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    Use a temporary file...

    Get the selection (in samples) not in bytes, and calculate the starting position in the file, and the end position. Using a temporary file copy the data into it.
    Then you have to make another temporary file but this time a real wav file, copy the data in front of where you wanna paste, then copy the data from the first temporary file, then copy the data after the pasted data... then you can delete the first temp file and the original file (or you can keep it as an undo).

    Also, as a sugestion, take a look at this thread I posted in the CodeBank:
    VB - DirectXSound - An app that plays large WAV files
    I see you want to add effects to the file, using DirectXSound, you can, and also you can play the file appliying the cut and paste information without actually doing it, you just read from the file randomly. You can do it as a preview before you actually make changes to the file.
    For example, lets say you want to delete a part of the file, you can store the positions somwhere from where to where you don't want to play (the deleted part). When you play the file, when you get to the starting position, just jump in the file to the end of the deleted part, to the user it sounds as if that part was actually deleted.

    There are a lot of things you can do dinamically, by playing the file the way I did in that thread, you can amplify the waveform data, add echo, all in the temporary buffer, just before you play it without actually changing the original file.

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    8
    i have here a code to paste a selection intoa new file my problem is how will i paste it to the same file..could you help me in my codes?

    Private Sub Command5_Click() ' Paste as New File
    Dim FTemp As String
    Dim InData As Long, LenData As Long
    Dim InDataSel As Long, LenDataSel As Long
    Dim SampIni As Long, BytInic As Long
    Dim Nbits As Integer, StMo As String
    Dim ydiv As Integer, SampFreq As Long
    If MMCPart = False Or Label8.Caption = "" Then
    Picture2.SetFocus
    Exit Sub
    End If
    If Label16(4).Caption = "" Then
    msg = "No Selection Made!"
    MsgBox msg, vbOKOnly
    Exit Sub
    End If
    MousePointer = vbHourglass ' Busy
    Picture2.SetFocus
    FTemp = App.Path & "\Untitled" & SCount + 1 & ".wav"

    InData = Label11.Caption
    SampIni = Label16(4).Caption ' Selection Begins
    ydiv = Label12.Caption ' FileSize in Bytes
    BytInic = SampIni * ydiv ' Location in the Wav of the Visible Selection
    InDataSel = InData + BytInic
    LenDataSel = Label16(6).Caption 'Selection Length in Samples
    SampFreq = Label8.Caption ' Sampling Frequency
    StMo = Label9.Caption ' Stereo Mono
    Nbits = Val(Label10.Caption) ' Sampling Bits

    Open CurFile For Binary Access Read As #1

    Call SaveWave(FTemp, InDataSel, LenDataSel, SampFreq, Nbits, StMo)

    Close #1

    LoadNewFile (FTemp)
    MousePointer = 0 ' Arrow
    End Sub


    thanks....

  6. #6
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    Use [ vbcode ] [ /vbcode ] (without spaces) to format the code properly, now you have it all aligned to left...

    About pasting into the same file... did you read my previous post ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width