recieving audio via Jack

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

recieving audio via Jack

Wesly Van Eycken

Hello,

I'm writing a program for testing hearing aids, I'm testing some code for sending and receiving audio with jack. For testing I have made a connection between the output and input with a jack cable, I send a sinusoid and the sinusoid i receive has other values.  Someone told me that when when audio flows reached the input port, he soundcard amplifies the data, because it expects rather small signals.  When i look a little bit closer to my KMix, I have maxed all the output and input sliders i use, and I have deselected the option for a boost of 20dB for the mic-signal . When I try to look at the spec of my soundcard(Intel 82801DB-ICH4), I find nothing of amplifications of incoming audio. My questions are: For the input of audio, which input port is better, the line or mic?  Is something wrong with my code(process method below, the entire class in the attachment)?  Is my assumption right that there is an amplification and where do I found data about this?
Any help would be really helpfull, my promoter is getting cranky:)

Greetz Wes.

int
process (jack_nframes_t nframes, void *arg)
{
        jack_default_audio_sample_t *in[MAX_CHANNELS], *out[MAX_CHANNELS];
       
        for(i=0;icycleCount*bufferSize){
       
                for(i=0;icycleCount*bufferSize){
       
                for(i=0;i
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel

MyJack.c (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: recieving audio via Jack

Nicolau Werneck
You should always use the line-in port.  The standard compute mic port
is intended to be used with an electret microphone, is monophonic in
spite of the stereo jack used, and has a power source, not to mention
the amplifier. The line-in is the one intended to be used with the
same kind of signal that comes from the audio output port ('line'
level signal).

First of all, is your output working OK? Have you listened to the
sinusoids already? Are they quite loud and clear? And annoying? Watch
out, don't listen to this thing too much! Or you will be the one
needing a hearing doctor! :)

You should be able to measure the output level with a standard
multimeter. It should give you something around 1Vrms, and this is the
approximate level the line-in port expects.

You should also try to use other softwares to make this process work
before trying your own. For example, you should be able to create a
feedback in your system by simply making the line-in line-out loop,
and configuring the mixer the proper way: mixing the input to the
output  (some people call this "monitoring", because you can listen to
the recording as it is done), and putting enough gain to make the
system unstable.

You should try to play some audio file with jack.play or mplayer, and
then try to re-record it with jackrec.

Only after you did enough tests like this we will be able to say that
your setup is OK and that it must be your program the flawed part...

In case it doesn't work, you might ask your promoter to buy you one of
those cute external USB sound devices such as the M-audio fast-track
pro! =)   (this one I'm pretty sure is capable to do what you want)

http://philogroky.blogspot.com/2008/01/testing-m-audio-fast-track-pro.html


Another test you could do: change the mixer setting while your are
recording. Does the level obtained vary linearly with the output
level?... Is it simply a constant attenuation? If not, then it might
be something stranger like a software bug...

And about the wav file, I recommend that you try some other for of
generating signals first, just to make sure things are working. It can
be just plain white noise, for example, or a square wave, or
sawtooth... generate a wave right at the moment you write at the
boffers, because you will be sure there can't be a problem related to
opening the WAV file and converting things... It's always better to
make things simples at the beginnig, to reduce the number of possible
errors, and make it easier to locate the inevitable Murphy phenomenon
in your production. ;)

see you,

   ++nicolau





On Mon, Feb 25, 2008 at 10:35 AM, Wesly Van Eycken
<[hidden email]> wrote:

>
>  Hello,
>
>  I'm writing a program for testing hearing aids, I'm testing some code for sending and receiving audio with jack. For testing I have made a connection between the output and input with a jack cable, I send a sinusoid and the sinusoid i receive has other values.  Someone told me that when when audio flows reached the input port, he soundcard amplifies the data, because it expects rather small signals.  When i look a little bit closer to my KMix, I have maxed all the output and input sliders i use, and I have deselected the option for a boost of 20dB for the mic-signal . When I try to look at the spec of my soundcard(Intel 82801DB-ICH4), I find nothing of amplifications of incoming audio. My questions are: For the input of audio, which input port is better, the line or mic?  Is something wrong with my code(process method below, the entire class in the attachment)?  Is my assumption right that there is an amplification and where do I found data about this?
>  Any help would be really helpfull, my promoter is getting cranky:)
>
>  Greetz Wes.
>
>  int
>  process (jack_nframes_t nframes, void *arg)
>  {
>         jack_default_audio_sample_t *in[MAX_CHANNELS], *out[MAX_CHANNELS];
>
>         for(i=0;icycleCount*bufferSize){
>
>                 for(i=0;icycleCount*bufferSize){
>
>                 for(i=0;i
>
> _________________________________________________________________
>  Express yourself instantly with MSN Messenger! Download today it's FREE!
>  http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> -------------------------------------------------------------------------
>  This SF.net email is sponsored by: Microsoft
>  Defy all challenges. Microsoft(R) Visual Studio 2008.
>  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
>  Jackit-devel mailing list
>  [hidden email]
>  https://lists.sourceforge.net/lists/listinfo/jackit-devel
>
>



--
Nicolau Werneck <[hidden email]>         9F99 25AB E47E 8724 2F71
http://www.lti.pcs.usp.br/~nwerneck                   EA40 DC23 42CE 6B76 B07F

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: recieving audio via Jack

Wesly Van Eycken
In reply to this post by Wesly Van Eycken
Hello,

first I want to thank Nicolau and Fons for the help and code they gave me, it really helped me understand lots more.  But my initial problem remains, even with the code from Fons, so I'm thinking maybe this could be a hardware problem  rather then a software one.  A quick recap: The programs sends  data (I think correctly) to the output port, when i write a sinusoid, i hear a sinusoid, and when i write noise to the port i hear noise.  Now I connect my audio output port with my line in port, and when I capture the data there, it is amplified by a lot, it is almost a blokwave(when i use a sinusoid) ans 1 and -1 when i use noise.  I found this page http://en.wikipedia.org/wiki/Line_in and this says: "Line in expects the kind of voltage level and impedance that line out provides. " So i conclude that the line in receives the code in an unaltered way (or am I wrong?).  I am checking all the smaller computation in the program to see i there is a fault i overlooked, but everything turns out as expected. So has anyone an idea why the data doesn't arrive at the input the same as send at the output?




> From: [hidden email]

> To: [hidden email]
> Date: Mon, 25 Feb 2008 14:35:37 +0100
> Subject: [Jackit-devel] recieving audio via Jack
>
>
> Hello,
>
> I'm writing a program for testing hearing aids, I'm testing some code for sending and receiving audio with jack. For testing I have made a connection between the output and input with a jack cable, I send a sinusoid and the sinusoid i receive has other values. Someone told me that when when audio flows reached the input port, he soundcard amplifies the data, because it expects rather small signals. When i look a little bit closer to my KMix, I have maxed all the output and input sliders i use, and I have deselected the option for a boost of 20dB for the mic-signal . When I try to look at the spec of my soundcard(Intel 82801DB-ICH4), I find nothing of amplifications of incoming audio. My questions are: For the input of audio, which input port is better, the line or mic? Is something wrong with my code(process method below, the entire class in the attachment)? Is my assumption right that there is an amplification and where do I found data about this?
> Any help would be really helpfull, my promoter is getting cranky:)
>
> Greetz Wes.
>
> int
> process (jack_nframes_t nframes, void *arg)
> {
> jack_default_audio_sample_t *in[MAX_CHANNELS], *out[MAX_CHANNELS];
>
> for(i=0;icycleCount*bufferSize){
>
> for(i=0;icycleCount*bufferSize){
>
> for(i=0;i
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


Express yourself instantly with MSN Messenger! MSN Messenger
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: recieving audio via Jack

Fons Adriaensen-2
On Tue, Feb 26, 2008 at 01:16:10PM +0100, Wesly Van Eycken wrote:

> Now I connect my audio output port with my line in port,
> and when I capture the data there, it is amplified by a lot,
> it is almost a blokwave(when i use a sinusoid) ans 1 and -1
> when i use noise.

Most audio cards have some analog gain controls which could be
set way too high. Check with your preferred mixer application.
Also try to send smaller signals and see what happens.

--
FA

Laboratorio di Acustica ed Elettroacustica
Parma, Italia

Lascia la spina, cogli la rosa.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: recieving audio via Jack

Nicolau Werneck
In reply to this post by Wesly Van Eycken
On Tue, Feb 26, 2008 at 9:16 AM, Wesly Van Eycken
<[hidden email]> wrote:
> Now I connect
> my audio output port with my line in port, and when I capture the data
> there, it is amplified by a lot, it is almost a blokwave(when i use a
> sinusoid) ans 1 and -1 when i use noise.

Hi, Wesly.. Let's get this thing done!! ;)

Just complementing the answer by Fons... You should try to lower your
mixer output level until the wave looks right. Can you hear the wav at
the same time you are running the process? In this case you should be
able to lower the output gain until the square wave starts to sound as
a sinusoid...

But it is quite strange that your card is able to make such a high
gain. One possibility might be a software problem. For example, you
might be taking "int"  samples from your wave file, and converting to
double. The int is limited at 2**15, and the double at 1.0!... An
incorrectly direct conversion might cause exactly this: a very high
gain... Do you swear to me with your hand over the fire that you are
reading this file correctly???...

I still think you should try to make a feedback instability oscilation
(aka "microphony")  just to test the system. And it is also useful to
know the point where your system starts to meet the Barkhausen
Criterion...  It's important to be familiar with this to avoid it!...
And of course, you avoid it by always turning off the "monitor"
option. When you are working with filters and feedback you can some
times create this feedback involuntarily, and it saves a lot of time
to be able to identify immediately that it is this what is
happening...

(I don't believe it's the case, because it wouldn't be a square wave then)


do you have MSN or gtalk?

see you,

   ++nicolau








--
Nicolau Werneck <[hidden email]>         9F99 25AB E47E 8724 2F71
http://www.lti.pcs.usp.br/~nwerneck                   EA40 DC23 42CE 6B76 B07F

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel