Re: [LAD] Question re midi

2011-12-13 Thread gene heskett
On Tuesday, December 13, 2011 03:10:42 AM Ralf Madorf did opine:

 -Original Message-
 From: linux-audio-dev-boun...@lists.linuxaudio.org on behalf of gene
 heskett
 Sent: Tue 12/13/2011 06:59
 
 A little, but while it claims 210, the midi spec only allows 127.
 
 +++
 
 Hi Gene :)
 
 I own a CASIO CT-470. It's sending SysEx to switch sound banks.

Aaron already has a CT-460 translation table, but I've CC'd him on this in 
case its different.  Thank you Ralf.
 
 Sound Number / Prog Change
 00.  10. 0
 09.  19. 9
 00.0 10.0   10
 00.9 10.9   19
 09.9 19.9  109
 
 HEX for the SysEx F0 44 03 00 7N 51 DD F7
 
 N is Channel (for my Casio 0, 1, 2 and 3 only)
 DD 20 Bank Select on, DD 21 Bank Select off
 
 Send data to a MIDI monitor and watch what happens if your Casio is
 sending program changes.

Not quite that simple, the Audigy 2 Value I have has an excellent GM synth 
in it, but no game port unless that is whats available on a 50 mill spacing 
inline connector on the top edge of the card.  But I have never found a 
mail order or net peddler that lists the breakout bracket that gives me the 
actual midi ports discussed in the cards docs.

I'm out of slots on this mobo, so any midi stuff I add is likely going to 
be translated usb and there goes the latency in a little red wagon.  Not to 
mention $10/port, 4 port min.

I probably could convince the java coder I have CC'd this to, (Aaron Wolfe) 
that is doing drivewire to add a file dump to disk of what comes up the 
/Midi channel that could then be inspected with hexdump or similar, if I 
asked real sweet.  ;-)

I also suspect that part of my problem is a drivewire.jar that is newer 
than its gui.jar, and there could be some miss-matches there as I cannot 
hear any diffs when I change the table on the fly.

 Hth,

I hope so too, thanks Ralf.
 
 Ralf
 
 ___
 Linux-audio-dev mailing list
 Linux-audio-dev@lists.linuxaudio.org
 http://lists.linuxaudio.org/listinfo/linux-audio-dev


Cheers, Gene
-- 
There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order.
-Ed Howdershelt (Author)
My web page: http://coyoteden.dyndns-free.com:85/gene
Windows 98 is *NOT* a virus - viruses are small and efficient.
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] Question re midi

2011-12-13 Thread Ralf Mardorf
Btw. I just copied/translated from the German Casio's manual. Using DD as a 
variable might be confusing, since D is a HEX number :D.

I'm not using the Casio at the moment.

The ProgChange seems to be used from 0 to 109 = 110 sounds. Btw. 0 - 127 = 128 
and not 127 ;).

If ProgChange doesn't take effect on your machine it might be that your Casio 
might expect CC 0 Bank Select MSB, CC 32 Bank Select LSB.
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] Question re midi

2011-12-13 Thread Ralf Mardorf
PS:

Program Change solution

HEX Cn pp
n=channel 0 to F, pp=sound 0 to 7F, aka DEC 0 to 127

Control Change solution

Bank select MSB
HEX Bn 00 vv
n=channel 0 to F, HEX 00 = DEC 00, the third byte, is a value that differs for 
synths of different vendors

Bank select LSB
HEX Bn 20 vv
n=channel 0 to F, HEX 20 = DEC 32, the third byte, is a value that differs for 
synths of different vendors
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] Question re midi

2011-12-13 Thread Gordon JC Pearce
On Mon, 12 Dec 2011 23:53:35 -0500
gene heskett ghesk...@wdtv.com wrote:

 Does anyone have, in their old yellowed dead tree archives, a list of 
 instrument numbers vs instrument that would allow one to setup a 
 translation table to massage some very old midi files into General Midi 
 instrument numbers?  I need a list of number vs instrument for the truly 
 elderly Casio CZ-101 and for the Casio MT-240.

On my CZ1000 the patches are zero-based:
00BRASS ENS.1
01 TRUMPET
02  VIOLIN
03   STRING ENS.1
04ELEC.PIANO
05ELEC.ORGAN
06  FLUTE
07SYNTH.BASS
08BRASS ENS.2
09VIBRAPHONE
0a CRISPY XYLOPHONE
0b  SYNTH.STRINGS
0cFAIRY TALE
0dACCORDION
0e WHISTLE
0fPERCUSSION

I've no idea what the RAM presets were, as standard.

-- 
Gordon JC Pearce MM0YEQ gordon...@gjcp.net
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] Question re midi

2011-12-13 Thread gene heskett
On Tuesday, December 13, 2011 07:35:44 AM Gordon JC Pearce did opine:

Aaron, here is a few more for the translation tables, cz1000 this time.

 On Mon, 12 Dec 2011 23:53:35 -0500
 
 gene heskett ghesk...@wdtv.com wrote:
  Does anyone have, in their old yellowed dead tree archives, a list of
  instrument numbers vs instrument that would allow one to setup a
  translation table to massage some very old midi files into General
  Midi instrument numbers?  I need a list of number vs instrument for
  the truly elderly Casio CZ-101 and for the Casio MT-240.
 
 On my CZ1000 the patches are zero-based:
 00BRASS ENS.1
 01 TRUMPET
 02  VIOLIN
 03   STRING ENS.1
 04ELEC.PIANO
 05ELEC.ORGAN
 06  FLUTE
 07SYNTH.BASS
 08BRASS ENS.2
 09VIBRAPHONE
 0a CRISPY XYLOPHONE
 0b  SYNTH.STRINGS
 0cFAIRY TALE
 0dACCORDION
 0e WHISTLE
 0fPERCUSSION
 
 I've no idea what the RAM presets were, as standard.


Cheers, Gene
-- 
There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order.
-Ed Howdershelt (Author)
My web page: http://coyoteden.dyndns-free.com:85/gene
Thinking you know something is a sure way to blind yourself.
-- Frank Herbert, Chapterhouse: Dune
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] easiest way to serialize messages for sending over a ringbuffer?

2011-12-13 Thread Paul Davis
On Mon, Dec 12, 2011 at 11:44 PM, Iain Duncan iainduncanli...@gmail.com wrote:

 Yup, what I'm talking about is being able to put a data structure on to the
 ring buffer. It needs be castable to a  const *char, so the structure needs
 a way to be converted to a string.

these two statements are not related. in an awful lot of C code,
pointer to char means pointer. in newer better C code, one uses
void*. in newer, better code than that, one doesn't use raw pointers
much at all.

are you working in C or C++ ?
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


[LAD] More midi related questions

2011-12-13 Thread gene heskett
Greetings all;

Still trying to sort reasons why a java app can't access the midi synth in 
my sound card.

From an aplaymidi -l:
[root@coyote modprobe.d]# aplaymidi -l
 PortClient name  Port name
 14:0Midi Through Midi Through Port-0
 16:0SB Audigy 2 Value [SB0400]   Audigy MPU-401 (UART)
 16:32   SB Audigy 2 Value [SB0400]   Audigy MPU-401 #2
 17:0Emu10k1 WaveTableEmu10k1 Port 0
 17:1Emu10k1 WaveTableEmu10k1 Port 1
 17:2Emu10k1 WaveTableEmu10k1 Port 2
 17:3Emu10k1 WaveTableEmu10k1 Port 3

Can I make the inference that a .mid file sent to 14:0 should find its way 
to one of the 17:n ports?  It only works if I -s to 17:0(thru 3)

Java, by its scanning methods, finds a huge list of ports, but only the 
semi-broken, internal to java, synth actually makes a noise.

If I switch to amidi -l, the list is a bit shorter:
Dir DeviceName
IO  hw:0,0Audigy MPU-401 (UART)
IO  hw:0,1Audigy MPU-401 #2
IO  hw:0,2Emu10k1 Synth MIDI (16 subdevices)
IO  hw:0,3Emu10k1 Synth MIDI (16 subdevices)

but sending a midi file to the latter pair, while taking the normal play 
time for the file, is also silent.  KMix gain is turned up quite a ways.

From the lengthy output of amixer contents:
numid=7,iface=MIXER,name='Synth Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=100,step=0
  : values=72,72
  | dBscale-min=-40.00dB,step=0.40dB,mute=1

But since aplaymidi works, I'm confused, does mute=1 mean it is live, not 
off?

When java scans for synths, I get at the end of the listing, a 
realtime_synth as device #68 in base 0.  But I haven't a clue if that is 
the audigy2's synths, but its silent in any event.

The target here is to somehow link this so the java system can actually use 
the hardware synths in an Audigy2 Value card.  But any attempt to send to a 
(hw0:0) thru (hw0:3) path is silent, however aplaymidi always uses the same 
amount of time to send the file.

Suggestions of what to check next?, please as I am lost in whatever 
translations actually take place because there seems to be 2 different 
methods of accessing a device and I can't find how they correlate.

Thank you.

Cheers, Gene
-- 
There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order.
-Ed Howdershelt (Author)
My web page: http://coyoteden.dyndns-free.com:85/gene
The Amiga is the only personal computer where you can run a multitasking 
operating system and get realtime performance, out of the box.
-- Peter da Silva
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] FFADO midi ports

2011-12-13 Thread thijs van severen
2011/12/11 Clemens Ladisch clem...@ladisch.de

 thijs van severen wrote:
  amidi -l should list all midi out ports that are available to amidi,
 right?

 It lists all ports implemented by an ALSA kernel driver.  It is possible
 to implement raw MIDI ports in software, but those are not listed.

 123456789012345678901234567890123456789012345678901234567890123456789012
 ALSA's raw MIDI interface and sequencer interface are different.
 Usually, you want to use the latter.  Try aplaymidi -l.

  Another question: will a usb midi interface list the midi ports under
 alsa?

 Yes.


OK that seems to work fine, and the USB midi interface shows up when i run
amidi -l   :-)
i created a virtual midi device that dumps incoming data in a terminal
window (using amidi -p virtual d), and connected the midi input port of the
USB interface to that virtual interface (in qjackctl)
then i connected my FX unit to the usb interface and configured the FX unit
so it sends midi messages
whenever i turn the 'preset select' knob on the FX unit the midi data shows
up in the terminal window

if i then send this midi data back tot the FX unit (using  amidi -p
hw:2,0,0 -S 'C1 09') the unit jumps to the correct preset  :-)
however, this does not work when jack is running.  if jack is running i get
this message :

ALSA lib rawmidi_hw.c:233:(snd_rawmidi_hw_open) open /dev/snd/midiC2D0
failed: Device or resource busy
cannot open port hw:2,0,0: Device or resource busy

looks like jack claims the device.
this is blocking for me since i need to have jack running for my audio
routing  :-(

any ideas ?

grtz
Thijs




 Regards,
 Clemens
 ___
 Linux-audio-dev mailing list
 Linux-audio-dev@lists.linuxaudio.org
 http://lists.linuxaudio.org/listinfo/linux-audio-dev




-- 

follow me on my Audio  Linux blog http://audio-and-linux.blogspot.com/ !
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] FFADO midi ports

2011-12-13 Thread harryhaaren

On , thijs van severen thijsvanseve...@gmail.com wrote:

any ideas ?


Yup! Tell jack to not use ALSA raw midi, use SEQ instead.
QJackCtl-Setup dialog, bottom left is MIDI Driver, play with that..?

-Harry
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] easiest way to serialize messages for sending over a ringbuffer?

2011-12-13 Thread Iain Duncan
On Tue, Dec 13, 2011 at 5:53 AM, Paul Davis p...@linuxaudiosystems.comwrote:

 On Mon, Dec 12, 2011 at 11:44 PM, Iain Duncan iainduncanli...@gmail.com
 wrote:

  Yup, what I'm talking about is being able to put a data structure on to
 the
  ring buffer. It needs be castable to a  const *char, so the structure
 needs
  a way to be converted to a string.

 these two statements are not related. in an awful lot of C code,
 pointer to char means pointer. in newer better C code, one uses
 void*. in newer, better code than that, one doesn't use raw pointers
 much at all.

 are you working in C or C++ ?


Thanks Paul. I'm working in C++, but I'm using the jack C api, which from
the docs I see has a signature for
size_t jack_ringbuffer_write ( jack_ringbuffer_t * rb,  const char * src,
size_t cnt )

My DataMessage structure is just a simple C structure for now. Is there a
recommended way of writing it to the ringbuffer given that I want to do
something like this:

void MessageQueue::push( DataMessage msg ){
// write to the ring buffer, converting DataMessage to a string
unsigned int written = jack_ringbuffer_write( mRingBuffer, (char *)
msg , sizeof(DataMessage) );
   // etc
}


Thanks
Iain
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] easiest way to serialize messages for sending over a ringbuffer?

2011-12-13 Thread Paul Davis
On Tue, Dec 13, 2011 at 10:02 PM, Iain Duncan iainduncanli...@gmail.com wrote:

 Thanks Paul. I'm working in C++, but I'm using the jack C api, which from
 the docs I see has a signature for
 size_t jack_ringbuffer_write ( jack_ringbuffer_t * rb,  const char * src,
 size_t cnt )

 My DataMessage structure is just a simple C structure for now. Is there a
 recommended way of writing it to the ringbuffer given that I want to do
 something like this:

 void MessageQueue::push( DataMessage msg ){
     // write to the ring buffer, converting DataMessage to a string
     unsigned int written = jack_ringbuffer_write( mRingBuffer, (char *) msg
 , sizeof(DataMessage) );
    // etc
 }

as long as the struct is POD (Plain Old Data - no embedded pointers,
etc), this will work fine.

however, you need to keep in mind that under some easily encounterable
circumstances, the write may not return sizeof(DataMessage). this is a
very easy mistake to make with ringbuffers (ditto for read).

it can be avoided via careful sizing of the ringbuffer and always
read/writing whole objects OR by carefully checking the results of
read/write.

the jack ringbuffer design is particular bad in this respect because
it can only hold size-1 bytes (where size is its actual size).

ardour has some slightly better behaved, templated ringbuffers for this purpose.
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] easiest way to serialize messages for sending over a ringbuffer?

2011-12-13 Thread Iain Duncan
 My DataMessage structure is just a simple C structure for now. Is there a
 recommended way of writing it to the ringbuffer given that I want to do
 something like this:

 void MessageQueue::push( DataMessage msg ){
 // write to the ring buffer, converting DataMessage to a string
 unsigned int written = jack_ringbuffer_write( mRingBuffer, (char *)
msg
 , sizeof(DataMessage) );
// etc
 }

as long as the struct is POD (Plain Old Data - no embedded pointers,
 etc), this will work fine.

 however, you need to keep in mind that under some easily encounterable
 circumstances, the write may not return sizeof(DataMessage). this is a
 very easy mistake to make with ringbuffers (ditto for read).

 it can be avoided via careful sizing of the ringbuffer and always
 read/writing whole objects OR by carefully checking the results of
 read/write.


Thanks for the tips. What should one do if one detects a partial write? Is
it best to have integrity checks on both ends of the ringbuffer?

the jack ringbuffer design is particular bad in this respect because
 it can only hold size-1 bytes (where size is its actual size).


Does this mean a good way to initialize it is to make the ringbuffer some
multiple of the sizeof(myMessageStruct) plus one byte?

Thanks again for all the help.
iain
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] easiest way to serialize messages for sending over a ringbuffer?

2011-12-13 Thread Nick Copeland

 Thanks for the tips. What should one do if one detects a partial write? Is it 
 best to have integrity checks on both ends of the ringbuffer?

Avoid them.  There should be some calls for checkRingBufferWriteSpace(), make 
sure it is large enough to cater for your object size. You still have a few 
hoops and jumps to go through if the buffer is filling up but it is definitely 
going to be easier that catering for partial writes. Consider also logging 
messages when it is full and if it happens (too much or in my opinion at all) 
then look into why the reader is going too slow. If it is a general issue then 
you need to rearchitect what you are doing, if it is just a transient issue 
then bang more capacity on the ringbuffer.

Regards, nick.
  ___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] FFADO midi ports

2011-12-13 Thread Clemens Ladisch
harryhaa...@gmail.com wrote:
 On , thijs van severen thijsvanseve...@gmail.com wrote:
 any ideas ?

 Yup! Tell jack to not use ALSA raw midi, use SEQ instead.

Raw MIDI ports do not allow sharing, so you have to tell all programs
you want to use at the same time to use the ALSA sequencer.
Instead of amidi, use aseqdump.


Regards,
Clemens
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev