QBasic has "play" command to play music which is stored in strings, why VB and C# can't?
I hope that VB and C# have the same ability to play music without a music file.
If I only have a music score and do not have any music files, I wish to write a program to play it.
I can translate the music score to strings manually, according to specific rules, just like QBasic.
You can already use NAudio or similar libraries to synthesize music. I don't think this belongs in the BCL.
Hmm... I've done it, a long time ago, with both MIDI and waveform generation using NAudio.
@jnm2
Could you share your code?
This appears to be highly application- and platform-specific functionality. I do not believe it would be possible to implement this in a manner which applied broadly (usable to many application developers), meaning it would be more appropriate to implement as a standalone library, or even as part of the single application which uses it.
@sharwell
Why does QBasic have this function? Is it possible to port QBasic's implementation?
@sharwell
If I want to port an old QBasic program to .net platform, how could I deal with "play" command?
@ygc369 I'll put it on my todo list.
@jnm2
Thank you!
@ygc369 QBASIC was born for a time where computers only had a PC speaker and all QBASIC had to do was send a frequency and an amount of time to block. It was for games and simple notification purposes. Nowadays music is typically either MIDI (if you want to sound cheap on most systems) or actually produced and rendered ahead of time into a waveform and usually stored in Ogg Vorbis or MP3.
@ygc369, you would have to create a wrapper an emulate it.
QBASIC used the system speaker to do this, and the closest thing the BCL provides natively is System.Console.Beep. Anything outside of that does become applicable to the specific library/etc and is likely outside the scope of a language or the BCL.
The logic QBASIC used for interpreting the string, the special commands supported, and the speed/etc are all fairly well documented, so you should be able to write a void Play(string expression) method that spawns a thread and calls Console.Beep(int frequency, int duration) to do the right thing.
WikiBooks has a good short summary of the PLAY command and how it is interpreted: https://en.wikibooks.org/wiki/QBasic/Appendix#PLAY
This _has_ to be a troll account.
I mean, look at Will win2d have any kind of 3D support?? Really?
@markrendle I don't think so. https://github.com/issues?utf8=%E2%9C%93&q=author%3Aygc369+
@markrendle Nice NDC talks btw, just listened to them.
Thanks for the discussion. I'm going to close this now.
@markrendle
Not troll account absolutely.
Your words are impolite.
@ygc369 fair enough, but you have to understand Marc as well. Asking a 2D library to implement 3D features is _pretty_ close to trolling. I am not sure how long you have been doing software development but if you do this any amount of time you would try to keep your sanity by having a razor-sharp focus on what features you want to provide with your software and what is out of scope and belongs somewhere else, because Software gets in a mess so quickly it seems to defy basic laws of physics.
Most helpful comment
@ygc369 fair enough, but you have to understand Marc as well. Asking a 2D library to implement 3D features is _pretty_ close to trolling. I am not sure how long you have been doing software development but if you do this any amount of time you would try to keep your sanity by having a razor-sharp focus on what features you want to provide with your software and what is out of scope and belongs somewhere else, because Software gets in a mess so quickly it seems to defy basic laws of physics.