Csound

Translate jird music into a Csound score.

For more information on Csound see the Csound website.

Primary functions

csound_score(music, f0, t0)[source]

Build Csound score representing music with multiple parts.

Parameters:
  • music (Piece) – Music to represent.

  • f0 (float) – Base frequency in Hz.

  • t0 (float) – Base time unit in seconds.

Returns:

Csound representation of music.

Return type:

str

write_csound_score(music, f0, t0, output_path)[source]

Write Csound score representing music to a file.

Parameters:
  • music (Piece) – Music to represent.

  • f0 (float) – Base frequency in Hz.

  • t0 (float) – Base time unit in seconds.

  • output_path (str or Path) – Filename for writing output.

Helper functions

csound_chord(chord, f0, t0, t, instrument)[source]

Build Csound score representation of chord.

Parameters:
  • chord (Chord) – Chord to represent.

  • f0 (float) – Base frequency in Hz.

  • t0 (float) – Base time unit in seconds.

  • t (float) – Start time of the chord in seconds.

  • instrument (int) – Csound instrument number to use for this chord.

Returns:

First element is list of Csound lines to play the notes in chord. Second element is the duration of chord in seconds.

Return type:

(list of str, float)

csound_part(part, f0, t0, instrument)[source]

Build Csound score representing music with one part.

Parameters:
  • part (Part) – Music to represent.

  • f0 (float) – Base frequency in Hz.

  • t0 (float) – Base time unit in seconds.

  • instrument (int) – Csound instrument number to use for this part.

Returns:

Csound representation of music.

Return type:

str