Skip to content

save("sound.wav", buf) seems to write with the wrong samplerate #84

@anandijain

Description

@anandijain
using PortAudio, SampledSignals, LibSndFile, FileIO, Test
devs = PortAudio.devices()
mic = PortAudioStream("MacBook Pro Microphone", 1, 0)
buf = read(mic, 2s)
close(mic)
save("data/grooovin2.wav", buf)
w, sr = wavread("data/grooovin2.wav")
@test buf.samplerate == 48000
@test sr == 8000

WAV.jl is able to write it fine. I haven't dug in to locate the issue though

env info

(SipSynth) pkg> st
     Project SipSynth v0.1.0
      Status `~/.julia/dev/SipSynth/Project.toml`
  [5789e2e9] FileIO v1.11.1
  [b13ce0c6] LibSndFile v2.4.0
  [f57c4921] MIDI v2.0.2
  [80ea8bcb] PortAudio v1.1.2
  [003e8c73] RtMIDI v0.1.0 `../RtMIDI#main`
  [bd7594eb] SampledSignals v2.1.2
  [2d7b7beb] libportaudio_jll v19.7.0+0 `https://github.com/anandijain/libportaudio_jll.jl#main`
  [5bf562c0] libsndfile_jll v1.0.31+0 `https://github.com/anandijain/libsndfile_jll.jl#main`

julia> versioninfo()
Julia Version 1.7.0-rc1
Commit 9eade6195e (2021-09-12 06:45 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin20.5.0)
  CPU: Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, cyclone)
Environment:
  JULIA_NUM_THREADS = 8

see JuliaAudio/PortAudio.jl#88

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions