|
jazzalien
|
|
Post:
Jul 14th 2008 at 9:52 PM |
|
|
Hello,
first many thanks to the authors for this great project. It' s cool for mac users to have this app.
But here is the problem:
With Core Audio all BENDS (Midi: Pitch Bend) are to low. When I import a GuitarPro file or create an own file with bends and go to play, the bends are not in tune.
With Java Sound Api they sounds right, but when I export the file (Midi Export) and play it with QuickTime Player or Cubase (Core Audio) it's the same - the bends are to low.
Please have a look to this problem and make TuxGuitar more perfect.
Thank You
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Jul 15th 2008 at 12:37 AM |
|
|
|
Yeah, it's because the (non-standard) midi commands used by TuxGuitar to make bends did not work with CoreAudio/Quicktime, and I do not have the knowledge to find a compatible equivalent. Perhaps the easiest would be to ask someone with the mac version of Guitar Pro to export a midi, and then see what it does to make it work
|
|
| Back to Top |
| |
|
jazzalien
|
|
Post:
Jul 15th 2008 at 12:07 PM |
|
|
|
Thanks for your answer. I think it's not the problem of Midi Export. Already when I create a song in TuxGuitar with Bends (or Vibrato), the Range of Bend or Vibrato (Modulation) is always to low. TuxGuitar exports the Song like it sounds - not in tune, but that's OK. Please try to make a Wholetone-Bend in TuxGuitar and it sounds lower than a Quartertone-Bend (Sorry for my bad English, I hope you understand what I mean). Maybe the problem is the Core Audio output plugin of TuxGuitar.
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 15th 2008 at 1:33 PM |
|
|
The problem are some "control change" commands.
on MIDI as default a pitch bend can have a maximum of 2 semitones. but if you need heard an slide from 5 to 12, you'll need a pitch bend of 7 semitones.
So to change that there are some midi controls:
-------------------------------------------
Data_Entry (MSB) = 0x06;
Data_Entry (LSB) = 0x26;
Registered Parameter Number (LSB) = 0x64 ;
Registered Parameter Number (MSB) = 0x65 ;
-------------------------------------------
then by sending control changes to all channels,
You adjust the pitch bend sensitive to a maximum of "12" semitones.
-------------------------------------------
ControlChange( channel , RPN_MSB, 0);
ControlChange( channel , RPN_LSB, 0);
ControlChange( channel , DATA_ENTRY_MSB,12);
ControlChange( channel , DATA_ENTRY_LSB, 0);
-------------------------------------------
The problem is that coreaudio seems don't support that MIDI Controllers
|
|
| Back to Top |
| |
|
jazzalien
|
|
Post:
Jul 15th 2008 at 8:42 PM |
|
|
This will be a big job for Auria, the developer of the Core Audio plug in. I hope it's possible that the Core Audio plug in can translate the (non-standard) MIDI Commands used by TuxGuitar right. But sorry, I'm not a developer, I don't know how. Maybe you can find something about how Core Audio works on the Internet . Please tell me when you have more information.
Thanks
|
|
| Back to Top |
| |
|
jazzalien
|
|
Post:
Jul 17th 2008 at 1:43 PM |
|
|
When I export my song, the Midi file format import-export plug in creates a special data track for all midi channels on the first beat of the song with the following events:
CC 101 (RPN MSB) 0
CC 100 (RPN LSB) 0
CC 6 (DataEnt MSB) 12
When I open this file in Cubase my soundmodule (VST bismark bs-16 with General Midi Sound Font) is playing the song correctly. The reason why is the bend range. GM Standard is a bend range of 2, but now I have bend range of 12. This is a workaround for the moment, but not forever.
The QuickTime Player don't read this track. I think it comes on the same time like the GM Reset and so are sounding the bends in QuickTime Player not in tune.
But the biggest problem is Core Audio in TuxGuitar. Either TuxGuitar works with a bend range of 12 or the values of the Pitchbend Events must be higher (this will be better).
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 17th 2008 at 2:21 PM |
|
|
jazzalien, the coreaudio plugin problem is not the RPN itself.
the problem is another thing after setting that contollers.
see a segment of the source code of "controlchange" function:
// ignore these values, they mess up playback. i have no idea why TuxGuitar sends them or what they are supposed to do.
if(controller==100 or controller==101)
{
return;
}
.... More code here .....
This is "if" instruction is filtering the controler.
if the controller is 100 or 101, it execute "return" and finish the function.
So, this 2 controlers:
CC 101 (RPN MSB) 0
CC 100 (RPN LSB) 0
are not executed on coreaudio plugin.
but why ??
well the comment over the if say this: "they mess up playback"
What we need is to know why RPN of pitch bend is messing up the playback.
I think the answer is on the pitchbend function of the plugin.
-----------------------------------------------
value+=(short)0x2000; // center value
unsigned char byte1=(unsigned char)(value & 0x7f); // 7 bit bytes
unsigned char byte2=(unsigned char)( (value >> 7 ) & 0x7f );
OSStatus result;
UInt32 pitchChange = kMidiMessage_PitchBend << 4 | channel;
require_noerr (result = MusicDeviceMIDIEvent(synthUnit, pitchChange, byte1, byte2, 0), home);
-----------------------------------------------
Maybe the value is not right setted..
To understand what i try to mean, i'll show you differences beetween "alsa" (linux sound architecture) and "winmm" (windows multimedia api) on pitchbend.
Using "value" as a byte number (beetween 0 to 127)
Alsa: ((value * 128) - 8192)
Winmm: (value * 128 * 2)
AS you see, it seems there is no a "standard" pitchbend range value, or one (maybe both) of that APIs don't apply that standard.
alsa range is "-8192 To 8192" while winmm is "0 To 32768"
So we maybe need to know if the coreaudio range is right on pitchbend funcion..
|
|
| Back to Top |
| |
|
jazzalien
|
|
Post:
Jul 17th 2008 at 4:13 PM |
|
|
Julian, in the List Editor of Cubase I can see:
No pitchbend: 8192
Lowest value: 0
Highest value: 16384
I don't know, is this the Cubase internal pitchbend range or General Midi Standard or the coreaudio range.
Sorry, with source code and development I'm not familiar. But in MIDI I have some experience. I'm working with Cubase on a Mac more than 10 years.
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 17th 2008 at 5:33 PM |
|
|
Ok, if that values are right, i see one error on pitchbend function.
tuxguitar (as Java Sound Api) use this ranges:
maximum: 128 << after shift 7 bits: 16384
medium: 64 << after shift 7 bits: 8192
minimum: 0 << no matters bits.. is allways 0
As you see, shifting 7 bits to the value both uses same pitch bend ranges..
but the first line of pitchbend does:
value+=(short)0x2000; // center value
I now you are not familiarized :).. but Auria may read this post too..
that line is adding 8192 (0x2000 is an hexadecimal value) to value to "center" it.. but "it was already centered".
That means, you'll listen the sound 12 (center + center = maximum) semitones UP. (ofcourse if the RPN events would not filtered)
By other hand, there is something what i'm not sure if is right or not. (it depends on how coreaudio will read the event).
How coreaudio get the pitch bend value ?
it expect 7bit or 8bit bytes?
If coreaudio try to get it as 8bit:
( (byte1 << 8) + byte2 )
i think it may never work.
Asumming "value = 64"
unsigned char byte1=(unsigned char)(value & 0x7f); // 7 bit bytes
unsigned char byte2=(unsigned char)( (value >> 7 ) & 0x7f );
This result:
byte1 = 64
byte2 = 0
"( (64 << 8) + 0 )" result is "16384" while it should be "8192"
So, if it try to read 8bit bytes, i think this may work:
//==========================================================
// "1 byte" center value from tuxguitar.
// value = 64;
// "2 bytes" coreaudio value: 8192
int OSValue = ( value << 7 ) // shift right 7 bits
// split OSValue in 2 bytes
unsigned char byte1=(unsigned char)( OSValue >> 8 ); // 32
unsigned char byte2=(unsigned char)( OSValue & 0xff ); // 0
//----------------------------------
// Then coreaudio may get value as:
// ( (byte1 << 8) + byte2 )
// ( ( 32 << 8) + 0 ) = 8192
//----------------------------------
//==========================================================
I hope it helps..
|
|
| Back to Top |
| |
|
jazzalien
|
|
Post:
Jul 18th 2008 at 1:19 AM |
|
|
Great. Give this a try. I hope you can make some tests or a hotfix.
Many friends of me are musicans or guitarists and working with Mac like me. We have a big interrest to a good tab-app. TuxGuitar is our favorite.
Tell me, when I can help you to try some things in MIDI with Cubase or so.
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Jul 19th 2008 at 12:08 AM |
|
|
Julian, I just thought about it. I'm on PPC, which means little endian. This is C++ code so endianness does matter.
Does this code work on big endian?
---------------------------------------------
value+=(short)0x2000; // center value
unsigned char byte1=(unsigned char)(value & 0x7f); // 7 bit bytes
unsigned char byte2=(unsigned char)( (value >> 7 ) & 0x7f );
OSStatus result;
UInt32 pitchChange = kMidiMessage_PitchBend << 4 | channel;
---------------------------------------------
THis may be the answer. We'd need someone with an intel mac to test, or i could try playing with it though my bit manipulation skills are very rusty...
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Jul 19th 2008 at 12:09 AM |
|
|
|
The above post should have of course read "I'm on PPC, which means BIG endian"
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Jul 19th 2008 at 1:17 AM |
|
|
OK I think i got it to work :D
// center value and get bytes
#ifdef __POWERPC__
value = 8129 - (value + 63);
unsigned char byte2=(unsigned char)(value & 0x7f); // 7 bit bytes
unsigned char byte1=(unsigned char)( (value >> 7 ) & 0x7f );
#else
value+=(short)0x2000;
unsigned char byte1=(unsigned char)(value & 0x7f); // 7 bit bytes
unsigned char byte2=(unsigned char)( (value >> 7 ) & 0x7f );
#endif
What's left to do :
1) find someone on an intel mac to confirm it works.
2) Unfortunately it doesn't work in exported midis
jazzalien, can you test this updated package : http://www.mediafire.com/?vufyan9ccsz ?
Instructions are inside. Also, please tell me if you have a PPC or intel mac.
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 19th 2008 at 2:46 PM |
|
|
Hi Auria, how are you?
I think the problem is a "math" thing instead of the arch itself..
The first needed thing is convert the 1 byte value to 2 byte value.
I'll show you some examples instead of try to say on my bad english..
Assmuming first this table value:
-----------------------------------
maximum: Mac = 16384 | TG = 128
medium : Mac = 8192 | TG = 64
minimum: Mac = 0 | TG = 0
-----------------------------------
Case 1: value param is "128", 2 byte value should be "16384"
Case 2: value param is "64", 2 byte value should be "8192"
Case 3: value param is "0", 2 byte value should be "0"
--> #ifdef __POWERPC__
--> value = 8129 - (value + 63);
Result of case 1 is: 7938 --> Wrong.
Result of case 2 is: 8002 --> Wrong.
Result of case 3 is: 8066 --> Wrong.
--> #else
--> value+=(short)0x2000;
Result of case 1 is: 8320 --> Wrong.
Result of case 2 is: 8256 --> Wrong.
Result of case 3 is: 8192 --> Wrong.
Now see this:
--> value = ( value << 7 )
Result of case 1 is: 16384 --> BINGO!!
Result of case 2 is: 8192 --> BINGO!!
Result of case 3 is: 0 --> BINGO!!
As you see "( value << 7 )" is the winner here.
Please try this. i'm sure it'll work
1: comment this block at "void controlChange(int channel, int controller, int value)"
/*
if(controller==100 or controller==101)
{
return;
}
*/
2: replace "pitchBend(int channel, short value)" function for this newone:
//----------------------------------------------------------------------------------------------------
void pitchBend(int channel, short value)
{
// "2 bytes" value
int OSValue = ( value << 7 ) // shift right 7 bits
// split OSValue in 2 bytes
unsigned char byte1=(unsigned char)( OSValue >> 8 );
unsigned char byte2=(unsigned char)( OSValue & 0xff );
OSStatus result;
UInt32 pitchChange = kMidiMessage_PitchBend << 4 | channel;
require_noerr (result = MusicDeviceMIDIEvent(synthUnit, pitchChange, byte1, byte2, 0), home);
home:
return;
}
//----------------------------------------------------------------------------------------------------
Then build the plugin, and try to listen a song on tuxguitar ( with pitch bend, slide, etc )
>>> 1) find someone on an intel mac to confirm it works.
I know somebody.. but he don't have idea how to build C/C++ code.
What is the name of C/C++ IDE used for mac people ? (is it free ? )
>>> 2) Unfortunately it doesn't work in exported midis
mmm wait. output sounds and MIDI export are different things.
a MIDI File is a fileformat, and it's OS independant.
i mean, if i export a MIDI on windows, it's same for MacOS and GNU/Linux.
While, CoreAudio plugin, is a sound output plugin.
tuxguitar call their functions when it should play the sounds.
but CoreAudio is not used when tuxguitar exports MIDI (or any other file format).
the plugin to export midi on tuxguitar is called "TuxGuitar-midi".
So, you can modify coreaudio plugin, but it'll have no effects on exported MIDI files.
By the way, as "jazzalien" told, Quicktime synth don't play pitch bends ritght (but yes cubase).
it seems Quicktime don't have "pitch bend sensitive support" and cubaste yes.
It's normal, because "pitch bend sensitive" is not often used by MIDI applications.
puff... i'm writting a lot :)
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Jul 19th 2008 at 6:11 PM |
|
|
Ok, I talked with Julian on MSN. A proper fix was very likely found =)
Now we need mac users (especially intel macs) to test it : http://www.mediafire.com/?ewlomh0zmy7
|
|
| Back to Top |
| |
|
jazzalien
|
|
Post:
Jul 20th 2008 at 10:07 PM |
|
|
Hi Auria,
your updated package from "Jul 18th 2008 at 10:17 PM" rocks. Bends and vibratos are sounding right in TuxGuitar. Thanks!
Midi export is the old problem in QuickTime Player. See my post from " Jul 17th 2008 at 10:43 AM".
In Cubase is a workaround with bend range value 12...
I Have both INTEL (MacBook Core 2 Duo 2,4 GHz) and PPC (PowerMac G5 Dual 1,8 GHz). I have tested on Intel. Tomorrow I will test on PPC.
Now I will check the proper fix.
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 20th 2008 at 10:15 PM |
|
|
Hi jazzalien, thanks for confirm us.
> Midi export is the old problem in QuickTime Player
It seems quicktime synth don't have "pitch bend sensitive" support (or maybe it don't work under RPN controls )
By the way, the coreaudio plugin don't do nothing on MIDI export. (it just call coreaudio functions to play sounds).
TuxGuitar-midi is the plugin what export MIDI files.
However, as i told upper on this post, a MIDI file is only a file format. it don't matters the OS, you may export a .mid file under mac, and open it under windows, GNU/Linux or any other OS. and it must work.
and if you can open it on cubase, so the problem isn't on the MIDI file.
Cheers
|
|
| Back to Top |
| |
|
jazzalien
|
|
Post:
Jul 20th 2008 at 10:31 PM |
|
|
The last (proper) fix of the coreaudio plug in works fine too. Great!
But Midi export ist the old problem...
I think, the Midi export plug in must work with global bend range of 2 (not 12). This is the General Midi Standard. Every Synth has after GM Reset per default a global bend range of 2. You mast translate the pitchbend controller events in other way. Maybe it's a "math" thing too. Sorry, you are the developers.
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 20th 2008 at 10:48 PM |
|
|
> the Midi export plug in must work with global bend range
> of 2 (not 12). This is the General Midi Standard
No wait.. the range is not a standard thing, that is just a "default" value.
RPN is a "standard" MIDI controller, so there is nothing non-standard on generated midi files.
By the way, using a range of 2, will make wrong effects.
i didn't add a 12 range because i liked it.. it was because effects needed that range.
You must understand that i can't change MIDI output because one synth don't support pitch bend sensitive. 90% of tuxguitar users will see it as a "lost feature".
|
|
| Back to Top |
| |
|
jazzalien
|
|
Post:
Jul 21st 2008 at 12:36 AM |
|
|
OK, it's not easy to make everybody happy.
For example in Cubase I work with a General Midi file maybe with guitar, bass and piano tracks. Now I import a (exported) TuxGuitar track and the one thing I must do is to set the bend value of this track (midi channel) from 2 to 12. This workaround is ok, I can accept this.
But this QuickTime Player either cannot understand this "CC 6 (DataEnt MSB) 12" command or it generates AFTER this command a General Midi Reset, then the value of bend is 2 again. In this case you must set the "CC 6 (DataEnt MSB) 12" command a little bit later (after GM Reset). Let's try it.
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 21st 2008 at 1:03 AM |
|
|
Well the midi importer of tuxguitar needs a lot of work.
it's not easy read pitch bends.. well it's easy, but not to know what it is for.. a pitch bend can be used for bends, slides, vibratos, tremolo bars, etc... and ofcourse there are a lot of other missing things on the importer.
but what i tried to mean with RPN, is that the problem is not on tuxguitar-midi itself. it's quicktime who don't support it.
The best you can do is request that feature to quicktime developers (maybe they don't know about this problem. just think about "pitch bend sensitive" is not a very often feature used by MIDI applications)
By the way is not easy work with file formats.
each application has their own file format (like .tg on tuxguitar) to read/write all the application needs. but when you import/export other format it is normal lost some details what the application don't support.
As example, if you open a GP file on tuxguitar what have an "instrument change" on the middle of the song, tuxguitar will not read that because it don't support that feature.
so if you export the file again to GP fileformat, you'll lost that instrument change.
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Jul 21st 2008 at 1:15 AM |
|
|
|
Julian : now that we know it works, time to release a new binary for 1.0 with the fix =)
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 21st 2008 at 1:08 PM |
|
|
|
Yes, i need to found some time to build all releases (som packages like GCJ or Jet take a lot of time to build) and i'll release it.
|
|
| Back to Top |
| |
|
jazzalien
|
|
Post:
Jul 21st 2008 at 4:24 PM |
|
|
On PPC the fix runs fine too. TuxGuitar on Mac is now full useful. I will tell my friends about this. I would like to make a donation for TuxGuitar, but I don't use PayPal. Is it possible to pay with Mastercard? Please give me some information!
Best regards
jazzalien
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 21st 2008 at 9:36 PM |
|
|
Hi jazzalien,
> Is it possible to pay with Mastercard?
No we can't. but don't worry, you already helped a lot.
just think if you wouldn't open this topic, the pitch bend bug wouldn't be fixed now.
Thanks by the way
cheers.
|
|
| Back to Top |
| |
|
Anonymous
|
|
| Back to Top |
| |
|
Barbour Kids Jackets
|
|
| Back to Top |
| |
|
weining
|
|
| Back to Top |
| |