Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to avoid empty frames in the beginning of a recording? #156

Open
kflak opened this issue Dec 8, 2024 · 2 comments
Open

How to avoid empty frames in the beginning of a recording? #156

kflak opened this issue Dec 8, 2024 · 2 comments

Comments

@kflak
Copy link

kflak commented Dec 8, 2024

Following the README I have written these functions to record and stop recording from the main output:

(defparameter *disk-writer* ())
(defparameter *rec-buffer* ())

(defun start-recording (path &optional (num-channels 2))
  (defsynth disk-writer ((out-buf-num 99))
    (disk-out.ar out-buf-num (in.ar 0 num-channels)))
  (setf *rec-buffer* (buffer-alloc (expt 2 18) :chanls num-channels))
  (setf *disk-writer* (synth 'disk-writer))
  (ctrl *disk-writer* :out-buf-num (bufnum *rec-buffer*))
  (buffer-write *rec-buffer* path :leave-open-p t))

(defun stop-recording ()
  (free *disk-writer*)
  (buffer-close *rec-buffer*)
  (buffer-free *rec-buffer*))

This works as expected, except that I get (expt 2 18) frames of silence before the actual recording begins. Is there a way to make the disk-writing start from the beginning, or would there be a way to automatically chop off the silence in the beginning? Luckily it seems to be a predictable amount, so should be able to solve this programmatically, possibly even using an external utility like sox... Of course, I'd prefer to get it right without tampering with the files afterwards.

@defaultxr
Copy link
Contributor

Perhaps related to supercollider/supercollider#77 ?

@byulparan
Copy link
Owner

If identical sclang code exhibits the same symptoms, it's likely a SuperCollider issue and cannot be resolved here. If time allows, I will quickly test it in sclang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants