Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8593167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:55:38+00:00 2026-06-11T23:55:38+00:00

EDIT: Solved in self-answer below. I’ve looked all over but I can’t find anything

  • 0

EDIT: Solved in self-answer below.

I’ve looked all over but I can’t find anything useful for playing audio files with volume control.
I tried XNA; SLIMDX and "Microsoft.VisualBasic.Devices.Audio" but nothing helped.
The options I found which had volume control were too complex and I couldn’t figure out how to use, and the method I have currently doesn’t let you do anything more than play(background with or without loop, or pause execution until end of play) and stop.

Here’s my current code:

Dim AD As New Microsoft.VisualBasic.Devices.Audio
   Sub Play()
        Dim af() As Byte = IO.File.ReadAllBytes("music.wav")
        AD.Play(af, AudioPlayMode.BackgroundLoop)
   End Sub

This loops "music.wav" in the background, but i cannot pause/seek it or control the volume. Is there any simple way(like the above) to play audio files from a buffer and control the audio volume? I’ve looked all over but nothing I’ve found works for my project.

System: Win7 64-bit

VS version: 2010

Language: VB.net

Oh one more thing, buffering the audio first is something I need for my solution as well(as you can see in my current code)

Does anyone have a solution to this? 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:55:39+00:00Added an answer on June 11, 2026 at 11:55 pm

    I found the answer after a bit of searching around so here’s the solution I found for my question:

    Download Naudio and add the references to your project.

    Then the following code is how to use it for loading audio from a buffer:

    Dim Wave1 As New NAudio.Wave.WaveOut 'Wave out device for playing the sound
    
    Dim xa() As Byte = IO.File.ReadAllBytes("C:\YourPath\YourWave.wav") 'Your Buffer
    
    Sub PlaySound()
    
            Dim data As New IO.MemoryStream(xa) 'Data stream for the buffer
    
            Wave1.Init(New NAudio.Wave.BlockAlignReductionStream(NAudio.Wave.WaveFormatConversionStream.CreatePcmStream(New NAudio.Wave.WaveFileReader(data))))
    
            Wave1.Volume = 0.1 'Sets the Volume to 10%
    
            Wave1.Play()
    
    End Sub
    

    WaveFileReader can be changed to whichever reader you need(i.e. the MP3 one for “.mp3” files) to load your audio file, but the code works as-is for loading “.wav” files.

    oh and also, don’t forget to

    WaveOut.Dispose()
    

    when you’re done to avoid errors.

    I hope my research helps somebody 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: solved, look below for my solution. first of all, this is my very
[EDIT: Problem solved. Please see my answer below.] In my app I call the
Answer solved in edit below I had this piece of code Dictionary<Merchant, int> remaingCards
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
EDIT: SOLVED! answer below first code box When i try to connect with a
edit: Solved - mod_rewrite was the problem I can't get CI to work as
Sorry if this question may be simple, but I can't seem to find an
Edit: [Solved] : It seems that the getTableCellRendererComponent of the CustomTableCellRenderer is called every
Edit: Solved. Hi, I'm starting with Qt, I try to connect a slot to
EDIT: SOLVED Thanks Brooks. Your question led me to keep digging into if the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.