midi

Synthesize musical notes (with piano sounds) in Python

本秂侑毒 提交于 2019-11-30 03:30:11
I would like to have a python implementation of a musical instrument library (for instance, a piano object) that I can use to convert a list of notes and a duration into sound. For instance, something like: import Piano pn = Piano() pn.play([note, note, ..., note], duration) Does something like this exist for python 2.7? I would like to implement it if it doesn't. I currently have something that uses audiere, but its just sine waves so it sounds horrible. Is there any way to hook into a midi piano or something like that- I am using windows 7? Are there any implementing steps that I might not

How to correctly convert MIDI ticks to milliseconds?

偶尔善良 提交于 2019-11-30 02:47:18
问题 I'm trying to convert MIDI ticks/delta time to milliseconds and have found a few helpful resources already: MIDI Delta Time Ticks to Seconds How to convert midi timeline into the actual timeline that should be played MIDI Time Code spec MTC The problem is I don't think I'm using this information correctly. I've tried applying the formula Nik expanded: [ 1 min 60 sec 1 beat Z clocks ] | ------- * ------ * -------- * -------- | = seconds [ X beats 1 min Y clocks 1 ] using the metadata from this

Simple Java MIDI example not producing any sound

南笙酒味 提交于 2019-11-30 02:42:12
问题 This simple code is not producing any sound on a couple of machines that I've used to test it. I'm running the code from within Eclipse, but I've also tried using the command line to no avail. public static void main(String[] args) { try { Synthesizer synthesizer = MidiSystem.getSynthesizer(); synthesizer.open(); MidiChannel[] channels = synthesizer.getChannels(); channels[0].noteOn(60, 60); Thread.sleep(200); channels[0].noteOff(60); synthesizer.close(); } catch (Exception e) { e

Why doesn't this simple CoreMIDI program produce MIDI output?

江枫思渺然 提交于 2019-11-29 22:24:32
Here is an extremely simple CoreMIDI OS X application that sends MIDI data. The problem is that it doesn't work. It compiles fine, and runs. It reports no errors, and does not crash. The Source created becomes visible in MIDI Monitor. However, no MIDI data comes out . Could somebody let me know what I'm doing wrong here? #include <CoreMIDI/CoreMIDI.h> int main(int argc, char *args[]) { MIDIClientRef theMidiClient; MIDIEndpointRef midiOut; MIDIPortRef outPort; char pktBuffer[1024]; MIDIPacketList* pktList = (MIDIPacketList*) pktBuffer; MIDIPacket *pkt; Byte midiDataToSend[] = {0x91, 0x3c, 0x40}

MIDI beginner - need to play one note

我怕爱的太早我们不能终老 提交于 2019-11-29 17:34:46
问题 I don't know very much about Java's MIDI function. In fact, it utterly bewilders me. what I'd like to do however is just build a simple application that will play one note. How to play a single MIDI note using Java Sound? The support for this out on the web is almost nonexistent, and I am totally at a loss. 回答1: I know this is a really old question, but, as a novice programmer, I had a very difficult time figuring out how to do this, so I thought I would share the following hello-world-style

play MIDI files in python?

江枫思渺然 提交于 2019-11-29 16:52:22
问题 I'm looking for a method to play midi files in python. It seems python does not support MIDI in its standard library. After I searched, I found some python midi librarys such as pythonmidi. However, most of them can only create and read MIDI file without playing function. I would like to find a python midi library including playing method. Any recommendations? Thanks! 回答1: The pygame module can be used to play midi files. http://www.pygame.org/docs/ref/music.html See the example here: http:/

ios - mixing midi files, each with own sound font

南笙酒味 提交于 2019-11-29 15:29:28
问题 I'm looking for a way to mix 2 or more midi files, each with their own sound font files. I've found the following code for one file and tried to do multiple music players but i guess that shouldn't be the right approach. Also i get some weird pop sound every second. So is there any other way, maybe without the musicplayer and musicsequence methods, using only au units? Here's the code i found in another thread: -(void) playMusic:(NSString*) name { NSString *presetURLPath = [[NSBundle

How to get Exact Time of a MIDI event

守給你的承諾、 提交于 2019-11-29 14:45:49
I'm trying to read a MIDI file and I want to determine the exact time of a NoteOn event from it in C#. I tried to use absolute time, but the output was something like 256632. What is this number ? This is the line of my code that returns the time : (note as NoteOnEvent).AbsoluteTime A MIDI file only contains incremental times. Included as a variable length value between 1 and 4 bytes before each MIDI event. The library you are using is being helpful in providing you with the AbsoluteTime property. Simply calculated by summing the incremental times for each event. The unit is "delta ticks". The

Why java midi synth on mac stop playing notes

醉酒当歌 提交于 2019-11-29 11:27:09
I am trying to make a simple app that read from a midi port (hardware) and forward events to the software synth. It mostly work except that the soft synth stop playing from time to time. I can see midi messages being forwarded in the logs, I can trace in debug and see that the event reach the native code in the synth receiver but for some reason, the synth does not play the note. If you wait then the sound play again, then stop, then play again... Here is a demo app that shows the problem. If you hold the enter button in the console, you will hear a note repeatedly. After some time (likely

How to control the MIDI channel's volume

痞子三分冷 提交于 2019-11-29 11:12:57
I have this code: Synthesizer synthesizer = MidiSystem.getSynthesizer(); synthesizer.open(); Instrument[] instrument = synthesizer.getDefaultSoundbank().getInstruments(); synthesizer.loadInstrument(instrument[29]); MidiChannel[] channels = synthesizer.getChannels(); MidiChannel channel = channels[1]; channel.programChange(29); channel.noteOn(noteNumber, 127); Teszthang.sleep(2000); channel.noteOff(noteNumber); so this is an example, to play a sound in max volume (127) for 2 seconds. but i want to control the channel's volume, like after 2 seconds, the volume fade out in an another 2 seconds.