Ejemplo n.º 1
0
    def __init__(
        self,
        session,
        header_format=HeaderFormat.AIFF,
        print_transcript=None,
        render_directory_path=None,
        sample_format=SampleFormat.INT24,
        sample_rate=44100,
        transcript_prefix=None,
    ):
        self._session = session

        self._header_format = HeaderFormat.from_expr(header_format)

        if print_transcript:
            print_transcript = bool(print_transcript)
        self._print_transcript = print_transcript

        self._render_directory_path = (pathlib.Path(
            render_directory_path
            or supriya.output_path).expanduser().absolute())

        self._sample_format = SampleFormat.from_expr(sample_format)

        self._sample_rate = int(sample_rate)

        transcript_prefix = transcript_prefix or None
        if transcript_prefix:
            transcript_prefix = str(transcript_prefix)
        self._transcript_prefix = transcript_prefix

        self._reset()
Ejemplo n.º 2
0
 def __init__(
     self,
     buffer_id=None,
     callback=None,
     file_path=None,
     frame_count=None,
     header_format="aiff",
     leave_open=False,
     sample_format="int24",
     starting_frame=None,
 ):
     Request.__init__(self)
     self._buffer_id = int(buffer_id)
     if callback is not None:
         assert isinstance(callback, (Request, RequestBundle))
     self._callback = callback
     self._file_path = str(file_path)
     if frame_count is None:
         frame_count = -1
     frame_count = int(frame_count)
     assert -1 <= frame_count
     self._frame_count = frame_count
     self._header_format = HeaderFormat.from_expr(header_format)
     self._leave_open = bool(leave_open)
     self._sample_format = SampleFormat.from_expr(sample_format)
     if starting_frame is None:
         starting_frame = 0
     starting_frame = int(starting_frame)
     assert 0 <= starting_frame
     self._starting_frame = starting_frame
Ejemplo n.º 3
0
    def __init__(
        self,
        session: "supriya.nonrealtime.sessions.Session",
        header_format: HeaderFormatLike = HeaderFormat.AIFF,
        print_transcript: bool = False,
        render_directory_path: Optional[PathLike] = None,
        sample_format: SampleFormatLike = SampleFormat.INT24,
        sample_rate: int = 44100,
        transcript_prefix: Optional[str] = None,
    ):
        self._session = session

        self._header_format = HeaderFormat.from_expr(header_format)

        if print_transcript:
            print_transcript = bool(print_transcript)
        self._print_transcript = print_transcript

        self._render_directory_path = (
            pathlib.Path(render_directory_path or supriya.output_path)
            .expanduser()
            .absolute()
        )

        self._sample_format = SampleFormat.from_expr(sample_format)

        self._sample_rate = int(sample_rate)

        transcript_prefix = transcript_prefix or None
        if transcript_prefix:
            transcript_prefix = str(transcript_prefix)
        self._transcript_prefix = transcript_prefix

        self._reset()
    def __init__(
        self,
        session,
        header_format=HeaderFormat.AIFF,
        print_transcript=None,
        render_directory_path=None,
        sample_format=SampleFormat.INT24,
        sample_rate=44100,
        transcript_prefix=None,
    ):
        self._session = session

        self._header_format = HeaderFormat.from_expr(header_format)

        if print_transcript:
            print_transcript = bool(print_transcript)
        self._print_transcript = print_transcript

        self._render_directory_path = (
            pathlib.Path(render_directory_path or supriya.output_path)
            .expanduser()
            .absolute()
        )

        self._sample_format = SampleFormat.from_expr(sample_format)

        self._sample_rate = int(sample_rate)

        transcript_prefix = transcript_prefix or None
        if transcript_prefix:
            transcript_prefix = str(transcript_prefix)
        self._transcript_prefix = transcript_prefix

        self._reset()
Ejemplo n.º 5
0
 def _build_render_command(
     self,
     output_filename,
     *,
     input_file_path=None,
     server_options=None,
     sample_rate=44100,
     header_format=HeaderFormat.AIFF,
     sample_format=SampleFormat.INT24,
     scsynth_path=None,
 ):
     server_options = server_options or scsynth.Options()
     scsynth_path = scsynth.find(scsynth_path)
     parts = [str(scsynth_path), "-N", "{}"]
     if input_file_path:
         parts.append(os.path.expanduser(input_file_path))
     else:
         parts.append("_")
     parts.append(os.path.expanduser(output_filename))
     parts.append(str(int(sample_rate)))
     header_format = HeaderFormat.from_expr(header_format)
     parts.append(header_format.name.lower())  # Must be lowercase.
     sample_format = SampleFormat.from_expr(sample_format)
     parts.append(sample_format.name.lower())  # Must be lowercase.
     server_options = server_options.as_options_string(realtime=False)
     if server_options:
         parts.append(server_options)
     command = " ".join(parts)
     return command
 def __init__(
     self,
     buffer_id=None,
     callback=None,
     file_path=None,
     frame_count=None,
     header_format="aiff",
     leave_open=False,
     sample_format="int24",
     starting_frame=None,
 ):
     Request.__init__(self)
     self._buffer_id = int(buffer_id)
     if callback is not None:
         assert isinstance(callback, (Request, RequestBundle))
     self._callback = callback
     self._file_path = str(file_path)
     if frame_count is None:
         frame_count = -1
     frame_count = int(frame_count)
     assert -1 <= frame_count
     self._frame_count = frame_count
     self._header_format = HeaderFormat.from_expr(header_format)
     self._leave_open = bool(leave_open)
     self._sample_format = SampleFormat.from_expr(sample_format)
     if starting_frame is None:
         starting_frame = 0
     starting_frame = int(starting_frame)
     assert 0 <= starting_frame
     self._starting_frame = starting_frame
 def _cache_properties(
     self, channel_count=None, header_format=None, sample_format=None
 ):
     if channel_count is None:
         channel_count = self.channel_count
     self._current_channel_count = channel_count
     if header_format is None:
         header_format = self.header_format
     self._current_header_format = HeaderFormat.from_expr(header_format)
     if sample_format is None:
         sample_format = self.sample_format
     self._current_sample_format = SampleFormat.from_expr(sample_format)
Ejemplo n.º 8
0
 def _cache_properties(self,
                       channel_count=None,
                       header_format=None,
                       sample_format=None):
     if channel_count is None:
         channel_count = self.channel_count
     self._current_channel_count = channel_count
     if header_format is None:
         header_format = self.header_format
     self._current_header_format = HeaderFormat.from_expr(header_format)
     if sample_format is None:
         sample_format = self.sample_format
     self._current_sample_format = SampleFormat.from_expr(sample_format)
 def sample_format(self, expr):
     sample_format = SampleFormat.from_expr(expr)
     self._sample_format = sample_format
Ejemplo n.º 10
0
 def sample_format(self, expr):
     sample_format = SampleFormat.from_expr(expr)
     self._sample_format = sample_format