Recorder

[ ]:
import sc3nb as scn
[ ]:
sc = scn.startup()
[ ]:
help(scn.Recorder)

Recording sound into a file

[ ]:
# use the Recording class to capture the output
recorder = scn.Recorder(path="my_record.wav")

with sc.server.bundler() as bundler:
    recorder.start(0.1)
    # /s_new synth name, node id, add action (0 to head), target (1 default group), synth arguments...
    scn.Synth("s1", {"freq": 200, "dur": 1})
    bundler.wait(0.3)
    scn.Synth("s1", {"freq": 300, "dur": 1})
    recorder.stop(1.5)
  • note that the sorting in scsynth node tree is with ‘at begin’ rule

  • otherwise the rendered tones would be rendered after the outbus was written to file resulting in an empty file.

  • the file is located in the same folder as this .ipynb file.

[ ]:
sc.exit()
[ ]: