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 8012465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:20:24+00:00 2026-06-04T19:20:24+00:00

I have a bit of a problem : in an winForm app in VS2010

  • 0

I have a bit of a problem : in an winForm app in VS2010 win 7 compiling to x86, I try to do what Alvas.Audio seems to work. See (c# ex: http://alvas.net/alvas.audio,tips.aspx#tip94) for reference.

 Dim data() As Byte = wr.ReadData(second * i, second)

The result give me data.length()=0. I do not have any exception, I can read format from it and whatever reader I use I got this problem.

EDIT : After some tests, it seems like the uncompressed file I create in the first step (in PCM format, with .wav extension) can not be recognized by the Alvas.audio library for the second step. I must miss something around Audio file markups or something alike.

Here is the code that might be the source (basically this is step 1):

    Dim functOut As String = String.Empty
    Dim wr As Alvas.Audio.IAudioReader = Nothing
    Dim fs As IO.FileStream = Nothing
    Dim i As Integer = 0
    Dim tmpData() As Byte = Nothing
    Dim dataPCM() As Byte = Nothing
    Dim newFormat As IntPtr = IntPtr.Zero
    Try
        Select Case IO.Path.GetExtension(filename).ToLower()
            Case ".wav"
                wr = New Alvas.Audio.WaveReader(IO.File.OpenRead(filename))
                filename = IO.Path.GetTempPath & IO.Path.GetFileNameWithoutExtension(filename) & "2" & IO.Path.GetExtension(filename)
            Case ".mp3"
                wr = New Alvas.Audio.Mp3Reader(IO.File.OpenRead(filename))
            Case Else : wr = New Alvas.Audio.DsReader(filename)
        End Select

        functOut = IO.Path.ChangeExtension(filename, ".wav")

        Dim format As IntPtr = wr.ReadFormat()
        Dim formatDetail As Alvas.Audio.WaveFormat = Alvas.Audio.AudioCompressionManager.GetWaveFormat(format)


        If formatDetail.wFormatTag = Alvas.Audio.AudioCompressionManager.MpegLayer3FormatTag Then
            Alvas.Audio.AudioCompressionManager.Mp3ToWav(filename, functOut)
            Return True
        Else
            IO.File.Create(functOut).Close()
            While True
                tmpData = wr.ReadData(SECONDS * i, SECONDS)
                If tmpData Is Nothing Or tmpData.Length = 0 Then Exit While

                If formatDetail.wBitsPerSample < 16 Then
                    Alvas.Audio.AudioCompressionManager.ToPcm16Bit(format, tmpData, newFormat, dataPCM)
                Else 
                    newFormat = format
                    dataPCM = tmpData
                End If

                formatDetail = Alvas.Audio.AudioCompressionManager.GetWaveFormat(newFormat)

                fs = IO.File.Open(filename, IO.FileMode.Append, IO.FileAccess.Write)
                Using ww As New Alvas.Audio.WaveWriter(fs, Alvas.Audio.AudioCompressionManager.FormatBytes(newFormat))
                    ww.Write(dataPCM, 0, dataPCM.Length())
                End Using

                i += 1
                tmpData = Nothing
            End While
            Return True
        End If

        wr.Close()
    Catch ex As Exception
        filename = String.Empty
        Throw ex
    Finally
        fs.Close()
        wr.Close()
        filename = functOut
        GC.Collect()
    End Try

How can I write the resulted stream to be sure I can read it again later?

Any ideas will be great appreciated.

  • 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-04T19:20:25+00:00Added an answer on June 4, 2026 at 7:20 pm

    I found a solution.

    PCM files are headerless. So when saved, even with waveWriter and the line Alvas.Audio.AudioCompressionManager.FormatBytes(newFormat) was ignored.

    Two things can be done:

    • find a reader that recognize headerless files and allows to read from it.

    • refactor code to decode into PCM file and encode it into the new format (e.g .mp3) without writing the resulted file into File system (much better)

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

Sidebar

Related Questions

I have a bit of a strange problem. I am trying to send in-app
I have a bit of a weird problem. I developed an app with MVC
I have a bit of strange problem on this page: http://www.bluprintliving.com/locations it seems that
I have a bit of problem when trying to validate my page as HTML5.
I have a bit of a problem. I am trying to do the following
I have a bit of a problem building my project. I'm getting the bellow
I have a bit of a problem here. I have a third party ActiveX
I'm quite new to MediaWiki, and now I have a bit of a problem.
I have a bit of an architecture problem here. Say I have two tables,
I have a bit of a strange problem. I have a controller that is

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.