-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Teensy MIDI Example buzzing and cracking noise #44
Comments
Hi, A similar issue about unwanted noises when playing certain notes was reported to me a few days ago by another user. I'm still investigating the cause of this... |
This issue is due to bugs in how the code is reusing OPL2 channels. Currently it often picks a channel that just stopped playing a note. The release portion of the note will be cut off when the new note is started and a clicking or popping noise can sometimes be heard depending on the instrument. |
I had this problem too. It's like @DhrBaksteen said, the program will always reuse the most recent played channel. A possible fix is to reuse the oldest released channel for the new note. You can find my modification here: virtuaCode/ArduinoOPL2@a1a5b0a You may want to |
Thank you, that solved the noise and cracking. |
This fixes issues with the reuse of OPL2 channels in the TeensyMidi sketch. Issues in the function to get a free OPL2 channel would return the wrong channel causing clicks and pops. This fix eliminates this issue mostly, though not fully as it also depends on the instrument being used. This fix is in reference to #44
This fixes issues with the reuse of OPL2 channels in the TeensyMidi sketch. Issues in the function to get a free OPL2 channel would return the wrong channel causing clicks and pops. This fix eliminates this issue mostly, though not fully as it also depends on the instrument being used. This fix is in reference to #44
I was able to reduce the cracking noise even further as you can hear here: SAMPLE1.mp3 -> Call setInstrument() on every NoteOn (current behavior) It seems that the setInstrument() function is causing the noise, but I cannot say why. |
Hi @virtuaCode, I have the same understanding. From my experiments it seems to be depending on what instrument you are using. Also when a channel gets reused while the release portion of note is still playing it can make cracking noises appear. In the latest fixes I pushed for #45 and #46 this is addressed by moving channels for which a key gets released to the back of the list so it has a bigger chance of playing out the release portion of the note. I'm thinking that the order in which the library is setting the instrument registers may be the cause, but after trying some things I'm not 100% sure. I'm trying to find some old docs or unravel some IMF files to get some ideas... |
I guess the problem is caused by the 0x40-0x55 registers. Because when setInstument() is called, these registers will be set to the original instrument output level for a short time. Apparently, this output level is much louder than the previous level which was derived from the MIDI velocity of the played note. |
Thanks for that comment @virtuaCode I think I have the problem solved! I already tried an alternative I have an alternative
|
I would not recommend to set the output level to zero. For example when the output level is currently high and we reset it to zero then there will be again loud clicking noises. Instead just set the output to the current value: This gave me the best result so far :) |
Yes that works as well |
Hello there!
After modifying the Teensy MIDI Example to work with the standard MIDI Libary an my Arduino Nano the code worked but it produces additionally cracking noises when play some notes.
Is there a simple fix I can use or a specific section in the code where I should look at?
Greetings
The text was updated successfully, but these errors were encountered: