Exemple #1
0
 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))
Exemple #2
0
    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))
Exemple #3
0
    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))
Exemple #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)
Exemple #5
0
 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))
Exemple #6
0
 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))
Exemple #7
0
 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))
Exemple #8
0
 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))
Exemple #9
0
 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))