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. Visual Basic
  4. Playing Wave files with the Audio routines?

Playing Wave files with the Audio routines?

Scheduled Pinned Locked Moved Visual Basic
sharepointhelpquestion
2 Posts 1 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.
  • T Offline
    T Offline
    TheComputerMan
    wrote on last edited by
    #1

    Hi, does anyone one know what sort of wave header the My.Computer.Audio Play routines require? I am creating wave files with a basic standard header, which play fine in Windows Media Player, Audacity, VLC etc, but as soon as I try to play them in the program using Play, it says the header is corrupt. These are very low sample rate files. Could that have something to do with it? They are often as low as 600 Hz (Sound files of seismic activity). They are PCM 16 bit uncompressed. The help (VB/MSDN and various other sources) gives very little detail, and anyway details of wave files seems to be difficult to come by unless you are takling music/stereo/44000 sample rate etc. Still working my way trough 13,600 entries on MSDN but nothing relevant sp far!

    T 1 Reply Last reply
    0
    • T TheComputerMan

      Hi, does anyone one know what sort of wave header the My.Computer.Audio Play routines require? I am creating wave files with a basic standard header, which play fine in Windows Media Player, Audacity, VLC etc, but as soon as I try to play them in the program using Play, it says the header is corrupt. These are very low sample rate files. Could that have something to do with it? They are often as low as 600 Hz (Sound files of seismic activity). They are PCM 16 bit uncompressed. The help (VB/MSDN and various other sources) gives very little detail, and anyway details of wave files seems to be difficult to come by unless you are takling music/stereo/44000 sample rate etc. Still working my way trough 13,600 entries on MSDN but nothing relevant sp far!

      T Offline
      T Offline
      TheComputerMan
      wrote on last edited by
      #2

      Sorry, jumped the gun. I found the answer. Seems to be a bug you can get round with: Private player As New System.Media.SoundPlayer() Public Sub PlaySound(ByVal sound As Stream) sound.Position = 0 ' Manually rewind stream player.Stream = Nothing ' Then we have to set stream to null player.Stream = sound ' And set it again, to force it to be loaded again... player.Play() ' Yes! We can play the sound! End Sub Apparently when you use the Audio Play it starts the end of the stream for some reason.

      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