audio package¶
Submodules¶
asound module¶
Detect and configure sound devices, control volume.
- exception AS2Error(*args)[ソース]¶
ベースクラス:
Exception
Exceptions sent out from errcheck func.
- パラメータ:
args (object) --
- 戻り値の型:
None
- class SND_MIXER_SELEM_CHANNEL_ID_T(value)[ソース]¶
ベースクラス:
IntEnum
An enumeration.
- FRONT_CENTER = 4¶
- FRONT_LEFT = 0¶
- FRONT_RIGHT = 1¶
- LAST = 31¶
- MONO = 0¶
- REAR_CENTER = 8¶
- REAR_LEFT = 2¶
- REAR_RIGHT = 3¶
- SIDE_LEFT = 6¶
- SIDE_RIGHT = 7¶
- UNKNOWN = -1¶
- WOOFER = 5¶
- get_volume(devicename, idname)[ソース]¶
Get volume.
- パラメータ:
devicename (str) -- devicename
idname (str) -- idname
- 戻り値:
volume[%]
- 戻り値の型:
int
- list_name_hint()[ソース]¶
Save the name hints table to a file.
- 変数:
f (path-like) -- "docs/alsa-namehint.md"
- 戻り値の型:
None
iface
NAME
DECS
IOID
ctl
pulse
None
None
- mixer_device()[ソース]¶
Returns information on available mixer devices.
- 戻り値:
[device name, device idname, control name, control idname, name]
- Examples:
["hw:CARD=Headphones", "PCM", "default", "Master", "Headphones"]
- Examples:
["", "", "", "", ""] if not found.
- 戻り値の型:
list[str]
- set_volume(devicename, idname, value)[ソース]¶
Set volume.
- パラメータ:
devicename (str) -- devicename
idname (str) -- idname
value (int) -- volume[%] to be set
- 戻り値:
volume[%]
- 戻り値の型:
int
- start_jackserver()[ソース]¶
Start JACK server.
- 戻り値:
[device name, device idname, control name, control idname, name]
- Examples:
["hw:CARD=Headphones", "PCM", "default", "Master", "Headphones"]
- Examples:
["", "", "", "", ""] if Not registered.
- Todo:
Connect to Headphones after Bluetooth device disconnects.
- 戻り値の型:
list[str]
btaudiosink module¶
Assists in connecting to Bluetooth device.
fluidsynth module¶
Piano playing practice with MIDI keyboard.
Use this module from Kivy as a separate thread.
Module 'concurrent.futures.ThreadPoolExecutor' is recommended.
- referrence:
- exception FSError(*args)[ソース]¶
ベースクラス:
Exception
Exceptions sent out from errcheck func.
- パラメータ:
args (object) --
- 戻り値の型:
None
- FLUID_EVENT_CALLBACK_T¶
Event callback function prototype for destination clients.
- パラメータ:
time (c_uint) -- Current sequencer tick value
event (c_void_p) -- The event being received
seq (c_void_p) -- The sequencer instance
data (POINTER(EventUserData)) -- User defined data registered with the client
- class FLUID_HINT(value)[ソース]¶
ベースクラス:
IntFlag
An enumeration.
- BOUNDED_ABOVE = 2¶
- BOUNDED_BELOW = 1¶
- ON_OFF = 7¶
- RANGE = 3¶
- TOGGLED = 4¶
- FLUID_LOG_FUNCTION_T¶
Log function handler callback type used by fluid_set_log_function()
- パラメータ:
level (c_int) --
message (c_char_p) --
data (POINTER(LogUserData)) --
- class FLUID_LOG_LEVEL(value)[ソース]¶
ベースクラス:
IntEnum
An enumeration.
- DBG = 4¶
- ERR = 1¶
- INFO = 3¶
- LAST_LOG_LEVEL = 5¶
- PANIC = 0¶
- WARN = 2¶
- class FLUID_MIDI_ROUTER_RULE_TYPE(value)[ソース]¶
ベースクラス:
IntEnum
An enumeration.
- CC = 1¶
- CHANNEL_PRESSURE = 4¶
- COUNT = 6¶
- KEY_PRESSURE = 5¶
- NOTE = 0¶
- PITCH_BEND = 3¶
- PROG_CHANGER = 2¶
- class FLUID_PLAYER_SET_TEMPO_TYEP(value)[ソース]¶
ベースクラス:
IntEnum
An enumeration.
- EXTERNAL_BPM = 1¶
- EXTERNAL_MIDI = 2¶
- INTERNAL = 0¶
- class FLUID_PLAYER_STATUS(value)[ソース]¶
ベースクラス:
IntEnum
An enumeration.
- DONE = 2¶
- PLAYING = 1¶
- READY = 0¶
- FLUID_SETTINGS_FOREACH_OPTION_T¶
Callback function type used with fluid_settings_foreach_option()
- パラメータ:
data (c_void_p) --
name (c_char_p) --
option (c_char_p) --
- FLUID_SETTINGS_FOREACH_T¶
Callback function type used with fluid_settings_foreach()
- パラメータ:
data (c_void_p) --
name (c_char_p) --
type (c_int) --
- class FLUID_TYPE(value)[ソース]¶
ベースクラス:
IntEnum
An enumeration.
- INT = 1¶
- NO = -1¶
- NUM = 0¶
- SET = 3¶
- STR = 2¶
- HANDLE_MIDI_EVENT_FUNC_T¶
Generic callback function prototype for MIDI event handler.
- パラメータ:
data (c_void_p) --
event (c_void_p) --
- 戻り値:
- class MidiDriver(**kwargs)[ソース]¶
ベースクラス:
MidiRouter
Sends MIDI events received at the MIDI input to the synthesizer.
- パラメータ:
kwargs (dict) -- kwargs = { 'settings':'config/settings.json', 'soundfont':['sf2/FluidR3_GM.sf2', 'sf2/SGM-V2.01.sf2'], 'handler': fluid_midi_dump_prerouter}
- class MidiPlayer(**kwargs)[ソース]¶
ベースクラス:
MidiRouter
Parse standard MIDI files and emit MIDI events.
- パラメータ:
kwargs (dict) -- kwargs = { "settings":"config/settings.json", "soundfont":["sf2/FluidR3_GM.sf2", "sf2/SGM-V2.01.sf2"], "handler": fluid_midi_dump_prerouter, "standardmidifile": ["mid/SenBonZakura.mid", "mid/111867.MID"]}
- playback(start_tick=0)[ソース]¶
Start playback.
- パラメータ:
start_tick (int) -- tick at the position where you want to start
- 戻り値の型:
None
- property tick: int¶
Get the number of tempo ticks passed.
- property total_ticks: int¶
Get total ticks.
- class MidiRouter(**kwargs)[ソース]¶
ベースクラス:
Synthesizer
Rule based transformation and filtering of MIDI events.
- パラメータ:
kwargs (dict) -- kwargs = { 'settings':'config/settings.json', 'soundfont':['sf2/FluidR3_GM.sf2', 'sf2/SGM-V2.01.sf2']}
- class Sequencer(**kwargs)[ソース]¶
ベースクラス:
Synthesizer
Send MIDI events scheduled by the sequencer to the synthesizer.
- パラメータ:
kwargs (dict) -- kwargs = { 'settings':'config/settings.json', 'soundfont':['sf2/FluidR3_GM.sf2', 'sf2/SGM-V2.01.sf2']}
- client_name(id)[ソース]¶
client_name _summary_
- パラメータ:
id (int) -- _description_
- 戻り値:
_description_
- 戻り値の型:
str
- note_at(ticks, channel, key_number, velocity, duration, source=-1, destination=-1, absolute=True)[ソース]¶
note_at _summary_
- パラメータ:
ticks (int) -- _description_
channel (int) -- _description_
key_number (int) -- _description_
velocity (int) -- _description_
duration (int) -- _description_
source (int) -- _description_, defaults to -1
destination (int) -- _description_, defaults to -1
absolute (bool) -- _description_, defaults to True
- 戻り値の型:
None
- register_client(name, callback=None, data=None)[ソース]¶
Register a sequencer client.
- パラメータ:
name (str) -- Name of sequencer client
callback (Callable) -- Sequencer client callback or NULL for a source client.
data (EventUserData) -- User data to pass to the callback
- 戻り値:
Unique sequencer ID or FLUID_FAILED on error
- 戻り値の型:
int
- timer_at(ticks, data=None, source=-1, destination=-1, absolute=True)[ソース]¶
timer_at _summary_
- パラメータ:
ticks (int) -- _description_
data (EventUserData | None) -- _description_, defaults to None
source (int) -- _description_, defaults to -1
destination (int) -- _description_, defaults to -1
absolute (bool) -- _description_, defaults to True
data --
- 戻り値の型:
None
- property bps: float¶
Number of quarternotes per second
- clients: list[int] = []¶
- property tick: int¶
current tick of the sequencer scaled by the time scale currently set
- property time_scale: float¶
Ticks per second
- class Synthesizer(**kwargs)[ソース]¶
ベースクラス:
object
SoundFont synthesizer.
- パラメータ:
kwargs (dict) -- kwargs = { 'settings':'config/settings.json', 'soundfont':['sf2/FluidR3_GM.sf2', 'sf2/SGM-V2.01.sf2']}
- channels_preset()[ソース]¶
Get a list of presets per channel
- 戻り値:
preset list
- 戻り値の型:
list[dict[str, Union[int, str, NoneType]]]
- PRESET(dict)
"name": str | None
"num" : int | None
"bank": int | None
"sfont_id": int | None
- expression(chan, val)[ソース]¶
Temporary velocity can be set above volume.
- パラメータ:
chan (int) -- _description_
val (int) -- _description_
- 戻り値:
_description_
- 戻り値の型:
int
- gm_sound_set()[ソース]¶
Get list of Sound Set (GM system level 1) from soundfont.
- 戻り値:
gm sound set - list[list[PRESET]]
- 戻り値:
gm percussion sound set - list[list[PRESET]]
- 戻り値の型:
tuple
- soundfont
- bank
- PRESET(dict)
"name": str | None
"num" : int | None
"bank": int | None
"sfont_id": int | None
- modulation_wheel(chan, val)[ソース]¶
The sound amplifies like vibrato.
- パラメータ:
chan (int) -- _description_
val (int) -- _description_
- 戻り値:
_description_
- 戻り値の型:
int
- note_off(channel, keyNumber)[ソース]¶
note_off _summary_
- パラメータ:
channel (int) -- _description_
keyNumber (int) -- _description_
- 戻り値:
_description_
- 戻り値の型:
int
- note_on(channel, keyNumber, velocity)[ソース]¶
note_on _summary_
- パラメータ:
channel (int) -- _description_
keyNumber (int) -- _description_
velocity (int) -- _description_
- 戻り値:
_description_
- 戻り値の型:
int
- pan(chan, val)[ソース]¶
pan _summary_
- パラメータ:
chan (int) -- _description_
val (int) -- _description_
- 戻り値:
_description_
- 戻り値の型:
int
- pitch_bend(chan, val)[ソース]¶
pitch_bend _summary_
- パラメータ:
chan (int) -- _description_
val (int) -- _description_
- 戻り値:
_description_
- 戻り値の型:
int
- pitch_wheel_sens(chan, val)[ソース]¶
pitch_wheel_sens _summary_
- パラメータ:
chan (int) -- _description_
val (int) -- _description_
- 戻り値:
_description_
- 戻り値の型:
int
- program_select(chan, sfont_id, bank, preset)[ソース]¶
program_select _summary_
- パラメータ:
chan (int) -- _description_
sfont_id (int) -- _description_
bank (int) -- _description_
preset (int) -- _description_
- 戻り値:
_description_
- 戻り値の型:
int
- sustain_off(chan)[ソース]¶
sustain_off _summary_
- パラメータ:
chan (int) -- _description_
- 戻り値:
_description_
- 戻り値の型:
int
- sustain_on(chan)[ソース]¶
The sound echoes for a long time.
- パラメータ:
chan (int) -- _description_
- 戻り値:
_description_
- 戻り値の型:
int
- volume(chan, val)[ソース]¶
Set the maximum allowable value of velocity.
- パラメータ:
chan (int) -- _description_
val (int) -- _description_
- 戻り値:
_description_
- 戻り値の型:
int
- property gain: float¶
gain - defalt 0.2, Min 0.0, Max 10.0
- Type:
float
- property soundfonts: list¶
sonundfont file names
- Type:
list(str)
Module contents¶
Package of modules that control sound devices
asound: Sound Card, ALSA & JACK
btaudiosink: Bluetooth Audio Sink device
fluidsynth: MIDI device