Questions about produces audio files from a given sheet music (coding)
For some reason, I want to separate MS's function of converting scores into sound files from the software,and I found some problems while looking at the code:
1. I searched rendermidi.cpp for the method which turn score into MIDI file, and I think I did find one called renderMidi(line 2489). However, I don't know what "chunk" "tick" means. I track their definition but still confused. Is "tick" a time unit? And what is "chunk" actually mean?
-
As far as I know, a MIDI file is essentially a file consisting of a string of hexadecimal digits, but In renderMidi, I didn't find a method transfer notes into hexadecimal digits. Did I mis-understand something?
-
It seems that "playevents" and "eventmap" are the key things in the conversion process, but I don't understand them at all... How exactly do they play a role in the conversion process?
-
In rendermidi.cpp, an EventMap type variable named "events" is used a lot, but I can't find the declaration of the EventMap class. On line 2549 "evnets" also called a method of the EventMap class, and I couldn't see how this method was actually implemented. In fact, there are many such classes without declaration in the source code. I want to know how these classes can be used?
Comments
Reg 4. See synthesizer/event.h
PlayEvent is there too, might answer your point 3.
In reply to Reg 4. See synthesizer/event… by Jojo-Schmitz
Thanks a lot
Tick refers to the position in time, expressed as a fraction (eg, beat 3 in a 4/4 measure is tick 3/4. A chunk is, as far as I know, a way of breaking the score up into sections so we only need to recalculate things for the portion that has changed, it's pretty arbitrary I believe.
Beyond that, you're getting deep enough in the specifics of the MIDI rendering that I'm not much use, but I do have to ask what your actual goal is, chances are good there is a way of achieving it that doesn't require whatever it is you are trying to do. There's also a decent chance that whatever is you are trying won't be able to work.
In reply to Tick refers to the position… by Marc Sabatella
I am studying music pattern analysis. Specifically, I want to start with music scores, so I need to convert the music scores into sound files (MP3, MIDI, etc.) and then perform acoustic analysis on these files. Because MuseScore has such a function, I want to try to separate this function. However, I still don't understand some details. Does MuseSocre divide the entire score into chunks and then process each chunk? What role does EventMap play in the whole process? How is the converted MIDI file exported?
In reply to I am studying music pattern… by ODST05
Midi isn't really a sound format, only MP3, ogg, WAV and flac are.
For analyzing musical patterns MIDI or MusicXML might be suitable formats, as those to know the exact pitches used
In reply to I am studying music pattern… by ODST05
Sorry, I don't understand. Why not simply use MuseScore to generate the audio? It's perfectly capable of doing the conversion via command line, for example.
In reply to Sorry, I don't understand. … by Marc Sabatella
Hard to tell, but it almost sounds like the OP has printed or PDF scores, and wants to make mp3's. Doable, but can be a challenge.
You wrote:
I need to convert the music scores into sound files (MP3, MIDI, etc.) and then perform acoustic analysis on these files.
OK, so... MuseScore is a scorewriting app.
It can notate music like this:
Here's the MuseScore notation file: C_major_scale.mscz
It can convert to audio: C_major_scale.zip ...Please re-name ".zip" to ".mp3" to play.
(WAV, MP3, FLAC, OGG are available)
(The C major scale waveform picture is from Audacity)
It can export MIDI: C_major_scale.mid
MIDI is not an audio file but rather a set of instructions for a machine (i.e., a music synthesizer) to play "note events" at designated times:
(The C major scale event list is from Anvil Studio)
The specific type of analysis will determine an appropriate format.