mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I've been in the process of creating a full ANSI telnet script and I have it completed for most features. I started looking at a variety of possible features to add support for and came across ANSI music. Now, this would be very easy for me to handle.... if I can find a way to play a music note from mIRC. Any ideas?

I considered the possibility of generating a temporary MIDI file and playing that, but the problem there is that there will always be a delay before it starts playing and between any subsequent "lines" of music. That may not be a big problem, but I'd rather find a way to send the notes directly to the sound card. I am open to a DLL option, but would rather use just a scripted method or COM method.

I have a feeling this won't work well enough to bother with, but maybe there is something I can't think of.

Any suggestions would be helpful.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Well there are 12 notes in a western scale. That is one octave, you may want to have more than one. Anyways, why not have a file for each note? Yeah you probably would have difficulty playing specific quarter notes, eighth notes, dotted quarter, etc. But hey, it's a start.

If you think about, every instrument has each note standing by as well.

Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
That did cross my mind, but I rejected it. With ANSI music, instruments aren't the problem because it doesn't use multiple instruments. But handling different note lengths as well as tempos would be pretty much impossible unless I wanted hundreds of files.

If I decide to go forward with this, I'll probably have to do it via DLL. That or at least try doing it by generating a midi file as the notes arrive. I doubt that will work well, but I might consider trying it.


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
With a little bit of $com() magic you can control windows media player from mIRC, so you could use windows media player to play files at different speeds, etc.

I've used the wmp object model extensively so let me know if you want help with this. I'm not a musician and don't fully understand what you're trying to do so I'd have to let you organise the sound files yourself, but I can tell you how to do stuff using wmp smile

Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Would that be any different from just playing a MIDI that has the speed entered already? Or are you referring to having each note as an individual file and playing those files at different speeds?

Basically, what I'm considering doing is adding support for ANSI music. That music is sent as notes, octaves, and durations as well as possibly tempo. It might be something as simple as CDEFGAB (a scale). Or it may contain other information. I can manipulate that to whatever I need it to be. For example, if I need to provide the note's frequency instead of a letter note, I can do so. I receive the notes and additional music information through a socket in ASCII format. Then, I need to find a way to play those notes. For example, if this were BASIC, I'd just use PLAY CDEFGAB. mIRC doesn't offer that option, but I know it's possible to send notes to the default MIDI output (typically your soundcard) using C, VB, Java, etc. There is even a form of SendMessage API for MIDI, but I am not entirely sure how to access that from mIRC.

COM would be ideal because it won't require additional files to make it work. I just can't find a way to send notes to the sound card using it. If you know a way, I'd definitely be interested.

Additionally, the notes are sent one at a time, but in a "line" just like a sentence would be sent. I have the option of waiting for the end of the line before playing anything. That could allow for smoother playback, but it also means a slight delay before starting (waiting for the entire line to arrive). And, in some cases, telnet "lines" are very long because the use the client's ability to wrap long lines instead of providing line breaks. The other option is to play each note as it arrives. This provides the least delay, but may cause a stutter effect between notes. That is especially true if I have to generate a MIDI file and the /splay it. Even just changing a single character in the MIDI file when each note is received would cause enough delay between notes (I assume) to be noticeable.

If I can send notes directly to the sound card, then note by note is the best option. If I have to generate some kind of file, then line by line is the best option. I can test each method, of course.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Sounds to me like you need to access a midi type program that will play the notes for you.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I meant having a file for each note and playing them at different speeds, but I've tried it out and it seems impossible to get gapless playback with wmp, so you'd be better off using a dll I think.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
To the best of my knowledge, seamless playback between multiple files using WMP (and most other media players that I've tried) is impossible due to the fact that the player loads the first file, plays it, unloads it, then loads the second file.
Thus you have a gap during the unloading and loading times for each file.

Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yeah, I was kind of expecting that. Thanks for trying, though. I'll have to decide if I care enough about adding it to use a DLL or not. I appreciate the ideas.


Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Not sure if will help, but u could PROBABLY use winmm.dll
This might be of some help smile


I am SReject
My Stuff
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Thanks. Yeah, the midi short message API was what I was mentioning before. I'll see if it's possible using that DLL rather than making my own.


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You'll still need to write a small dll to use that dll, as you cannot call dlls from mIRC unless they're written specifically with mIRC in mind.

Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ok, thanks.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard