Code Monkey home page Code Monkey logo

musicalbeeps's People

Contributors

maeldrapier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

musicalbeeps's Issues

API suggestions

Thanks for your library! It's the first Python library I could find that allows to play notes in a simple way.

I intend to use the library with my students. I have some suggestions to extend the API so it would be even more accessible for beginners:

  1. Default player: It would be nice to have a default player in the package much like with the turtle package so that one does not have to create a player object:
from musicalbeeps import *

play_note("C5", 0.4)
  1. Play a tune which is either a list of notes or a file name, something like:
class Player:
    def play_tune(self, tune):
        if type(tune) == str:
            with open(tune) as file:
                tune = file.readlines()
        for note in tune:
            if ":" in note:
                tone, duration = note.split(":")
                self.play_note(tone, float(duration))

player = Player()
player.play_tune(["C4:.45", "C4:.15", "D4:.60", "C4:.60", "F4:.60", "E4:1.2"])
player.play_tune("happy_birthday.txt")
  1. It would be very nice if the tempo could be changed. The tempo would be multiplied with the duration of each note:
player.set_tempo(2)
  1. Disable console echo by default.

Thanks for considering my suggestions.

Possible bug problem with python 3.12

Hi,

  1. I've downloaded\installed MusiclBeeps on my Windows10 machine and ran the test program which appears to contain 3 notes and a pause but when I run it I only get one note played and one line of text on the terminal.

This is under Python 3.12.0 64bit

I then changed my settings back to Python 3.11.4 64bit and it appears to be works!!!. It appears that something in 3.12 has broken your library.

  1. I downloaded your HappyBirthday.txt file and tried the following in a different program
import musicalbeeps
FileName = r"<MyPath>\HappyBirthday.txt"
musicalbeeps FileName

If I'm reading your instructions correctly this should play the tune in the file, But I keep getting an Invalid Syntax error on the filename (I've also tried it without the FileName variable and I get the same error)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.