[Jack-Devel] Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Jack-Devel] Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

yuri@rawbw.com
Jack runs on FreeBSD 11 with this command line: jackd -r -doss -r48000
-p1024 -n3 -w16 --capture /dev/dsp6 --playback /dev/dsp2
Sound recorded with this command 'jack_rec -f x.wav system:capture_1' is
too high pitched compared to the original.
Recording using the 'sweep' app produces the correct pitch.

What is wrong? How to fix?

jack-0.124.1 installed from the FreeBSD port.

Yuri
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

Harry van Haaren
On Mon, Jan 9, 2017 at 12:43 AM, Yuri <[hidden email]> wrote:
>
> Jack runs on FreeBSD 11 with this command line: jackd -r -doss -r48000 -p1024 -n3 -w16 --capture /dev/dsp6 --playback /dev/dsp2
> Sound recorded with this command 'jack_rec -f x.wav system:capture_1' is too high pitched compared to the original.
> Recording using the 'sweep' app produces the correct pitch.
>
> What is wrong? How to fix?

I would guess that the samplerate is not matching the actual - either in the OSS backend, or in the recorded materials settings. Given that jack_rec records fine on Linux, I would guess that OSS backend isn't acquiring 48000 Hz sampling rate, but falling back to 44100 silently.

Then playing the content back (with jack_rec recording as if it was 48000, and hence writing that as a .wav header ) would result in high pitched playback..

> jack-0.124.1 installed from the FreeBSD port.

Unfortunatly I don't have a FreeBSD machine here to test - but look into the sampling rates, and test 44100 to see if that works as expected.

Hope that helps, -Harry

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

yuri@rawbw.com
On 01/08/2017 16:48, Harry van Haaren wrote:

> I would guess that the samplerate is not matching the actual - either
> in the OSS backend, or in the recorded materials settings. Given that
> jack_rec records fine on Linux, I would guess that OSS backend isn't
> acquiring 48000 Hz sampling rate, but falling back to 44100 silently.
>
> Then playing the content back (with jack_rec recording as if it was
> 48000, and hence writing that as a .wav header ) would result in high
> pitched playback..
>
> > jack-0.124.1 installed from the FreeBSD port.
>
> Unfortunatly I don't have a FreeBSD machine here to test - but look
> into the sampling rates, and test 44100 to see if that works as expected.

-r44100 also has the same problem. As a comparison, sweep records with
48000 fine.


Yuri

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

yuri@rawbw.com
In reply to this post by yuri@rawbw.com
On 01/08/2017 16:43, Yuri wrote:
> Jack runs on FreeBSD 11 with this command line: jackd -r -doss -r48000
> -p1024 -n3 -w16 --capture /dev/dsp6 --playback /dev/dsp2
> Sound recorded with this command 'jack_rec -f x.wav system:capture_1'
> is too high pitched compared to the original.
> Recording using the 'sweep' app produces the correct pitch.
>
> What is wrong? How to fix?
>
> jack-0.124.1 installed from the FreeBSD port.


I found what's happening: pretty much what Harry van Haaren described it
in his reply.

My OSS device with the mike doesn't accept 48000. During
sysctl(SNDCTL_DSP_SPEED) it always falls back to 32000. Jack fails to
process this properly and records the signal with the wrong pitch. If
the requested speed is >32000 the pitch it is recording is higher, and
for requested speeds <32000 the pitch is too low. It only records fine
with the speed 32000.

Bug#1: Jack shouldn't create recordings with invalid speed, so this is a
bug in Jack.


Bug#2: The other DSP device also falls back, but to another speed:
48000. So they are always different. Ardour5 app fails to work with Jack
in such conditions - sound is always distorted. Depending on how it is
supposed to be in such situation, this is either a bug in Jack, or in
Ardour. But Ardour assumes all speeds are the same during one session,
so Jack probably shoud disallow mismatching speeds.


One more thing: turning off SNDCTL_DSP_COOKEDMODE cures the situation
completely (probably with the quality tradeoff). Driver converts speeds
to the requested ones. Jack should 1) have an option to turn COOKEDMODE
off, and 2) recommend such option as a workaround when read/write speeds
are different, so that it can be used at all with the low quality audio
hardware (purely as a workaround mode).


Yuri

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

Hans Petter Selasky-2
On 01/09/17 07:06, Yuri wrote:
> During sysctl(SNDCTL_DSP_SPEED)

FYI:

The "speed" integer is updated to the actual rate when the
SNDCTL_DSP_SPEED IOCTL returns. I think this behaviour is the expected.
Jackd should use this returned rate. An alternative would be to use
FreeBSD's virtual_oss to wrap the DSP device.

--HPS
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

Chris Caudle
In reply to this post by yuri@rawbw.com
On Mon, January 9, 2017 12:06 am, Yuri wrote:
> My OSS device with the mike doesn't accept 48000. During
> sysctl(SNDCTL_DSP_SPEED) it always falls back to 32000. Jack fails to
> process this properly and records the signal with the wrong pitch.

I looked back at your first email and you never showed the entire output
from jackd as it starts.  The console messages printed should display the
determined paramaters.  On ALSA systems there is a message showing what
sample rate is used if it is not the same as the sample rate requested.
Maybe OSS does not return that information.  That would be a limitation of
OSS or maybe an error in the jackd OSS driver, not a generic jackd
problem.  I have never heard of anyone using the OSS driver, how many
users of that are there?

--
Chris Caudle


_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

Dan MacDonald-3
I'm very interested in Yuri's results as I'd like to use JACK under FreeBSD. Supposedly (theoretically) both Ardour 5 and MusE 3 git should be able to run under FreeBSD these days.

Anyone using JACK under BSD is dependent upon JACK's OSS driver but last time I tried JACK under a FBSD 11 pre-release it failed to start at all. I haven't tried it since 11-RELEASE.

On Mon, Jan 9, 2017 at 4:16 PM, Chris Caudle <[hidden email]> wrote:
On Mon, January 9, 2017 12:06 am, Yuri wrote:
> My OSS device with the mike doesn't accept 48000. During
> sysctl(SNDCTL_DSP_SPEED) it always falls back to 32000. Jack fails to
> process this properly and records the signal with the wrong pitch.

I looked back at your first email and you never showed the entire output
from jackd as it starts.  The console messages printed should display the
determined paramaters.  On ALSA systems there is a message showing what
sample rate is used if it is not the same as the sample rate requested.
Maybe OSS does not return that information.  That would be a limitation of
OSS or maybe an error in the jackd OSS driver, not a generic jackd
problem.  I have never heard of anyone using the OSS driver, how many
users of that are there?

--
Chris Caudle


_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org


_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

Adrian Knoth
In reply to this post by Chris Caudle
On 01/09/17 17:16, Chris Caudle wrote:

> On Mon, January 9, 2017 12:06 am, Yuri wrote:
>> My OSS device with the mike doesn't accept 48000. During
>> sysctl(SNDCTL_DSP_SPEED) it always falls back to 32000. Jack fails to
>> process this properly and records the signal with the wrong pitch.
>
> I looked back at your first email and you never showed the entire
> output from jackd as it starts.  The console messages printed should
> display the determined paramaters.  On ALSA systems there is a message
> showing what sample rate is used if it is not the same as the sample
> rate requested. Maybe OSS does not return that information.  That
> would be a limitation of OSS or maybe an error in the jackd OSS
> driver, not a generic jackd problem.  I have never heard of anyone
> using the OSS driver, how many users of that are there?

Back in the days, the consensus was "We're already overloaded with
making ALSA work, OSS has exactly zero priority". There was even talk to
delete the OSS code entirely.

I vaguely recall that folks were using jackd2 instead, but maybe I'm
making this up.

What I'm trying to say here is: to the best of my knowledge, there's
nobody on the jack team who cares about OSS, at least not in the context
of jackd1. You're most likely on your own.

I agree that this is potentially a shortcoming in jackd's OSS driver, so
whoever needs this is invited to send in a patch. Don't expect any of
the existing jackd devs to fix it for you, this is simply unrealistic.


Cheers
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

yuri@rawbw.com
In reply to this post by Chris Caudle
On 01/09/2017 02:38, Hans Petter Selasky wrote:
>
> FYI:
>
> The "speed" integer is updated to the actual rate when the
> SNDCTL_DSP_SPEED IOCTL returns. I think this behaviour is the
> expected. Jackd should use this returned rate. An alternative would be
> to use FreeBSD's virtual_oss to wrap the DSP device.
>
> --HPS

Yes, so Jack should use the adjusted value as an actual value. It should
also decide what does it do when the adjusted values for input and
output are different. It should probably fail and have the way to work
around, to disable SNDCTL_DSP_COOKEDMODE. It should provide and suggest
the option to prevent the COOKEDMODE.


On 01/09/2017 08:16, Chris Caudle wrote:
> I looked back at your first email and you never showed the entire output
> from jackd as it starts.  The console messages printed should display the
> determined paramaters.  On ALSA systems there is a message showing what

arguments: -r -doss -r44100 -p1024 -n3 -w16 --capture /dev/dsp6
--playback /dev/dsp2
output:
 > jackd 0.124.1
 > Copyright 2001-2009 Paul Davis, Stephane Letz, Jack O'Quinn, Torben
Hohn and others.
 > jackd comes with ABSOLUTELY NO WARRANTY
 > This is free software, and you are welcome to redistribute it
 > under certain conditions; see the file COPYING for details
 >
 > JACK compiled with System V SHM support.
 > loading driver ..
 > oss_driver: /dev/dsp6 : 0x10/2/32000 (4096)
 > oss_driver: /dev/dsp2 : 0x10/2/48000 (4096)
 > oss_driver: indevbuf 4096 B, outdevbuf 4096 B
 > oss_driver: not using barrier mode, (single thread)


> sample rate is used if it is not the same as the sample rate requested.
> Maybe OSS does not return that information.  That would be a limitation of
> OSS or maybe an error in the jackd OSS driver, not a generic jackd
> problem.  I have never heard of anyone using the OSS driver, how many
> users of that are there?


FreeBSD uses OSS. When people try using Jack the often fail. So I am
trying to figure out what is wrong.


On 01/09/2017 08:26, Dan MacDonald wrote:
> I'm very interested in Yuri's results as I'd like to use JACK under
> FreeBSD. Supposedly (theoretically) both Ardour 5 and MusE 3 git
> should be able to run under FreeBSD these days.
>
> Anyone using JACK under BSD is dependent upon JACK's OSS driver but
> last time I tried JACK under a FBSD 11 pre-release it failed to start
> at all. I haven't tried it since 11-RELEASE.

With the rc script
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215889 it is easy to
start. The other possible problems are the speed adjustment this thread
is about, and the realtime priority the other thread is about (-r avoids
it).


Yuri
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

Hans Petter Selasky-2
In reply to this post by Adrian Knoth
Hi Adrian,

On 01/09/17 18:24, Adrian Knoth wrote:
> What I'm trying to say here is: to the best of my knowledge, there's
> nobody on the jack team who cares about OSS, at least not in the context
> of jackd1. You're most likely on your own.

I'm using jack1 almost every week with FreeBSD and OSS. I would happily
be glad to contribute a better OSS experience with FreeBSD, where OSS is
the de-facto audio standard. Maybe you could give some FreeBSD devs a
few src bits for jack1? The FreeBSD team has a bunch of OSS patches
already waiting for upstream:

https://svnweb.freebsd.org/ports/head/audio/jack/files/

--HPS
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

Adrian Knoth
On Mon, Jan 09, 2017 at 07:19:10PM +0100, Hans Petter Selasky wrote:

> On 01/09/17 18:24, Adrian Knoth wrote:
> >What I'm trying to say here is: to the best of my knowledge, there's
> >nobody on the jack team who cares about OSS, at least not in the context
> >of jackd1. You're most likely on your own.
>
> I'm using jack1 almost every week with FreeBSD and OSS. I would happily be
> glad to contribute a better OSS experience with FreeBSD, where OSS is the
> de-facto audio standard. Maybe you could give some FreeBSD devs a few src
> bits for jack1?

What do you need specifically? The generic entry point would be

   https://github.com/jackaudio/jack1

Compilation details in

   http://jackaudio.org/downloads/


> The FreeBSD team has a bunch of OSS patches already waiting
> for upstream:
>
> https://svnweb.freebsd.org/ports/head/audio/jack/files/

While going over this list, I've found that we're doing
HAVE_CLOCK_GETTIME wrong on Linux (same for HAVE_CLOCK_NANOSLEEP).

I'll send a patch shortly.

This again proves that OS diversity is good to spot errors.

Can the other jack devs skim said list as well and import whatever looks
reasonable?


Cheers

--
mail: [hidden email]   http://adi.thur.de        PGP/GPG: key via keyserver

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

Adrian Knoth
On Tue, Jan 10, 2017 at 11:38:56AM +0100, Hans Petter Selasky wrote:

> >>I'm using jack1 almost every week with FreeBSD and OSS. I would happily be
> >>glad to contribute a better OSS experience with FreeBSD, where OSS is the
> >>de-facto audio standard. Maybe you could give some FreeBSD devs a few src
> >>bits for jack1?
> >What do you need specifically? The generic entry point would be
> >   https://github.com/jackaudio/jack1
> If you want to add me to the devs team, my github nick is "hselasky"

Looking forward to your contributions! Let's start with pull requests,
so that we can discuss patches prior to merging them.


Cheers

--
mail: [hidden email]   http://adi.thur.de        PGP/GPG: key via keyserver

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recorded from OSS /dev/dsp sound is too high pitched on FreeBSD

Hans Petter Selasky-2
On 01/10/17 20:55, Adrian Knoth wrote:

> On Tue, Jan 10, 2017 at 11:38:56AM +0100, Hans Petter Selasky wrote:
>
>>>> I'm using jack1 almost every week with FreeBSD and OSS. I would happily be
>>>> glad to contribute a better OSS experience with FreeBSD, where OSS is the
>>>> de-facto audio standard. Maybe you could give some FreeBSD devs a few src
>>>> bits for jack1?
>>> What do you need specifically? The generic entry point would be
>>>   https://github.com/jackaudio/jack1
>> If you want to add me to the devs team, my github nick is "hselasky"
>
> Looking forward to your contributions! Let's start with pull requests,
> so that we can discuss patches prior to merging them.
>

OK. I'll put up some requests there when I find some time. Thank you for
the pointer.

--HPS

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Loading...