maeldrapier / musicalbeeps Goto Github PK
View Code? Open in Web Editor NEWA python module to play sound beeps corresponding to musical notes
Home Page: https://pypi.org/project/musicalbeeps/
License: MIT License
A python module to play sound beeps corresponding to musical notes
Home Page: https://pypi.org/project/musicalbeeps/
License: MIT License
Presently the notes sound like from an organ instrument. Is it possible to modify the audio metadata and make it sound like a guitar note?
(Ubuntu)
Was getting the error "c_src/simpleaudio_alsa.c:8:10: fatal error: alsa/asoundlib.h: No such file or directory" when trying to install the module, both with pip and setup.
Solution was:
sudo apt-get update -y
sudo apt-get install -y libasound2-dev
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:
turtle
package so that one does not have to create a player object:from musicalbeeps import *
play_note("C5", 0.4)
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")
player.set_tempo(2)
Thanks for considering my suggestions.
Hi,
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.
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)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.