FluidSynth перестал работать в сценарии, но работах в ipython

Я начинаю тестировать использование fluidSyinth для создания файлов midi. Мой первый сценарий очень прост. Это отлично работает в ipython, но не как сценарий в командной строке, где это не делает ничего, никаких ошибок и никакого звука. Я использую python2.7 и в (ipython и в строка команды). Я использую человечность. Это - код:

#!/usr/bin/env python2.7
from mingus.midi import fluidsynth as c
import time

for i in range (0,100,1):
    c.play_Note(i,0,100)
    time.sleep(0.1)

Я решил протестировать fluidsynth непосредственно от строки команды в терминальном человечностью использовании

fluidsynth /usr/share/sounds/sf2/FluidR3_GM.sf2 mymusicfile.mid

и я получил это:

FluidSynth version 1.1.6
Copyright (C) 2000-2012 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of E-mu Systems, Inc.

Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
jackdmp 1.9.10
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2013 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
no message buffer overruns
no message buffer overruns
no message buffer overruns
JACK server starting in realtime mode with priority 10
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|44100|0|0|nomon|swmeter|-|32bit
configuring for 44100Hz, period = 1024 frames (23.2 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
Type 'help' for help topics.

> 

но файл midi не воспроизводится, не так ли?

Эта команда хорошо работает в терминале человечности:

fluidsynth -a alsa -m alsa_seq -l -i /usr/share/sounds/sf2/FluidR3_GM.sf2 mymusicfile.midi

но проблема остается в Python. Сценарий, который я скопировал в начале этого потока, хорошо работает в ipython, если я выполняю его как:

run script.py

однако это не работает, когда я выполняю его от терминала человечности на командной строке как:

python2.7 script.py

Я попробовал следующий сценарий, который также работает в ipython:

#!/usr/bin/env python2.7
import time
import fluidsynth

fs = fluidsynth.Synth()
fs.start()

sfid = fs.sfload("example.sf2")
fs.program_select(0, sfid, 0, 0)

fs.noteon(0, 60, 30)
fs.noteon(0, 67, 30)
fs.noteon(0, 76, 30)

time.sleep(1.0)

fs.noteoff(0, 60)
fs.noteoff(0, 67)
fs.noteoff(0, 76)

time.sleep(1.0)

fs.delete()

и я получаю следующий вывод, когда я выполняю его от терминала человечности:

Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.10
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2013 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
no message buffer overruns
no message buffer overruns
no message buffer overruns
JACK server starting in realtime mode with priority 10
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|44100|0|0|nomon|swmeter|-|32bit
configuring for 44100Hz, period = 1024 frames (23.2 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
JackTemporaryException : now quits...

хотя это не делает звука.

0
задан 5 November 2016 в 21:01

0 ответов

Другие вопросы по тегам:

Похожие вопросы: