<commit_before>#import pygame.midi.Output
from pygame.midi import Output


class Output(Output):#pygame.midi.Output):
    def set_pan(self, pan, channel):
        assert (0 <= channel <= 15)
        assert pan <= 127
        
        self.write_short(0xB0 + channel, 0x0A, pan)<commit_msg>Add Volume and Pitch methods<commit_after>#import pygame.midi.Output
from pygame.midi import Output


class Output(Output):#pygame.midi.Output):
    
    def set_pan(self, pan, channel):
        assert (0 <= channel <= 15)
        assert pan <= 127
        
        self.write_short(0xB0 + channel, 0x0A, pan)
    
    def set_volume(self, volume, channel):
        assert (0 <= channel <= 15)
        assert volume <= 127
        
        self.write_short(0xB0 + channel, 0x07, volume)
        
    def set_pitch(self, pitch, channel):
        assert (0 <= channel <= 15)
        assert pitch <= (2**14-1)
        
        # the 7 least significant bits come into the first data byte,
        # the 7 most significant bits come into the second data byte
        pitch_lsb = (pitch >> 7) & 127
        pitch_msb = pitch & 127
        
        self.write_short(0xE0 + channel, pitch_lsb, pitch_msb)
{'fraction_non_alphanumeric': 0.10286677908937605, 'fraction_numerical': 0.04131534569983136, 'mean_word_length': 2.315642458100559, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 5, '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': '5966098', 'n_tokens_mistral': 402, 'n_tokens_neox': 365, 'n_words': 108}