예제 #1
0
    def __init__(self):
        self.player = musicalbeeps.Player(volume=0.3, mute_output=False)

        self.notes = [
            "C",
            "D",
            "E",
            "F",
            "G",
            "A",
            "B",
        ]

        self.notes_with_format = [
            "C{oct}",
            "C{oct}#",
            "D{oct}",
            "D{oct}#",
            "E{oct}",
            "F{oct}",
            "F{oct}#",
            "G{oct}",
            "G{oct}#",
            "A{oct}",
            "A{oct}#",
            "B{oct}",
        ]

        self.octaves_count = 8
        self.max_note_play_time = 3
        self.note_count = len(self.notes) - 1
        self.current_note = None
        self.all_notes = []
        self.get_all_notes()
예제 #2
0
 def play_series(self):
     '''
     this plays a series of notes.
     '''
     player = mb.Player(volume=.5, mute_output=False)
     ##change
     time = self._timer
     for note in self._series:
         player.play_note(note, time)
예제 #3
0
 def play_note(self):
     '''
     this plays a single note.
     '''
     player = mb.Player(volume=.5, mute_output=False)
     ##change
     time = self._timer
     note = self._note
     player.play_note(note, time)
예제 #4
0
 def __init__(self, tune_str=None,
     volume=DEFAULT_VOLUME, 
     note_duration=DEFAULT_NOTE_DURATION,
     verbose=False
     ):
     self.tune_str = tune_str
     self.verbose = verbose
     self.note_duration = note_duration
     self.player = musicalbeeps.Player(volume=volume, mute_output=not(verbose))
     if tune_str:
         self.load_tune(tune_str)
예제 #5
0
def player_loop(args, input_file):
    notes_player = musicalbeeps.Player(args.volume, args.silent)

    for line in input_file:
        valid_duration = True
        line = line.rstrip()
        if len(line) > 0:
            try:
                note, duration_str = line.split(':')
            except:
                note, duration_str = line, '.5'
            try:
                duration = float(duration_str)
            except:
                valid_duration = False
                print("Error: invalid duration: '"
                                        + duration_str
                                        + "'",
                                        file=sys.stderr)
            if valid_duration:
                notes_player.play_note(note, duration)
예제 #6
0
파일: happyou.py 프로젝트: s22anan/anan
                handNumber]  #results.multi_hand_landmarks returns landMarks for all the hands

            for id, landMark in enumerate(hand.landmark):
                # landMark holds x,y,z ratios of single landmark
                imgH, imgW, imgC = originalImage.shape  # height, width, channel for image
                xPos, yPos = int(landMark.x * imgW), int(landMark.y * imgH)
                landMarkList.append([id, xPos, yPos, label])
            if draw:
                Draw.draw_landmarks(originalImage, hand,
                                    Hands.HAND_CONNECTIONS)
        return landMarkList


handDetector = HandDetector(min_detection_confidence=0.7)
import musicalbeeps as mb
p = mb.Player(volume=0.5, mute_output=False)
from time import sleep


def main():
    cam = cv2.VideoCapture(0)
    while True:
        status, image = cam.read()
        image = cv2.flip(image, 1)
        handLandmarks = handDetector.findHandLandMarks(image=image, draw=True)
        count = 0
        thumb = 0
        index = 0
        middle = 0
        ring = 0
        little = 0
예제 #7
0
import musicalbeeps as mb

player = mb.Player(volume=0.1, mute_output=False)

#Rhythm Dictionary
rd = {
    "Redonda": 2.0,
    "Blanca": 1.0,
    "Negra": 0.5,
    "Corchea": 0.25,
    "RedondaPuntillo": 3.0,
    "BlancaPuntillo": 1.5,
    "NegraPuntillo": 0.75,
    "CorcheaPuntillo": 0.375,
}

musicData = [["E", "Corchea"], ["E", "Corchea"], ["E", "Negra"],
             ["E", "Corchea"], ["A", "Corchea"], ["A", "Corchea"],
             ["A", "Corchea"], ["A", "Corchea"], ["G", "Corchea"],
             ["G", "Corchea"], ["G", "Corchea"], ["G", "Corchea"],
             ["C", "Corchea"], ["C", "Corchea"], ["C", "Corchea"],
             ["C", "Corchea"], ["D", "Corchea"], ["D", "Corchea"],
             ["D", "Corchea"], ["D", "Corchea"], ["D", "Corchea"],
             ["D", "Corchea"], ["E", "Corchea"], ["E", "Corchea"],
             ["E", "Corchea"], ["E", "Corchea"], ["G", "Corchea"],
             ["F", "Negra"], ["F", "Corchea"],
             ["C", "Corchea"], ["D", "Negra"], ["D", "Corchea"],
             ["A", "Corchea"], ["G", "Negra"], ["F", "Negra"], ["E", "Negra"],
             ["E", "Corchea"], ["E", "Corchea"], ["G", "Negra"],
             ["F", "Corchea"], ["F", "Corchea"], ["D", "Negra"],
             ["D", "Corchea"], ["F", "Corchea"], ["E", "Corchea"],
예제 #8
0
import musicalbeeps
import logging

logger = logging.getLogger(name="Player")

player = musicalbeeps.Player(volume=0.3, mute_output=True)


def play_interval(interval):
    logger.info(interval)
    player.play_note(interval.root, 0.5)
    player.play_note(interval.secondNote, 0.5)


def play_two_intervals(first_interval, second_interval):
    play_interval(first_interval)
    player.play_note("pause", 0.5)
    play_interval(second_interval)
예제 #9
0
def player_thread(chord, note, time_per_measure):
    print('Player %d started' % note)
    musicalbeeps.Player(volume = 0.1, mute_output = False).play_note(tswift_progression[chord][note], time_per_measure)
예제 #10
0
 def player_thread(self, progression, chord, note, time_per_measure):
     """
     Plays a single note given a chord, note, and duration
     """
     musicalbeeps.Player(volume=0.1, mute_output=False).play_note(
         progression[chord][note], time_per_measure)
예제 #11
0
파일: main.py 프로젝트: spineki/Sysiphe
import matplotlib.pyplot as plt
import numpy as np
from scipy import ndimage
import cv2 as cv2
import time
import keyboard
import pyautogui
import musicalbeeps
music_player = musicalbeeps.Player(volume=0.3,
                                   mute_output=False)


# Hyperparameters ---------------------------------------------------------------------------------


SCREENSHOT_ANGLE = -3.7

PROGRESSBAR_RATIO = 7.185566648008215
EPSILON_RATIO = 0.5

CUPHEAD_AREA = 2129.8714588528674
EPSILON_CUPHEAD_AREA = 300

CUPHEAD_RATIO = 1.2
EPSILON_CUPHEAD_RATIO = 2

# Helper functions --------------------------------------------------------------------------------


def takeScreenShot():
    # take screenshot using pyautogui
예제 #12
0
def volume(float):
    global play
    global bol
    play = music.Player(volume=float, mute_output=bol)
예제 #13
0
import musicalbeeps as music
import inspect
from os.path import exists
from os import system as system
play = music.Player(volume=.8, mute_output=True)
note_len = 1
bol = False


def NoteLen(notel):
    global note_len
    note_len = notel


def output(b00l):
    global bol
    if b00l == True:
        b00l = False
    elif b00l == False:
        b00l = True
    bol = b00l


def volume(float):
    global play
    global bol
    play = music.Player(volume=float, mute_output=bol)


def note(note="C4", lenght=1, wait=-1.0):
    try: