title: Record audio segments without data loss between each new recording
body: <p>I have this sample code from the sounddevice library, the code creates a temporary file and through the callback a queue is filled and its elements are sent to the temporary file so that while the program runs, an ogg file will be generated with all the data that the microphone captures, my question is how can I make this program, for example, make recordings with a certain time, for example every 5 minutes without loss data for  the  execution of save? I try with soundfile.rec with a for loop but I have a loss of 0.05s of data between each new recording, my goal is to have no loss, what is the best way?</p>
  <pre><code>q = queue.Queue()
  def callback(indata, frames, time, status):
      q.put(indata.copy())
  
  try:
      
      args.filename = tempfile.mktemp(prefix='audio_r',suffix='.ogg', dir='')
  
      with sf.SoundFile(args.filename, mode='w', samplerate=44100,channels=1) as file:
          with sd.InputStream(samplerate=44100, device=args.device,channels=1, callback=callback, blocksize=1024):
              while True:
                  file.write(q.get())
                
                      
  except KeyboardInterrupt:
      parser.exit(0)
  </code></pre>