midi

Generate MIDI file and play it without saving it to disk

我与影子孤独终老i 提交于 2019-12-11 01:45:50
问题 I found this module that can create midi files. I can play the output file using pygame mixer.music easily, but if I try to play without having to save to a file(play the object) it doesn't work, I get pygame.error: Couldn't read from RWops . I tried using StringIO with no success. I get the same error above. Does anyone one know any module that can play MIDI objects, maybe create them too? 回答1: did you remember to rewind your StringIO buffer? I went through all the steps you did, and got the

reading midi input

邮差的信 提交于 2019-12-10 22:57:31
问题 is there a module to read midi input (live) with python? 回答1: I used PyPortMidi successfully in 2006 to record Midi input in real time (on OS X). It should work on Windows, OS X, and Linux. It was very light on the processor side, which was great! 回答2: I had this discussion like ages ago once, and the consensus kinda ended up on using MidiShare, which has Python bindings. But things may have moved on since then, that was like 2004 or something. So it's not a recommendation, just a "check it

How to reduce the time delay to reach run method of Runnable class using ExecutorService Java

好久不见. 提交于 2019-12-10 22:16:34
问题 I was trying to implement a real-time executing application in which a button click event will assign a task to a Thread , which will call a midi Method to play some music. The music has to be started immediately when button is clicked with a small delay. The midi codes are implemented in the run method of Runnable class. But to reach the 1st statement of run method after the button click event itself is taking more than 2 milli second . I tried to use Executor Service, since it can have

Working with MIDI in Windows Store App (Win 8.1)

人走茶凉 提交于 2019-12-10 18:22:33
问题 My goal is to receive MIDI messages in Windows Store Apps. Microsoft has delivered an API called Microsoft.WindowsPreview.MidiRT (as a nuget package). I managed to get a midi port, but MessageReceived event is not arised, although I'm pressing keys on my MIDI keyboard, and other MIDI programs show me that PC receives these messages. Here is my code: public sealed partial class MainPage : Page { private MidiInPort port; public MainPage() { this.InitializeComponent(); DeviceWatcher watcher =

MIDI MusicDevice AudioUnit: Playing two notes of same pitch, stop one?

心不动则不痛 提交于 2019-12-10 17:38:40
问题 I am quite a novice when it comes to AudioUnits, so please forgive me if my question is very basic. I am using the MusicDevice AudioUnit to playback some notes. I am using MusicDeviceMIDIEvent to send the note-on and note-off messages. It works well. Sometimes more than one note should sound simultaneously, so I may send two note-on messages in a row. Sometimes these notes happen to have the same pitch. Then when I want to turn off one of the notes, I send a note-off event for this pitch. But

Sending pitch bend to MIDI sequencer in Java

雨燕双飞 提交于 2019-12-10 17:09:06
问题 I understand the basics of getting a MIDI sequencer up and running and I would like to be able to increase/decrease the pitch of the sequence during playback, but pitch bend is a message that gets sent to the synthesizer, not the sequencer. I tried setting the sequencer's receiver to be the synthesizer's transmitter, and when I sent pitch-bend short messages, the sequencer stayed the same pitch but then the synthesizer played a second track at the new pitch bend value, creating some pretty

How to divide a decimal MIDI pitch-bend value into 2 separated 7 bit values correctly?

夙愿已清 提交于 2019-12-10 16:42:09
问题 I'm trying to make a sort of custom midi player, to do so I'm using an array that already has memorized correctly the midi messages data like this: int array[3000][4]={{time,status,data1,data2},{...},...} when I want my program to send the midi message (so that it can be played) I call this array and do the needed distinctions between noteon/off, pitch-bend and such. The pitch-bend value (ranging from 0 to 16383, but usually is around 8192 which means no pitch shifting) is all memorized in

Java midi volume control won't work

隐身守侯 提交于 2019-12-10 15:29:40
问题 I've been trying to get midi volume control to work in a MidiPlayer class for a very long time now. I've searched for examples for accomplishing this here on stackoverflow and all over the Internet, but nothing I try ever seems to work. The volume stays the same! It doesn't change like I want it to. I'm running Java 1.6.0_32 on Windows 7 professional. Here! Have an SSCCE: import java.io.*; import javax.sound.midi.*; import java.net.URL; public class MidiSSCCE { public static void main(String[

Newer version of JRE doesn't load soundbank but older version does

家住魔仙堡 提交于 2019-12-10 14:03:45
问题 I have the following code that tries to load a soundbank. I've tested the code on Windows 7 with JRE 1.6.03 and 1.6.43. The old version of the JRE (1.6.03) works fine but the new version throws an exception. What's going on? public Main() { try { Synthesizer synth = MidiSystem.getSynthesizer(); synth.open(); BufferedInputStream soundBankStream = new BufferedInputStream( getClass().getClassLoader().getResourceAsStream( "soundbank.gm")); synth.loadAllInstruments(MidiSystem.getSoundbank

midiOutOpen on Windows 10 using Microsoft GS Wavetable Synth fails

◇◆丶佛笑我妖孽 提交于 2019-12-10 12:33:31
问题 I have an application that relies on the in built Microsoft GS Wavetable Synth. It has worked flawlessly on Windows XP, Vista, 7, 8 and 8.1. While the first call to midiOutOpen on Windows 10 works, subsequent calls result in error code 1, meaning 'Unspecified error'. The code is simple: result = midiOutOpen(&_midiOutHandle, midiOutputDevice, NULL, 0, CALLBACK_NULL); Any ideas regarding how to resolve this hugely appreciated. 回答1: I see it. Tracing through the machine code, I see the