<commit_before>"""
This test demonstrated the new functions and options implemented
in the class Synth.
"""
import time
import fluidsynth

# Create and start the synthesizer with the selected options.
fs = fluidsynth.Synth(gain=0.1, polyphony=2, channels=16)
fs.start(driver="pulseaudio")

# Test the get_gain and set a new gain:
print "Current gain: " + str(fs.get_gain())
fs.set_gain(0.3)
print "Updated gain: " + str(fs.get_gain())

# Load a soundfont.
sfid = fs.sfload("/usr/share/sounds/sf2/FluidR3_GM.sf2")

preset = 19
bank = 0
channel = 0

# Select the program and play a chord.
fs.program_select(channel, sfid, bank, preset)
fs.noteon(0, 60, 80)  # (Channel, note, velocity)
fs.noteon(0, 67, 80)
fs.noteon(0, 76, 80)  # We can't play that note, because polyphony=2

# This way we check the information of the instrument loaded in a certain channel
information = fs.get_channel_info(channel)
bank = information.bank
preset = information.program

# We present the name of the instrument loaded using the instrument list<commit_msg>Explaining warnings in test4.py<commit_after>"""
This test demonstrated the new functions and options implemented
in the class Synth.
"""
import time
import fluidsynth

# Create and start the synthesizer with the selected options.
fs = fluidsynth.Synth(gain=0.1, polyphony=2, channels=16)
fs.start(driver="pulseaudio")

# Test the get_gain and set a new gain:
print "Current gain: " + str(fs.get_gain())
fs.set_gain(0.3)
print "Updated gain: " + str(fs.get_gain())

# Load a soundfont.
sfid = fs.sfload("/usr/share/sounds/sf2/FluidR3_GM.sf2")

preset = 19
bank = 0
channel = 0

# Select the program and play a chord.
fs.program_select(channel, sfid, bank, preset)
fs.noteon(0, 60, 80)  # (Channel, note, velocity)
fs.noteon(0, 67, 80)
fs.noteon(0, 76, 80)  # We can't play that note, because polyphony=2, you should get an warning here

# This way we check the information of the instrument loaded in a certain channel
information = fs.get_channel_info(channel)
bank = information.bank
preset = information.program

# We present the name of the instrument loaded using the instrument list
{'fraction_non_alphanumeric': 0.10536218250235184, 'fraction_numerical': 0.028692380056444027, 'mean_word_length': 4.859504132231405, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '452176', 'n_tokens_mistral': 740, 'n_tokens_neox': 692, 'n_words': 252}