bastibe / SoundCard

A Pure-Python Real-Time Audio Library
https://soundcard.readthedocs.io
BSD 3-Clause "New" or "Revised" License
680 stars 69 forks source link

first record results in float64, subsequent in float32 #62

Closed ipelupessy closed 4 years ago

ipelupessy commented 5 years ago

the following

import soundcard

mics=soundcard.all_microphones()
mic=mics[1]
with mic.recorder(samplerate=48000, blocksize=4096, channels=1) as m:
  data=m.record(1024)
  print(data.dtype)
  data=m.record(1024)
  print(data.dtype)
  data=m.record(1024)
  print(data.dtype)

gives as output:

float64
float32
float32

while expected is:

float32
float32
float32
ipelupessy commented 5 years ago

I forgot to mention, this is on linux

gonzalocasas commented 5 years ago

I can confirm this behavior on Ubuntu 16.04

bastibe commented 4 years ago

Thank you for your bug report! That is some interesting behavior.

Would you like to investigate its cause? Any help would be greatly appreciated, as I don't have much time to work on this at the moment.

gonzalocasas commented 4 years ago

@bastibe I could perhaps help but I wouldn't know how to go about diagnosing this. If you give me some hints, I could test, since we have a fully reproducible setup.

bastibe commented 4 years ago

Never mind, it turns out the error was trivial. The latest commit should fix it.

gonzalocasas commented 4 years ago

I think this can be closed, right?

ipelupessy commented 4 years ago

think so too