* Can't get capturing from RME Hammerfall MADI card to work: sound loops & silcence
@ 2013-09-27 6:08 Niels Laukens
2013-09-27 7:07 ` bruce
0 siblings, 1 reply; 6+ messages in thread
From: Niels Laukens @ 2013-09-27 6:08 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 1798 bytes --]
Hi,
I'm trying to capture audio from an RME Hammerfall MADI card (PCI ID
10ee:3fc6). The setup previously worked fine on Windows, so I'm currently
assuming that the card and the input signal is OK.
I wrote a very simple ALSA-application that simply opens the device, sets
the access format to NONINTERLEAVED (which seems to be the only option the
card likes), selects 32bit sampling (although the audio is 24bit, ALSA
rejects this option), 48kHz sampling and 64 channels (also, the only
option the card accepts). Next, it loops with snd_pcm_readn() to get 100ms
worth of audio, and dumps channel 10 to file. (Full source in attachement)
The result is strange for various reasons:
* The second half of every buffer returned by snd_pcm_readn() is always
zero's.
* The call seems to return way to fast: I would expect to get 48000
frames/second, but judging from the timing of the snd_pcm_readn() call,
it's more like 1536000 frames/second (i.e. 32 fold faster).
* When playing back the resulting file, I do recognize some music, but it
sounds like it's the same part over and over again. Also, restarting the
capture program minutes later, returns the same (at least as far as my
ears & brain can recall) fragment of audio.
What am I doing wrong here? (Samples of the PCM-file are available upon
request)
I've also tried a related test with `arecord`, with similar but different
results:
* The audio was also interspersed with silence
* The capture duration did not match the requested '-d' option: the
recording was a factor of 2 shorter than requested.
* There was more audio in the recording: if I manually cut out the silent
parts, the audio sounded reasonable.
What am I missing here?
Is this the right place to ask? Or should this go to the RME forum?
Thanks in advance,
Niels
[-- Attachment #2: capture.cpp --]
[-- Type: text/x-c++src, Size: 2449 bytes --]
#include <alsa/asoundlib.h>
#include <iostream>
#include <string>
int main() {
std::string device = "hw:0,0";
/* open the capture stream */
snd_pcm_t *pcm_handle;
int rv = snd_pcm_open( &pcm_handle, device.c_str(), SND_PCM_STREAM_CAPTURE, 0);
if( rv < 0 ) {
std::cerr << "Couln't open device \"" << device << "\" for capture: "
<< snd_strerror(rv) << std::endl;
return 1;
}
/* Get full possible parameters */
snd_pcm_hw_params_t *hw_params;
snd_pcm_hw_params_malloc(&hw_params);
rv = snd_pcm_hw_params_any(pcm_handle, hw_params);
if( rv < 0 ) {
std::cerr << "Couldn't get parameter-list: " << snd_strerror(rv) << std::endl;
return 1;
}
rv = snd_pcm_hw_params_set_access(pcm_handle, hw_params, SND_PCM_ACCESS_RW_NONINTERLEAVED);
if( rv < 0 ) {
std::cerr << "Couldn't set access to RW_NONINTERLEAVED: " << snd_strerror(rv) << std::endl;
return 1;
}
rv = snd_pcm_hw_params_set_format(pcm_handle, hw_params, SND_PCM_FORMAT_S32_LE);
if( rv < 0 ) {
std::cerr << "Couldn't set sample format to S32_LE: " << snd_strerror(rv) << std::endl;
return 1;
}
unsigned int rate = 48000;
rv = snd_pcm_hw_params_set_rate_near(pcm_handle, hw_params, &rate, NULL);
if( rv < 0 ) {
std::cerr << "Couldn't set samplerate to " << rate << ": " << snd_strerror(rv) << std::endl;
return 1;
}
std::cerr << "Samplerate = " << rate << std::endl;
rv = snd_pcm_hw_params_set_channels(pcm_handle, hw_params, 64);
if( rv < 0 ) {
std::cerr << "Couldn't set channels to 64: " << snd_strerror(rv) << std::endl;
return 1;
}
/* commit the params and prepare the card */
rv = snd_pcm_hw_params(pcm_handle, hw_params);
if( rv < 0 ) {
std::cerr << "Couldn't apply parameters: " << snd_strerror(rv) << std::endl;
return 1;
}
snd_pcm_hw_params_free( hw_params );
void* buf[64];
size_t sbuf = 48000 * 32/4;
for( int i = 0; i < 64; i++ ) {
buf[i] = malloc(sbuf);
if( buf[i] == NULL ) {
std::cerr << "Couldn't malloc()" << std::endl;
return 1;
}
}
unsigned long i=300;
while(i--) {
rv = snd_pcm_readn(pcm_handle, buf, 48000/10);
if( rv == -32 ) {
std::cerr << "overrun" << std::endl;
snd_pcm_prepare(pcm_handle);
continue;
}
if( rv < 0 ) {
std::cerr << "readn() failed: " << rv << " " << snd_strerror(rv) << std::endl;
return 1;
}
write(1, buf[10], rv * 32/8);
}
std::cerr << std::endl;
snd_pcm_close(pcm_handle);
for( int i = 0; i < 64; i++ ) {
free( buf[i] );
}
}
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can't get capturing from RME Hammerfall MADI card to work: sound loops & silcence
2013-09-27 6:08 Can't get capturing from RME Hammerfall MADI card to work: sound loops & silcence Niels Laukens
@ 2013-09-27 7:07 ` bruce
2013-09-27 7:43 ` Clemens Ladisch
0 siblings, 1 reply; 6+ messages in thread
From: bruce @ 2013-09-27 7:07 UTC (permalink / raw)
To: Niels Laukens, alsa-devel, Andrew Martin
Hi Niels,
Similar issues here, but can add it all seems to work absolutely fine with
alsa 1.0.15, but fails with 1.0.18+.
Alsamixer must be used to setup the card and Madi.
96k sampling also works if you set the madi into double-speed mode (on the
older alsa).
Can't compile 1.0.15 with later kernels unfortunately; some hooks seem to
have changed !
Got no reply on rme Linux forum.
On 27 Sep 2013 16:09, "Niels Laukens" <niels.laukens@innovatie.vrt.be>
wrote:
> Hi,
>
> I'm trying to capture audio from an RME Hammerfall MADI card (PCI ID
> 10ee:3fc6). The setup previously worked fine on Windows, so I'm currently
> assuming that the card and the input signal is OK.
>
> I wrote a very simple ALSA-application that simply opens the device, sets
> the access format to NONINTERLEAVED (which seems to be the only option the
> card likes), selects 32bit sampling (although the audio is 24bit, ALSA
> rejects this option), 48kHz sampling and 64 channels (also, the only
> option the card accepts). Next, it loops with snd_pcm_readn() to get 100ms
> worth of audio, and dumps channel 10 to file. (Full source in attachement)
>
> The result is strange for various reasons:
>
> * The second half of every buffer returned by snd_pcm_readn() is always
> zero's.
>
> * The call seems to return way to fast: I would expect to get 48000
> frames/second, but judging from the timing of the snd_pcm_readn() call,
> it's more like 1536000 frames/second (i.e. 32 fold faster).
>
> * When playing back the resulting file, I do recognize some music, but it
> sounds like it's the same part over and over again. Also, restarting the
> capture program minutes later, returns the same (at least as far as my
> ears & brain can recall) fragment of audio.
>
> What am I doing wrong here? (Samples of the PCM-file are available upon
> request)
>
>
> I've also tried a related test with `arecord`, with similar but different
> results:
>
> * The audio was also interspersed with silence
>
> * The capture duration did not match the requested '-d' option: the
> recording was a factor of 2 shorter than requested.
>
> * There was more audio in the recording: if I manually cut out the silent
> parts, the audio sounded reasonable.
>
> What am I missing here?
>
>
> Is this the right place to ask? Or should this go to the RME forum?
>
>
> Thanks in advance,
> Niels
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can't get capturing from RME Hammerfall MADI card to work: sound loops & silcence
2013-09-27 7:07 ` bruce
@ 2013-09-27 7:43 ` Clemens Ladisch
2013-09-27 7:47 ` Florian Faber
0 siblings, 1 reply; 6+ messages in thread
From: Clemens Ladisch @ 2013-09-27 7:43 UTC (permalink / raw)
To: bruce, Niels Laukens, alsa-devel, Andrew Martin, Adrian Knoth
bruce wrote:
> On 27 Sep 2013 16:09, "Niels Laukens" wrote:
>> I've also tried a related test with `arecord`, with similar but different
>> results:
>>
>> * The audio was also interspersed with silence
>>
>> * The capture duration did not match the requested '-d' option: the
>> recording was a factor of 2 shorter than requested.
>
> Similar issues here, but can add it all seems to work absolutely fine with
> alsa 1.0.15, but fails with 1.0.18+.
This sound like some change in the driver introduced a bug.
Regards,
Clmeens
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can't get capturing from RME Hammerfall MADI card to work: sound loops & silcence
2013-09-27 7:43 ` Clemens Ladisch
@ 2013-09-27 7:47 ` Florian Faber
2013-10-02 15:16 ` Jörn Nettingsmeier
2013-10-08 3:59 ` Bruce
0 siblings, 2 replies; 6+ messages in thread
From: Florian Faber @ 2013-09-27 7:47 UTC (permalink / raw)
To: alsa-devel
Clemens,
>> Similar issues here, but can add it all seems to work absolutely fine with
>> alsa 1.0.15, but fails with 1.0.18+.
> This sound like some change in the driver introduced a bug.
the driver works fine with versions up to 1.0.27. I have the card
running on a daily base with current kernel versions.
Flo
--
Machines can do the work, so people have time to think.
public key 8D073185 x-hkp://subkeys.pgp.net
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can't get capturing from RME Hammerfall MADI card to work: sound loops & silcence
2013-09-27 7:47 ` Florian Faber
@ 2013-10-02 15:16 ` Jörn Nettingsmeier
2013-10-08 3:59 ` Bruce
1 sibling, 0 replies; 6+ messages in thread
From: Jörn Nettingsmeier @ 2013-10-02 15:16 UTC (permalink / raw)
To: alsa-devel
On 09/27/2013 09:47 AM, Florian Faber wrote:
> Clemens,
>
>>> Similar issues here, but can add it all seems to work absolutely fine with
>>> alsa 1.0.15, but fails with 1.0.18+.
>> This sound like some change in the driver introduced a bug.
>
> the driver works fine with versions up to 1.0.27. I have the card
> running on a daily base with current kernel versions.
same here, although mine is a bit older (lspci says rev d2).
current 3.10.x and 3.11 kernels, alsa at 1.0.26.
niels, pretty much everyone who uses such hardware on linux will be
running jack. can i suggest you run a brief check with jack, and then
maybe look at its backend implementation to find out where stuff goes wrong?
--
Jörn Nettingsmeier
Lortzingstr. 11, 45128 Essen, Tel. +49 177 7937487
Meister für Veranstaltungstechnik (Bühne/Studio)
Tonmeister VDT
http://stackingdwarves.net
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can't get capturing from RME Hammerfall MADI card to work: sound loops & silcence
2013-09-27 7:47 ` Florian Faber
2013-10-02 15:16 ` Jörn Nettingsmeier
@ 2013-10-08 3:59 ` Bruce
1 sibling, 0 replies; 6+ messages in thread
From: Bruce @ 2013-10-08 3:59 UTC (permalink / raw)
To: Florian Faber, alsa-devel
On 27/09/2013 5:47 PM, Florian Faber wrote:
> Clemens,
>
>>> Similar issues here, but can add it all seems to work absolutely fine with
>>> alsa 1.0.15, but fails with 1.0.18+.
>> This sound like some change in the driver introduced a bug.
> the driver works fine with versions up to 1.0.27. I have the card
> running on a daily base with current kernel versions.
Hi Flo (or driver developers),
I cannot get our card to work with alsa 1.0.27 (or 1.0.18), but it does
work fine with 1.0.15. I'm trying to work out what could be different
from my setup to yours. I have tried different PCs, different Linux
distributions and two different HDSP cards.
I'm using a HDSPe MADI Rev1.1 loaded with the latest firmware. Is yours
the same ?
May I send you a particular application to attempt running on your
system with 1.0.27 and see if it works ?
*Note* I can use all parts of 1.0.27 (eg, lib, alsamixer, aplay)
/except/ for the Hammerfall driver (remains at 1.0.15) and it still
works for me. I cannot install the new driver under an older kernel due
to incompatibilities, but trying 1.0.18 or 1.0.27 (including later
driver) with a newer kernel fails.
I thought if I could somehow get the 1.0.15 hammerfall driver working
with a new kernel (help ??) I could then somehow step through the
subsequent changes made to the driver one by one till it breaks. This
approach could take some considerable time, so any pointers as to how to
do this would be much appreciated ! I do not profess to know much about
alsa driver development, or how to even access the (svn ?) revision
steps, but this might be the only way to work out what is happening here.
Cheers,
Bruce
PS: I will also ask the Hammerfall Linux forum, but that seems a bit
inactive now.
>
>
> Flo
--
Cheers,
Bruce
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-10-08 3:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-27 6:08 Can't get capturing from RME Hammerfall MADI card to work: sound loops & silcence Niels Laukens
2013-09-27 7:07 ` bruce
2013-09-27 7:43 ` Clemens Ladisch
2013-09-27 7:47 ` Florian Faber
2013-10-02 15:16 ` Jörn Nettingsmeier
2013-10-08 3:59 ` Bruce
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).