<commit_before>from __future__ import division
import os, math
from random import randint
import numpy as np
from music21 import *
from mingus.containers import Note
from mingus.midi import fluidsynth
import simplejson as json
import time

fluidsynth.init(os.getcwd() + "/soundfonts/piano.sf2")

bpm = 240
noteFrequencies = []
noteNamesWithSharps = ["C", "C#", "D", "D#", "E", "E#", "F#", "G", "G#", "A", "A#", "B"]
noteNamesWithFlats = ["C", "Db", "D", "Eb", "Fb", "F", "Gb", "G", "Ab", "A", "Bb", "Cb"]
referenceFrequency = referenceFrequency = 130.81278265*4 # C

for i in range(0, 12):
    noteFrequencies.append(referenceFrequency*math.pow(2, i/12))

def getChordTones(chordSymbol):
    return eval(os.popen('./util/chordScale "'+chordSymbol+'"').read())

def getImprovScale(quality, symbol):
    scaleType = scale.DorianScale()
    if quality == 1:
        scaleType = scale.MajorScale()
    elif quality == 3:
        scaleType = scale.MixolydianScale()
    tones = getChordTones(symbol)
    for t in range(0, len(tones)):
        tones[t] = tones[t].replace('b', '-')
    scales = scaleType.derive(tones)
    allPitches = scales.getPitches()
    allNoteNames = [i.name for i in allPitches]
    for n in range(0, len(allNoteNames)):
        allNoteNames[n] = allNoteNames[n].replace("-", "b")
    return {'name': scales.name, 'scale': allNoteNames}

def mapFreq(note):
    freq = 800
    if (note in noteNamesWithSharps):
        freq = noteFrequencies[noteNamesWithSharps.index(note)]
    else:
        freq = noteFrequencies[noteNamesWithFlats.index(note)]
    return freq
<commit_msg>Fixed typo in piano.py.<commit_after>from __future__ import division
import os, math
from random import randint
import numpy as np
from music21 import *
from mingus.containers import Note
from mingus.midi import fluidsynth
import simplejson as json
import time

fluidsynth.init(os.getcwd() + "/soundfonts/piano.sf2")

bpm = 240
noteFrequencies = []
noteNamesWithSharps = ["C", "C#", "D", "D#", "E", "E#", "F#", "G", "G#", "A", "A#", "B"]
noteNamesWithFlats = ["C", "Db", "D", "Eb", "Fb", "F", "Gb", "G", "Ab", "A", "Bb", "Cb"]
referenceFrequency = 130.81278265*4 # C

for i in range(0, 12):
    noteFrequencies.append(referenceFrequency*math.pow(2, i/12))

def getChordTones(chordSymbol):
    return eval(os.popen('./util/chordScale "'+chordSymbol+'"').read())

def getImprovScale(quality, symbol):
    scaleType = scale.DorianScale()
    if quality == 1:
        scaleType = scale.MajorScale()
    elif quality == 3:
        scaleType = scale.MixolydianScale()
    tones = getChordTones(symbol)
    for t in range(0, len(tones)):
        tones[t] = tones[t].replace('b', '-')
    scales = scaleType.derive(tones)
    allPitches = scales.getPitches()
    allNoteNames = [i.name for i in allPitches]
    for n in range(0, len(allNoteNames)):
        allNoteNames[n] = allNoteNames[n].replace("-", "b")
    return {'name': scales.name, 'scale': allNoteNames}

def mapFreq(note):
    freq = 800
    if (note in noteNamesWithSharps):
        freq = noteFrequencies[noteNamesWithSharps.index(note)]
    else:
        freq = noteFrequencies[noteNamesWithFlats.index(note)]
    return freq

{'fraction_non_alphanumeric': 0.15895498898331759, 'fraction_numerical': 0.019515265974189486, 'mean_word_length': 4.044444444444444, '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': '1126031', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1135, 'n_words': 284}