Comments (5)
The NOTE macro basically takes a sound generator frequency and calculates the corresponding note to it. The GameBoy has no notion of a note, a sound generator can be only set to a frequency which will then make a sound.
If you set the proper frequency, you can play a certain note.
If you add vibrato to your sound, the frequency will wobble up and down.
In order for the MIDI plugout or the on-screen display to detect a note, we can only take the current frequency, put it in the NOTE macro and see which note is nearest to that frequency. If the vibrato has a very high 'spread', the NOTE macro will oscillate between different notes. Because the algorithm is 'dumb', it will recognize this as different notes. (Also, if it were a trill instead of a vibrato, recognizing different notes would be correct.)
Other problems with note detection are:
- As you have no notes, you also can't really detect where a note starts or ends. Currently we guess based on volume changes and envelope triggers. While that works surprisingly well, it is by no means perfect.
- Sound effects: Nothing distinguishes sound effects from music. In the worst case we will try to map bleeps, blops and sweeps to notes because they also might be music.
- If somebody would make a sound routine that is not pitch-perfect (eg every note is played a quarter-tone too low, which the casual listener probably wouldn't even notice), the NOTE macro would fail miserably.
I currently don't have enough time to look at the IO dumps (I'd have to relearn everything, last time I worked with that part was some years ago). I don't want to rule out that our detection can be made better, but I think all of the easy parts are already done ;-)
But I have had a look at the file. You mean track 1 of subsong 1, right? I think I can see the problem in the console output.
Perhaps this is indeed a case of an out-of-tune track? You could try to add an frequency offset to the NOTE macro and play around until it fits like this:
#define FREQUENCY_OFFSET 123
#define NOTE(x) ((long)((log(FREQ(x)+FREQUENCY_OFFSET)/LN2 - MAGIC)*12 + .2))
You could wrap this in a script that iterates over different offsets and rebuilds gbsplay with -DFREQUENCY_OFFSET=xyz as needed ;-)
from gbsplay.
Thank you very much for taking the time to write such an elaborate answer! I fully understand. In the meanwhile, I looked a bit into the topic of musical temperaments and realized, this is much more complicated than I thought.
So maybe, after some time, I will understand the magic NOTE()
macro and can tell, if that track is out-of-tune, it is trill or just vibrato.
Let's close this issue for now and should I ever get to the bottom of the problem, I'll add it then :-)
Oh and btw: Thank you for creating this software, it is not trivial at all and I think you made some people very happy!
from gbsplay.
Have you tried the altmidi
output plugin? It might give better results than the old midi
plugout.
from gbsplay.
Yes I have, same result.
I believe the problem is with the NOTE() macro (which I don't understand unfortunately): It returns that a different note has started, while in reality it's the same note, just a little pitch-bend...
from gbsplay.
btw: I've just pushed 2a48a12, now there is only one NOTE
macro (in common.h
).
Up until now, the macro was defined in three different placesβ¦
from gbsplay.
Related Issues (20)
- Allow .gbs code to switch to more ROM banks HOT 8
- How to build on Windows? HOT 2
- auto-detect song length (detect emulation state looping) HOT 11
- dump sound as WAV file HOT 5
- verbose build HOT 4
- 'start_at_subsong' option not honored HOT 2
- some files play only silence
- add new gbsplay features to xgbsplay
- add a discussion tab to this repo please HOT 1
- support for dumping into the VGM file format HOT 1
- cycles should be unsigned, that remove huge delays when overflow happens, which is quite often. HOT 8
- oss is not known output plugin error HOT 1
- No sound when playing files with VBlank ugetab
- Unsupported VGZ lead to memory released twice
- Bug in TAC counter rate calculation HOT 1
- muting channels in midi output HOT 13
- MIDI output slowly gets out of sync if written to separate tracks HOT 6
- channel isolated wav output can be out-of-sync HOT 1
- Typo in plugout_midi ? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gbsplay.