MIDI Note On Event Without Off Event [duplicate] - midi

This question already has an answer here:
Synthesia plays well midi file without any note off event?
(1 answer)
Closed 5 years ago.
I made a system that takes MIDI files and creates a graphical representation of the music.
Every NoteOnEvent is when a single note starts, and every NoteOffEventwith the same note code is when it ends.
This works well for most MIDI files.
However, I am now encountering files that do not have NoteOffEvent events at all, and so I keep playing them.
What is the correct behavior when seeing for example:
midi.NoteOnEvent(tick=0, channel=0, data=[65, 127])
midi.NoteOnEvent(tick=240, channel=0, data=[65, 0])
I think if a note "on" event happens on the same note it should be like a toggle event, but I am not sure what if it is justified, or does this even happen for every midi file or just a subset that act like this?
EDIT:
I don't think this matters, but I am using python-midi to extract the tracks from midi files

It is common for a note on with 0 velocity to be interpreted as note off. I am not sure if it's part of the standard or not.

Related

Pd-GEM - using multiple, separate particle streams

I'm working on a live music visualisation project, where I am using a particle stream to visualise each channel of audio (vocals, guitar, percussion, bass) which are each coming from a looper.
I have the visualisation aspects working - I do envelope tracking in a separate pd instance, send the envelope details via udp to my gem instance, which then uses that to vary the size and colour of multiple particle streams.
The problem I have is that I am trying to set the origin point of each stream, and they are either interacting or they are controlling the origin of a different stream. The part_velocity also seems to be having a similar issue.
Each particle system has it's own gemhead (which I init as say [gemhead 20] so each one is unique), but changing the XYZ for its [part_source 1 point] object seems to affect a stream that's in a different gemhead chain.
I have also moved it off into an abstraction, where I name its head [gemhead $0] and I am having the same issue.
This unanswered thread from years ago shows two other people having the same problem, but no answers.
Here's a portion of my main patch which calls the abstraction:
And this is the abstraction:
Am I missing something simple here, or is there perhaps a bug in that one of the part_xxx objects is not checking which gemhead list it's in? Note that there are other gemheads in the main patch, some have an argument, some don't, but they're doing other stuff.
Oh yeah, and input is welcome on the somewhat dumb-looking way that I'm preserving state here, I've NO idea what the patterns are here, and cannot for the life of me find any good advice on it!

8 channel async mic recording in matlab

I wanted to record a sequence of sounds (using 8 channel mic array).
Matlab's audiorecorder system object does not support more than 2 channels async recording.
When I say async, I want to achieve the following:
The user will press some key (handled by event handler gui) it will start the recording and then again user will press a key then the system will save the current recording and user starts with next audio in the sequence.
I can record 8 ch from Matlab using audioDeviceReader system object but for that, I need to call it for each frame so I will have to create a parallel process that will have to communicate with the event handler and the audioDeviceReader.
I don't have much experience will parallel programming? Should I look into audiorecorder's code and see if can be trivially changed to support 8 ch (If that was the case I think they would have already done it). Or write code to spawn a parallel process which exposes record and stop functions wrapping over audioDeviceReader which can interface with event listener similar to audiorecorder? If so how should I proceed?
Well surprisingly removing the num channel error check in the library code worked. :)

Only one SCNAudioPlayer node plays positionally

I would really like an answer to this strangeness as I've been trying to squash it all night yesterday and not wanting to go for another sleepless night.
I have an SCNScene with camera, nodes etc properly placed and added 3 audio players to 3 of the nodes in the scene. They are loaded exactly the same way but only one is positional while the two others stay static like ambient sounds.
Let me explain further:
I load every node with a node.position = SCNVector3(x,y,z)
I have a directional keyDown event listener that changes directions of the audio listener node + or - in the scene.
The audio players load with volume 1.0 looping = true and positional = true.
3 different source files are loaded, .mp3 .wav and .aiff (this latter is a dynamic to pcm render of NSSpeechSynthesis)
All three sounds load and can be heard, though only one changes position (the pcm format).
I shuffled sound source files around with the nodes and I get weird results such as nothing loading, or loading but not being positional anymore.
This is not behaviour you would expect and is totally random (or so it seems).
Can anyone please help me figure why I can only have 1 positional node in the scene?
Thanks,
Ok, after fiddling more I found the issue.
It seems as though files must be in .pcm format to be loaded to the audioEngine buffer.
It works with as many audio sources as I want but I would like to be able to load any file format and have them run properly.

EOFException - Server/Client readUTF problems

I've recently become interested in trying to adapt my Rock-Paper-Scissors game into a multiplayer-friendly program, so today I decided I'd look up a tutorial on servers. It seems I'm following it precisely (aside from using a different IDE). However, something is going wrong and I'm not sure exactly what it is, and it works fine for the tutorial maker. I've looked up EOFException but it didn't exactly help me out.
The tutorial on Youtube
My screenshot of the issue.
[Documentation on EOFException](I had a link here, but I need at least 10 reputation to post more than two links)
"Signals that an end of file or end of stream has been reached unexpectedly during input.
This exception is mainly used by data input streams to signal end of stream. Note that many other input operations return a special value on end of stream rather than throwing an exception."
[A similar but apparently unresolved question asked here](I had a link here too]
By the way, if you look up exactly what I've posted here, you'll also find that I've asked it at DaniWeb. I'm just posting in multiple places in case it isn't resolved at one or the other. If it is, well... the more knowledge, the better.
EOFException during readUTF() just means it's reached the end of the stream, like it says on the tin. Note that this method doesn't return null at end of stream, unlike readLine() (but like all other readXXX() methods).
It can also mean that your sending and receiving is out of sync, e.g. you are trying to read some ridiculously large number of bytes because you left out a readInt() or similar, or you wrote something extra at the peer that you shouldn't have, so you're trying to read the next bytes in the stream as the result of writeUTF() when it isn't. This is an application protocol error.
How this happened in the code you posted is another question, but your code doesn't close the sockets, which doesn't help. Add an out.close() to your server code, and in.close() to the client code. However I cannot reproduce your problem with or without these closes. Are you sure this is the real code?

get input from keyboard while displaying an avi with matlab

Hi all
I wrote a short program that displays an avi file. I need the program to get input from the keyboard while the movie is running (and not after it ends):
this is my code:
figure('MenuBar','none')
set(gcf,'Color', 'white')
set(gca,'Color','white');
set(gca,'XColor','white');
set(gca,'YColor','white');
m=aviread('c:/t1.avi')
a=30:1:100;
b=100:-1:30;
c=[a b a b a b a b a b] %to run the movie back and forth
movie(m,c) %runs the movie
Thank you for any help
Ariel
Maybe you can insert your video in an UIPanel (or another suitable GUI item) and use the KeyPressFcn callback.
Have a look on this : Callback Sequencing and Interruption (I don't know if it can works but it's probably worth trying).
As far as I know multi-threading or parallel processing capabilities in MATLAB are limited; however it appears as there are remedies. This article describes combining MATLAB and C++ code, with use of MEX files.
Now I have to admit that I have never tried this so I can't really claim that it would work in your case, but it would be a good place to start.
Unless movie() has been designed to watch for input I think you will have to multithread, which from one of the other answers sounds a bit complicated.
You could play a short section of the video, then run come code to check for inputs and then play the next bit of the video. I'm not sure if you can count on things that the user types whilst the video plays going into the input buffer though.
the solution is to use winopen('c:/filename.avi')
winopen('c:/filename.avi')
this command opens media player and runs following commands in the matlab script. it doesn't wait for the movie to end. it runs in the background.
thanks every one
ariel