You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Sound:
"""
Sound-related functions. The class has only static methods and is not
intended for instantiation. It can beep, play wav files, or convert text to
speech.
Unless anyone objects, I am going to make the Sound class follow the model of all of our other classes where it is expected that you create an instance of that class.
The only musical instrument I can play is the radio. My musical ignorance is making play_note() challenging to implement. @EricPobot you wrote a lot of the code in this area earlier this year, would you be willing to implement that part of the EV3-G API for the Sound class?
@dwalton76 I'd be glad to help, but I'm not sure to see clearly what is expected to be done. I understand that it has some relation with an EV3-G connection but nothing more. I confess having been a bit away from ev3dev these last months, and thus have not followed its latest evolutions. Could you give me some input please ?
@WasabiFan I'm a bit confused. The related topic is about gathering sounds and graphics to be used with ev3dev. Not about software.
Part of the EV3-G API lets you play named sounds (not paths, but preloaded sounds from a list). I'd imagine we will have some sort of support for that using the ev3dev-media package mentioned.
I believe our play_song should be enough to implement play_note: It plays a sequence of notes. (And the _NOTE_FREQUENCIES is a superset of the list @dlech provided).
Activity
dwalton76 commentedon Oct 1, 2017
Per this video
https://www.youtube.com/watch?v=D2cGnTxsdy4
dwalton76 commentedon Oct 1, 2017
Unless anyone objects, I am going to make the Sound class follow the model of all of our other classes where it is expected that you create an instance of that class.
ddemidov commentedon Oct 1, 2017
I think you can already create an instance of the Sound class and used it that way.
dwalton76 commentedon Oct 1, 2017
selfisn't expected in any of the methods though...I don't think it would work. Either way will clean it up and make it consistent.ddemidov commentedon Oct 1, 2017
That's because the methods are static. The class is stateless, so self is not necessary. But the following works for me:
dwalton76 commentedon Oct 1, 2017
The only musical instrument I can play is the radio. My musical ignorance is making
play_note()challenging to implement. @EricPobot you wrote a lot of the code in this area earlier this year, would you be willing to implement that part of the EV3-G API for theSoundclass?EricPobot commentedon Oct 1, 2017
@dwalton76 I'd be glad to help, but I'm not sure to see clearly what is expected to be done. I understand that it has some relation with an EV3-G connection but nothing more. I confess having been a bit away from ev3dev these last months, and thus have not followed its latest evolutions. Could you give me some input please ?
WasabiFan commentedon Oct 1, 2017
Related: ev3dev/ev3dev#970
EricPobot commentedon Oct 1, 2017
@WasabiFan I'm a bit confused. The related topic is about gathering sounds and graphics to be used with ev3dev. Not about software.
dlech commentedon Oct 1, 2017
I think the question is how do you convert a musical note to a frequency. Here is a table from the official LEGO firmware.
WasabiFan commentedon Oct 1, 2017
Part of the EV3-G API lets you play named sounds (not paths, but preloaded sounds from a list). I'd imagine we will have some sort of support for that using the
ev3dev-mediapackage mentioned.ddemidov commentedon Oct 2, 2017
I believe our
play_songshould be enough to implementplay_note: It plays a sequence of notes. (And the_NOTE_FREQUENCIESis a superset of the list @dlech provided).EV3-G API Sound (#396)