German unmögliches rauschen in wav datei.

jeng

Member
Licensed User
Longtime User
Hallo,

Hab da ein problem bei wav aufnahmen über microfon.
Wenn ich die datei auf dem Smartphone abspiele hört sich alles sauber an.
Wenn ich die Datei aber auf dem PC abspiele hab ich ein sehr starkes rauchen wenn nicht gesprochen wird.

Code hier aus dem Forum.

B4X:
Sub Recordbtn_Click
  
    'Stop.Enabled = True
    'pb.Initialize("pb")
 
    buffers.Clear
    output = StartWaveFile(ExtRoot & "/Music/rec/", "rec" & Datezeit & ".wav", SampleRate, mMono, mBitRate)
    recording = True
    isRecording = True
    streamer.StartRecording
    recordingStart = DateTime.Now
    Log("Record_Click SampleRate: "&SampleRate)
    Timer1.Enabled = True
 
    'btnPlay.Enabled = False

 
End Sub
Sub StartWaveFile(Dir As String, sFilename As String, sSampleRate As Int, Mono As Boolean _
        , BitsPerSample As Int) As OutputStream
    'File.Delete(Dir, FileName)
    Dim raf As RandomAccessFile
    raf.Initialize2(Dir, sFilename, False, True)
    raf.WriteBytes("RIFF".GetBytes("ASCII"), 0, 4, raf.CurrentPosition)
    raf.CurrentPosition = 8 'skip 4 bytes for the size
    raf.WriteBytes("WAVE".GetBytes("ASCII"),0, 4, raf.CurrentPosition)
    raf.WriteBytes("fmt ".GetBytes("ASCII"),0, 4, raf.CurrentPosition)
    raf.WriteInt(16, raf.CurrentPosition)
    raf.WriteShort(1, raf.CurrentPosition)
    Dim numberOfChannels As Int
    If Mono Then numberOfChannels = 1 Else numberOfChannels = 2
    raf.WriteShort(numberOfChannels, raf.CurrentPosition)
    raf.WriteInt(sSampleRate, raf.CurrentPosition)
    raf.WriteInt(sSampleRate * numberOfChannels * BitsPerSample / 8, raf.CurrentPosition)
    raf.WriteShort(numberOfChannels * BitsPerSample / 8, raf.CurrentPosition)
    raf.WriteShort(BitsPerSample, raf.CurrentPosition)
    raf.WriteBytes("data".GetBytes("ASCII"),0, 4, raf.CurrentPosition)
    raf.WriteInt(0, raf.CurrentPosition)
    raf.Close
    Log("StartWaveFile: "&sSampleRate)
    Return File.OpenOutput(Dir, sFilename, True)
 
End Sub

Sub CloseWaveFile(Dir As String, cFilename As String)
    Dim raf As RandomAccessFile
    raf.Initialize2(Dir, cFilename, False, True)
    raf.WriteInt(raf.Size - 8, 4)
    raf.WriteInt(raf.Size - 44, 40)
    raf.Close
    FillScrollView(path1)
End Sub


Hier mal ne test wav.
 
Last edited:
Top