Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to find the length or Time of the WAV file will be played using VC++

how to find the length or Time of the WAV file will be played using VC++

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shiva shankar
    wrote on last edited by
    #1

    I want to find the length or Time of the wav file played, please can any one help me out with the code to find the Time for which wav file will be played..

    S D 2 Replies Last reply
    0
    • S shiva shankar

      I want to find the length or Time of the wav file played, please can any one help me out with the code to find the Time for which wav file will be played..

      S Offline
      S Offline
      Sivaji
      wrote on last edited by
      #2

      Hi it's very simple. Total Length of Play=Toatal No of samples/Sampling rate sec

      1 Reply Last reply
      0
      • S shiva shankar

        I want to find the length or Time of the wav file played, please can any one help me out with the code to find the Time for which wav file will be played..

        D Offline
        D Offline
        DavidR_r
        wrote on last edited by
        #3

        Wav file is divide to chunks This is the chank format: ---------------------------------- 'RIFF' 4 bytes size 4 bytes (ulong) 'WAVE' 4 bytes 'fmt ' 4 bytes size 4 bytes (ulong) 14 bytes 2 bytes (PCM) 'data' 4 bytes size 4 bytes (ulong) N bytes ---------------------------------- the format of field is as follows: wFormatTag, ushort nChannels, ushort nSamplesPerSec, ulong nAvgBytesPerSec, ulong nBlockAlign, ushort Using this data and the previous snder reply you can calculater the duration of the wav file DavidR

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups