Settings query

Find out what all those theatre organ console button do
User avatar
Jim Henry
Admin Group
Posts: 6134
Joined: Mon May 23, 2005 11:44 pm
Spam Stopper: theatre organ
How many Style 216 did Wurlitzer make?: 12
Location: United States

Re: Settings query

Post by Jim Henry » Thu Nov 08, 2012 2:23 pm

bdalton wrote:Jim wrote "The Miditzer is unusual as a MIDI device because the Merged Out creates a number of simultaneous Note events when more than one stop is engaged for the note played."

Are you sure ,Jim. Looking at the merged output on midiox shows only one Note message with many stops set.

Barry
You are right. I was thinking of the MIDI Out that gets sent to the MIDI synthesizer. The Merged Output only has the note events for the inputs. The multiplication of note events for the effect of the stops has not yet occured in the Merged Output. However, this only makes me more puzzled as to why sending the unfiltered Merged Out to the Teensy creates a problem.
Jim Henry

User avatar
johnh
Posts: 884
Joined: Wed Nov 09, 2005 12:12 am
How many Style 216 did Wurlitzer make?: 0
Location: Santa Cruz County, CA
Contact:

Re: Settings query

Post by johnh » Thu Nov 08, 2012 3:37 pm

bdalton wrote:quote from Teesy web site:- (http://www.pjrc.com/teensy/td_midi.html)
"MIDI messages are grouped together into USB packets. Up to 16 messages can transmit at once! They are held for a brief time, not more than 1 ms, to facilitate grouping. You can use the send_now() function to immediately allow any buffered messagse to transmit."
That's for the Teensy transmit side of things. I more interested in the receive side. Do you know how deep the buffer is? Looking at the MIDI library on Teensy site I don't see any buffering in it, only data for the current message. Are they relying on the USB code to buffer the data?

---john.

User avatar
bdalton
Posts: 446
Joined: Mon Aug 20, 2007 1:39 pm
How many Style 216 did Wurlitzer make?: 0
Location: West Cumbria, United Kingdom

Re: Settings query

Post by bdalton » Thu Nov 08, 2012 6:36 pm

Sorry John, I've no idea.

Barry
Barry

User avatar
bdalton
Posts: 446
Joined: Mon Aug 20, 2007 1:39 pm
How many Style 216 did Wurlitzer make?: 0
Location: West Cumbria, United Kingdom

Re: Settings query

Post by bdalton » Fri Nov 09, 2012 5:41 am

Just as a point of interest note the following.

Because of the way I've programmed the Teensy switch scanning loop, if I hold a stop switch pressed the loop stops running untill I release the switch, (this is to stop the Miditzer/teensy loop oscillating between stop On and stop Off),and the Midi input from Miditzer does'nt get serviced.
If play some notes in this situation fluidsynth does not respond untill I release the stop switch, then all the notes I played are quickely produced (on and off) by fluidsynth.

This tells me that Miditzer does'nt service fluidsynth if the "merged output" has messages waiting to be serviced.
Note: This effect does'nt happen when MIDIOX is between "merged output" and Teensy. ie.MIDIOX is servicing the Miditzer output and notes play normally.

Barry
Barry

User avatar
Jim Henry
Admin Group
Posts: 6134
Joined: Mon May 23, 2005 11:44 pm
Spam Stopper: theatre organ
How many Style 216 did Wurlitzer make?: 12
Location: United States

Re: Settings query

Post by Jim Henry » Fri Nov 09, 2012 10:21 am

It's entirely possible that the MIDI Out is written using a Windows service call that doesn't return control to the Miditzer until the data is sent.
Jim Henry

User avatar
johnh
Posts: 884
Joined: Wed Nov 09, 2005 12:12 am
How many Style 216 did Wurlitzer make?: 0
Location: Santa Cruz County, CA
Contact:

Re: Settings query

Post by johnh » Fri Nov 09, 2012 10:42 am

bdalton wrote: Because of the way I've programmed the Teensy switch scanning loop, if I hold a stop switch pressed the loop stops running untill I release the switch, (this is to stop the Miditzer/teensy loop oscillating between stop On and stop Off),and the Midi input from Miditzer does'nt get serviced.
If play some notes in this situation fluidsynth does not respond untill I release the stop switch, then all the notes I played are quickely produced (on and off) by fluidsynth.
Just another data point, in my development I often hook up program that sends MIDI to a program that I'm working on that receives MIDI via MidiYoke. If the program I'm working on stops reading MIDI messages the sending program stops/hangs. I'm not a Windows internals guru but this doesn't seem to be correct behavior.

---john.

User avatar
Jim Henry
Admin Group
Posts: 6134
Joined: Mon May 23, 2005 11:44 pm
Spam Stopper: theatre organ
How many Style 216 did Wurlitzer make?: 12
Location: United States

Re: Settings query

Post by Jim Henry » Fri Nov 09, 2012 12:13 pm

I'm not a Windows internals guru either.

Historically input/output (I/O) operations were provided as blocking and non-blocking. A blocking operation didn't return to the caller until complete, and a non-blocking operation returned immediately. Using blocking operations is simpler because the caller doesn't have to worry about the possibility of an earlier operation being ongoing. Using non-blocking operations was an early example of multithreaded programming.

I suspect that this dichotomy persists in Windows because if an I/O operation returns immediately, the caller has to do additional, non-trivial housekeeping.
Jim Henry

User avatar
peteknobloch
Posts: 151
Joined: Wed Jan 26, 2005 12:34 pm
How many Style 216 did Wurlitzer make?: 0
Location: United States

Re: Settings query

Post by peteknobloch » Fri Nov 09, 2012 1:15 pm

Jim Henry wrote:It's entirely possible that the MIDI Out is written using a Windows service call that doesn't return control to the Miditzer until the data is sent.
This makes perfect sense when working with a protocall that communicates between one node to another. When they are communicating normally the receiving node processes the data as it is being received. When it gets busy and stops accepting data, the sending node will start buffering data to a point until its buffering capability is full. To keep from loosing data the sending node has to be shut down until the receiving node starts accepting this buffered data. In this case the sending node is Miditzer and the receiving node is the Teensy. There may be a USB subroutine in the Teensy that you must call even when you aren’t able to receive any more data. If you were communicating with the old Midi interface and just stop accepting data from the UART, the data would just fall on the floor and you might miss an important Midi event. USB is coded such that it should never loose data between nodes.

Pete

User avatar
peteknobloch
Posts: 151
Joined: Wed Jan 26, 2005 12:34 pm
How many Style 216 did Wurlitzer make?: 0
Location: United States

Re: Settings query

Post by peteknobloch » Fri Nov 09, 2012 9:40 pm

I must say that I have never coded using the Teensy but from the examples that I see, you may have to keep on calling the usbMIDI.read() function to keep the data from backing up over the USB port and suspending the Miditzer. There is an example of using buttons that uses the BOUNCE.H file at http://www.pjrc.com/teensy/td_midi.html that won't force you to wait for the buttons to be released. This way you can continually loop and do the read function.

User avatar
bdalton
Posts: 446
Joined: Mon Aug 20, 2007 1:39 pm
How many Style 216 did Wurlitzer make?: 0
Location: West Cumbria, United Kingdom

Re: Settings query

Post by bdalton » Sat Nov 10, 2012 4:05 am

My Teensy program works exactly in the way you describe. The loop starts with the "while MIDI present" statement and its subroutines and only moves on to the scan switch section when the "while MIDI" returns false. IE. the MIDI input handling has priority over the scanning.
Like this,
FLOW.jpg
Note, my Teensy stop rail works perfectly 99% of the time. I only get a problem if I accidently generate a very rapid Note On/Off by catching a adjacent black note with the edge of my finger.
The problem is already cured by using MidiOx to filter out the Note On/Off messages.

Barry
You do not have the required permissions to view the files attached to this post.
Barry

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest