コード例 #1
0
ファイル: audio.py プロジェクト: robbert-harms/musical-games
 def convert(self, midi_fname, wav_fname):
     ensure_dir_exists(wav_fname)
     run_command('fluidsynth -g {gain} -F {wav} {soundfont} {midi}'.format(
         wav=wav_fname,
         soundfont=self._sound_font,
         midi=midi_fname,
         gain=self.gain * 10))
コード例 #2
0
ファイル: audio.py プロジェクト: robbert-harms/musical-games
    def convert(self, midi_fname, wav_fname):
        ensure_dir_exists(wav_fname)

        with tempfile.NamedTemporaryFile('w') as tmp_file:
            tmp_file.write('soundfont {}'.format(self._sound_font))
            tmp_file.flush()
            run_command('timidity -c {config} --output-24bit -A120 -Ow -o {wav} {midi}'.format(
                config=tmp_file.name, wav=wav_fname, midi=midi_fname))
コード例 #3
0
ファイル: audio.py プロジェクト: robbert-harms/musical-games
    def convert(self, midi_fname, wav_fname):
        ensure_dir_exists(wav_fname)

        with tempfile.NamedTemporaryFile('w') as tmp_file:
            tmp_file.write('soundfont {}'.format(self._sound_font))
            tmp_file.flush()
            run_command(
                'timidity -c {config} --output-24bit -A120 -Ow -o {wav} {midi}'
                .format(config=tmp_file.name, wav=wav_fname, midi=midi_fname))
コード例 #4
0
def concatenate_images(output_fname, image_list):
    """Append all the given files to each other in the order given.

    Args:
        output_fname (str): the output filename
        image_list (list of str): the filenames of the images to append
    """
    if not bash_function_exists('convert'):
        raise RuntimeError('The function convert does not exists, please install ImageMagick or some similar tool.')

    ensure_dir_exists(output_fname)
    command = ['convert', '-append']
    command.extend(image_list)
    command.append(output_fname)
    run_command(command)
コード例 #5
0
ファイル: audio.py プロジェクト: robbert-harms/musical-games
 def convert(self, midi_fname, wav_fname):
     ensure_dir_exists(wav_fname)
     run_command('fluidsynth -g {gain} -F {wav} {soundfont} {midi}'.format(
         wav=wav_fname, soundfont=self._sound_font, midi=midi_fname, gain=self.gain * 10))
コード例 #6
0
ファイル: audio.py プロジェクト: robbert-harms/musical-games
 def to_ogg(self, wav_fname, output_fname):
     ensure_dir_exists(output_fname)
     remove_file_if_exists(output_fname)
     run_command('{command} -i {wav} -acodec libvorbis {ogg}'.format(
         command=self.command_name, wav=wav_fname, ogg=output_fname))
コード例 #7
0
ファイル: audio.py プロジェクト: robbert-harms/musical-games
 def to_mp3(self, wav_fname, output_fname):
     ensure_dir_exists(output_fname)
     remove_file_if_exists(output_fname)
     run_command('{command} -i {wav} -vn -ar 44100 -ac 2 -ab 192k -f mp3 {mp3}'.format(
         command=self.command_name, wav=wav_fname, mp3=output_fname))
コード例 #8
0
ファイル: audio.py プロジェクト: robbert-harms/musical-games
 def to_ogg(self, wav_fname, output_fname):
     ensure_dir_exists(output_fname)
     remove_file_if_exists(output_fname)
     run_command('{command} -i {wav} -acodec libvorbis {ogg}'.format(
         command=self.command_name, wav=wav_fname, ogg=output_fname))
コード例 #9
0
ファイル: audio.py プロジェクト: robbert-harms/musical-games
 def to_mp3(self, wav_fname, output_fname):
     ensure_dir_exists(output_fname)
     remove_file_if_exists(output_fname)
     run_command(
         '{command} -i {wav} -vn -ar 44100 -ac 2 -ab 192k -f mp3 {mp3}'.
         format(command=self.command_name, wav=wav_fname, mp3=output_fname))