Skip to contentSkip to conversation

question about sampling rate

DISCUSSION Grace Baldonasa 4 participants 24 messages Jul 12, 2006 – Oct 4, 2006

lore
Share & tools
lore
#0 lore raw

Hi all,

I have a very simple question regarding the convertion of sampling rate to usb full/high speed rate, is this the right mailing list to throw the question?

any reply will be greatly appreciate.
Thanks.

grace

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#1 lore raw
Quoted 9 lines · Grace Baldonasa

Hi all,

I have a very simple question regarding the convertion of sampling rate to usb full/high speed rate, is this the right mailing list to throw the question?

any reply will be greatly appreciate.
Thanks.

You need to be a bit clearer about what it is you want to do. I assume you are referring to a sound device.

ALSA will automatically handle the sample rate - converting between the sample rate of the sound you want to play and the capabilities of your device as specified by the driver.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#2 lore raw

Hi,

Yes I am referring to the audio class driver. I actually would want to understand about this:

/*
* convert a sampling rate into USB high speed format (fs/8000 in Q16.16)
* this will overflow at approx 4 MHz
*/
inline static unsigned get_usb_high_speed_rate(unsigned int rate) {
return ((rate << 10) + 62) / 125;
}

and

/*
* convert a sampling rate into our full speed format (fs/1000 in Q16.16)
* this will overflow at approx 524 kHz
*/
inline static unsigned get_usb_full_speed_rate(unsigned int rate) {
return ((rate << 13) + 62) / 125;
}

I have no clue as to why rate was shifted by 13 then added by 62 then divided by 125.
I will be writing an embedded linux audio class driver and would like to simplify the alsa since it is a bit complex and many features may not be applicable for our use.

Thank you for any help extended.

Quoted 12 lines · Adrian McMenamin
Quoted 3 lines · Grace Baldonasa

Hi all,

I have a very simple question regarding the convertion of sampling rate

to

Quoted 6 lines

usb full/high speed rate, is this the right mailing list to throw the question?

any reply will be greatly appreciate.
Thanks.

Quoted 8 lines

You need to be a bit clearer about what it is you want to do. I assume you are referring to a sound device.

ALSA will automatically handle the sample rate - converting between the sample rate of the sound you want to play and the capabilities of your device as specified by the driver.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#3 lore raw
Quoted 11 lines · Grace Baldonasa

/*
* convert a sampling rate into our full speed format (fs/1000 in Q16.16)
* this will overflow at approx 524 kHz
*/
inline static unsigned get_usb_full_speed_rate(unsigned int rate) {
return ((rate << 13) + 62) / 125;
}

I have no clue as to why rate was shifted by 13 then added by 62 then divided by 125.

The parameter is in Hz. To convert to the number of samples per USB frame, we have to divide by 1000. To convert to a 16.16-fixed-point number, we have to multiply by 2^16. This would result in "rate * 0x10000 / 1000". Factoring out 8 yields "rate * 0x2000 / 125". The multiplication by a power of two can be replaced by a bitwise left shift. The "+62" prevents the division from rounding down.

HTH
Clemens

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#4 lore raw

Hi,

Thank you so much. Really appreciate this. I have my last clarification to be made.

After computing the rate, value could be of decimal format, is it rounded off to either equal or greater than the whole number itself?

/>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
subs->freqmax = subs->freqn + (subs->freqn >> 2); /* max. allowed frequency */
Q: why is subs->freqn shifted by 2

subs->phase = 0;
/* calculate the max. size of packet */
maxsize = ((subs->freqmax + 0xffff) * (frame_bits >> 3)) >> 16;

Q: why subs->freqmax is added with 0xffff, then frame_bits is shifted by 3 then the whole thing shifted by 16.

<<<<<<<<<<<<<<<<<<<<<<<<<<<</

I understand that this value is used to determine the maxpacketsize, and I want to understand why is this so?
I really appreciate any help from you guys.

regards,
grace

Quoted 22 lines · Clemens Ladisch
Quoted 11 lines · Grace Baldonasa

/*
* convert a sampling rate into our full speed format (fs/1000 in Q16.16)
* this will overflow at approx 524 kHz
*/
inline static unsigned get_usb_full_speed_rate(unsigned int rate) {
return ((rate << 13) + 62) / 125;
}

I have no clue as to why rate was shifted by 13 then added by 62 then divided by 125.

The parameter is in Hz. To convert to the number of samples per USB frame, we have to divide by 1000. To convert to a 16.16-fixed-point number, we have to multiply by 2^16. This would result in "rate * 0x10000 / 1000". Factoring out 8 yields "rate * 0x2000 / 125". The multiplication by a power of two can be replaced by a bitwise left shift. The "+62" prevents the division from rounding down.

Quoted 3 lines

HTH
Clemens

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#5 lore raw
Quoted 1 line · Grace Baldonasa

After computing the rate, value could be of decimal format,

In the computer, all values are binary.

Quoted 2 lines

is it rounded off to either equal or greater than the whole number itself?

There is no whole number, it is interpreted as a number with 16 binary fractional digits.

Quoted 2 lines

subs->freqmax = subs->freqn + (subs->freqn >> 2);
Q: why is subs->freqn shifted by 2

It's just subs->freqn plus 25 percent, and that is just some random value that should be safe enough for any real sample clock.

Quoted 6 lines

subs->phase = 0;
/* calculate the max. size of packet */
maxsize = ((subs->freqmax + 0xffff) * (frame_bits >> 3)) >> 16;

Q: why subs->freqmax is added with 0xffff, then frame_bits is shifted by 3 then the whole thing shifted by 16.

It's shifted by 16 to throw away the fractional digits; we calculate whole bytes.
"frame_bits/8" is the number of bytes per frame.
Adding 0xffff ensures that despite the truncation by the final shift, the value is rounded up.

HTH
Clemens

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#6 lore raw

Hi Clemens,

Really appreciate your time answering my question. I have already started my streaming and is facing another problem now.

Fs = 11025 Hz
Channel = 2
Bit resolution = 8

so I tried sending my data at (11025/1000) * 2 / ms, I could hear some music played but with some noise.

I am using Philips Speaker with MaxPackSize = 56, channel = 2, sampling bits =16, so I decided to change my framesize:

11025 /1000 * 2 * 16/8 / ms -> 44, this time, I cant understand the music out. The endpoint should still be able to handle it since data rate is lesser than maxpacksize.

Do you know what went wrong here? hope to receive your advise. thank...

grace

Quoted 33 lines · Clemens Ladisch
Quoted 1 line · Grace Baldonasa

After computing the rate, value could be of decimal format,

In the computer, all values are binary.

Quoted 2 lines

is it rounded off to either equal or greater than the whole number itself?

There is no whole number, it is interpreted as a number with 16 binary fractional digits.

Quoted 2 lines

subs->freqmax = subs->freqn + (subs->freqn >> 2);
Q: why is subs->freqn shifted by 2

It's just subs->freqn plus 25 percent, and that is just some random value that should be safe enough for any real sample clock.

Quoted 5 lines

subs->phase = 0;
/* calculate the max. size of packet */
maxsize = ((subs->freqmax + 0xffff) * (frame_bits >> 3)) >> 16;

Q: why subs->freqmax is added with 0xffff, then frame_bits is shifted by

3

Quoted 1 line

then the whole thing shifted by 16.

It's shifted by 16 to throw away the fractional digits; we calculate whole bytes.
"frame_bits/8" is the number of bytes per frame.
Adding 0xffff ensures that despite the truncation by the final shift, the value is rounded up.

Quoted 3 lines

HTH
Clemens

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#7 lore raw
Quoted 4 lines · Grace Baldonasa

I am using Philips Speaker with MaxPackSize = 56, channel = 2, sampling bits =16, so I decided to change my framesize:

11025 /1000 * 2 * 16/8 / ms -> 44,

44.1

Quoted 1 line

this time, I cant understand the music out.

How did you set the sample format? Are there endpoint-specific controls?

Quoted 2 lines

The endpoint should still be able to handle it since data rate is lesser than maxpacksize.

How do you handle the fractional part of the frame size?

Is this an adaptive endpoint, or what synchronization type does it have?

Regards,
Clemens

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#8 lore raw

Hi Clemens,

I am not yet handling the fractional part of frame size, would it be cause of the distorted sound? I was expecting to hear music with some noise though, but nothing good is coming this time.

The endpoint says, adaptive synchrnonization, but no address is defined in the syncaddress field of the endpoint descriptor.

Do i have to consider the synchronization before I could hear some music in my streamed data?
Thanks for all the help.

regards,

grace

Quoted 8 lines · Clemens Ladisch
Quoted 4 lines · Grace Baldonasa

I am using Philips Speaker with MaxPackSize = 56, channel = 2, sampling bits =16, so I decided to change my framesize:

11025 /1000 * 2 * 16/8 / ms -> 44,

44.1

yes you're right.

Quoted 4 lines

this time, I cant understand the music out.

How did you set the sample format? Are there endpoint-specific controls?

no endpoint specific control is set. sample format is based on the max sampling frequency from the format descriptor.

Quoted 11 lines

The endpoint should still be able to handle it since data rate is

Quoted 1 line

lesser than maxpacksize.

How do you handle the fractional part of the frame size?

Is this an adaptive endpoint, or what synchronization type does it have?

Regards,
Clemens

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#9 lore raw
Quoted 2 lines · Grace Baldonasa

I am not yet handling the fractional part of frame size, would it be cause of the distorted sound?

There shouldn't be too much noise in this case.

Quoted 1 line

The endpoint says, adaptive synchrnonization,

Then it should be able to handle a frequency that is 0.25% off.

Quoted 5 lines
Quoted 2 lines

How did you set the sample format? Are there endpoint-specific controls?

no endpoint specific control is set. sample format is based on the max sampling frequency from the format descriptor.

Did you set the altsetting, or how does the device know about the current sample format?

Regards,
Clemens

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#10 lore raw

Hi Clemens,

yes, i did set the alternate setting. The currrent endpoint should be able to handle the stream data since the maxpacketsize is 56, the max sampling rate it support is 55kHz, but as I mentioned in my previous email, it's only noise that I can hear from the speaker.

I used a converted raw data in hex format, I am not really sure what is the sampling bit, sampling rate or number of channels used when conversion was made to the raw data, I am in doubt the sampling bit / channels does not fit with my experimentations.

Can you recommend some application that will allow me to convert small wav to hex as array of characters that I could use to stream.

Thank you very much once again,

grace

Quoted 18 lines · Clemens Ladisch
Quoted 1 line · Grace Baldonasa

I am not yet handling the fractional part of frame size, would it be

cause

Quoted 1 line

of the distorted sound?

There shouldn't be too much noise in this case.

Quoted 1 line

The endpoint says, adaptive synchrnonization,

Then it should be able to handle a frequency that is 0.25% off.

Quoted 5 lines
Quoted 2 lines

How did you set the sample format? Are there endpoint-specific controls?

no endpoint specific control is set. sample format is based on the max sampling frequency from the format descriptor.

Quoted 7 lines

Did you set the altsetting, or how does the device know about the current sample format?

Regards,
Clemens

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#11 lore raw
Quoted 4 lines · Grace Baldonasa

yes, i did set the alternate setting. The currrent endpoint should be able to handle the stream data since the maxpacketsize is 56, the max sampling rate it support is 55kHz, but as I mentioned in my previous email, it's only noise that I can hear from the speaker.

What is the output of "lsusb -v" for this device?

Quoted 7 lines

I used a converted raw data in hex format, I am not really sure what is the sampling bit, sampling rate or number of channels used when conversion was made to the raw data, I am in doubt the sampling bit / channels does not fit with my experimentations.

Can you recommend some application that will allow me to convert small wav to hex as array of characters that I could use to stream.

Some Python script like this:

f = open("something.wav", "rb")
while 1:

	c = f.read(1)
	if not c:
		break
	print "0x%02x," % ord(c)

f.close()

HTH
Clemens

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#12 lore raw

Hi Clemens,

I am half way my development. I can stream music using dynamic settings (any speaker plugged in to my host be heard of some music when my application is streaming some audio data). However, there are still background noise I am hearing. Here is how I computed my streaming size:

sampling rate = 44100
channel = 2
bit resolution = 16
period length = 20 ms
period size = 3528

This period size is used as my buffer size, and this is sliced as it is streamed to my device.
I have not considered any sychronization yet. Here is the speaker configuration:
Synchronization type = adaptive sync
polling interval = 1 ms
refresh = 00
syncaddress = 0

My understanding is no sync pipe is defined by the device, therefore I dont need to schedule any sync data, am I correct?
I hope I can be given some enlightenment in this issue. Any help will be greatly appreciated.
Thank you very much.

regards,

Grace

Quoted 32 lines · Clemens Ladisch
Quoted 1 line · Grace Baldonasa

yes, i did set the alternate setting. The currrent endpoint should be

able

Quoted 1 line

to handle the stream data since the maxpacketsize is 56, the max

sampling

Quoted 1 line

rate it support is 55kHz, but as I mentioned in my previous email, it's

only

Quoted 1 line

noise that I can hear from the speaker.

What is the output of "lsusb -v" for this device?

Quoted 1 line

I used a converted raw data in hex format, I am not really sure what is

the

Quoted 1 line

sampling bit, sampling rate or number of channels used when conversion

was

Quoted 1 line

made to the raw data, I am in doubt the sampling bit / channels

does not

Quoted 3 lines

fit with my experimentations.

Can you recommend some application that will allow me to convert small

wav

Quoted 1 line

to hex as array of characters that I could use to stream.

Some Python script like this:

f = open("something.wav", "rb")
while 1:

       c = f.read(1)
       if not c:
               break
       print "0x%02x," % ord(c)
Quoted 6 lines

f.close()

HTH
Clemens

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#13 lore raw
Quoted 10 lines · Grace Baldonasa

I am half way my development. I can stream music using dynamic settings (any speaker plugged in to my host be heard of some music when my application is streaming some audio data). However, there are still background noise I am hearing. Here is how I computed my streaming size:

sampling rate = 44100
channel = 2
bit resolution = 16
period length = 20 ms
period size = 3528

bytes

Quoted 8 lines

This period size is used as my buffer size, and this is sliced as it is streamed to my device.
I have not considered any sychronization yet. Here is the speaker configuration:
Synchronization type = adaptive sync

My understanding is no sync pipe is defined by the device, therefore I dont need to schedule any sync data, am I correct?

Yes. An adaptive endpoint should be able to work with any sample rate, as long as it's near 44100.

How do you slice your buffer?

Regards,
Clemens

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#14 lore raw

Hi Clemens,

I am dividing the buffer size into 20 ms, in the given example, I am sending 176 bytes / packet.

I have here another scenario and I hope you can give me some idea again. I have converted a song using this configuration:
sampling rate = 32000
bit resolution = 16
channel = stereo
after this computation (32000*16*2) * 2 -> 128/packet

I used a speaker which is supporting a minimum frequency of 44100 and maximum of 48000. How can I adjust my streaming size now that the streaming configuration far below than the minimum supported by the speaker.

I attached this speaker in windows and then played the converted file, it is sending 192bytes/packet, and the total bytes transffered had almost trippled the original size of the converted file. Looks like the windows class driver had padded the data, but I dont know how to arrived to the exact number of bytes to be padded to the computed one. I hope I was able to explain my problem well.

Thanks for all the help.

regards,

grace

Quoted 28 lines · Clemens Ladisch
Quoted 1 line · Grace Baldonasa

I am half way my development. I can stream music using dynamic settings

(any

Quoted 1 line

speaker plugged in to my host be heard of some music when my application

is

Quoted 1 line

streaming some audio data). However, there are still background noise I

am

Quoted 7 lines

hearing. Here is how I computed my streaming size:

sampling rate = 44100
channel = 2
bit resolution = 16
period length = 20 ms
period size = 3528

bytes

Quoted 7 lines

This period size is used as my buffer size, and this is sliced as it is streamed to my device.
I have not considered any sychronization yet. Here is the speaker configuration:
Synchronization type = adaptive sync

My understanding is no sync pipe is defined by the device, therefore I

dont

Quoted 1 line

need to schedule any sync data, am I correct?

Quoted 9 lines

Yes. An adaptive endpoint should be able to work with any sample rate, as long as it's near 44100.

How do you slice your buffer?

Regards,
Clemens

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#15 lore raw
Quoted 2 lines · Grace Baldonasa

I am dividing the buffer size into 20 ms, in the given example, I am sending 176 bytes / packet.

This would correspond to a sample rate of 44000 Hz.

You cannot use a constant number of bytes per packet at 44100 Hz.

Quoted 10 lines

I have here another scenario and I hope you can give me some idea again. I have converted a song using this configuration:
sampling rate = 32000
bit resolution = 16
channel = stereo
after this computation (32000*16*2) * 2 -> 128/packet

I used a speaker which is supporting a minimum frequency of 44100 and maximum of 48000. How can I adjust my streaming size now that the streaming configuration far below than the minimum supported by the speaker.

See section 5.12 of the USB 2.0 specification.

Quoted 3 lines

I attached this speaker in windows and then played the converted file, it is sending 192bytes/packet, and the total bytes transffered had almost trippled the original size of the converted file.

Apparently, Windows has converted the data to 48 kHz.

Regards,
Clemens

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#16 lore raw

Hi Clemens,

What do you mean when you said Windows had converted it to 48000 Hz, you mean the audio data itself is converted or just the sampling rate factor in the computation.

When I took a CATC trace using ALSA version, it is also using a fixed 176 bytes / packet, I am missing something here? I hope you can help me sort out my confusion.

Thanks & Best regards,

Grace

Quoted 25 lines · Clemens Ladisch
Quoted 2 lines · Grace Baldonasa

I am dividing the buffer size into 20 ms, in the given example, I am sending 176 bytes / packet.

This would correspond to a sample rate of 44000 Hz.

You cannot use a constant number of bytes per packet at 44100 Hz.

Quoted 9 lines

I have here another scenario and I hope you can give me some idea again. I have converted a song using this configuration:
sampling rate = 32000
bit resolution = 16
channel = stereo
after this computation (32000*16*2) * 2 -> 128/packet

I used a speaker which is supporting a minimum frequency of 44100 and maximum of 48000. How can I adjust my streaming size now that the

streaming

Quoted 1 line

configuration far below than the minimum supported by the speaker.

See section 5.12 of the USB 2.0 specification.

Quoted 1 line

I attached this speaker in windows and then played the converted file,

it

Quoted 9 lines
Quoted 2 lines

is sending 192bytes/packet, and the total bytes transffered had almost trippled the original size of the converted file.

Apparently, Windows has converted the data to 48 kHz.

Regards,
Clemens

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#17 lore raw
Quoted 3 lines · Grace Baldonasa

What do you mean when you said Windows had converted it to 48000 Hz, you mean the audio data itself is converted or just the sampling rate factor in the computation.

Windows likes to convert the data to the highest sample rate supported by the device so that the audio quality doesn't suffer when a stream with a higher sample rater must be mixed in later.

Quoted 2 lines

When I took a CATC trace using ALSA version, it is also using a fixed 176 bytes / packet, I am missing something here?

For a 44.1 kHz stream, snd-usb-audio uses packets with both 176 and 180 bytes.

Regards,
Clemens

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#18 lore raw

OK!
Now I understand. Thanks for all the info.

grace

Quoted 12 lines · Clemens Ladisch
Quoted 3 lines · Grace Baldonasa

What do you mean when you said Windows had converted it to 48000 Hz, you mean the audio data itself is converted or just the sampling rate factor in the computation.

Windows likes to convert the data to the highest sample rate supported by the device so that the audio quality doesn't suffer when a stream with a higher sample rater must be mixed in later.

Quoted 1 line

When I took a CATC trace using ALSA version, it is also using a fixed

176

Quoted 9 lines
Quoted 1 line

bytes / packet, I am missing something here?

For a 44.1 kHz stream, snd-usb-audio uses packets with both 176 and 180 bytes.

Regards,
Clemens

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#19 lore raw

Hi Clemens,

Got another question, following to my previos emails, do I have to adjust my streaming size since the sampling freq used when audio data was converted is not supported by the speaker? if I do adjust the streaming size, I am compromising the bit resolution and the sampling rate already?

Thanks in advance.

regards,
grace

Quoted 34 lines · Grace Baldonasa

OK!
Now I understand. Thanks for all the info.

grace

Quoted 22 lines · Clemens Ladisch
Quoted 1 line · Grace Baldonasa

What do you mean when you said Windows had converted it to 48000 Hz,

you

Quoted 1 line

mean the audio data itself is converted or just the sampling rate

factor

Quoted 1 line

in the computation.

Windows likes to convert the data to the highest sample rate supported by the device so that the audio quality doesn't suffer when a stream with a higher sample rater must be mixed in later.

Quoted 1 line

When I took a CATC trace using ALSA version, it is also using a fixed

176

Quoted 1 line

bytes / packet, I am missing something here?

For a 44.1 kHz stream, snd-usb-audio uses packets with both 176 and 180 bytes.

Regards,
Clemens

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#20 lore raw
Quoted 3 lines · Grace Baldonasa

Got another question, following to my previos emails, do I have to adjust my streaming size since the sampling freq used when audio data was converted is not supported by the speaker?

ALSA will allow only those sample rates/formats that the driver says it supports (in the snd_pcm_hardware structure, and with any constraints set in the open callback).

HTH
Clemens

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#21 lore raw

Hi,

Do you know of any means how to test the streaming IN raw data. I am attaching a headset and could only test the speaker or streaming OUT. I need to test as well the streaming IN.

I am writing every single byte I received into a buffer, and after some period, I am streaming it out again, but I can only hear noise and no clarity in the quality of the audio captured.

My captured settings are as follows:
Sampling Freq = 48000
Channel = 1
Sampling Bit = 16

when i streamed it out, the playback settings are as follows:
Sampling Freq = 48000
Channel = 2
Sampling Bit = 16

I forcefully change the channel number to 2, would this cause any problem? Any advise can be deeply appreciated.
Thanks.

regards,

Grace

Quoted 8 lines · Clemens Ladisch
Quoted 1 line · Grace Baldonasa

Got another question, following to my previos emails, do I have to

adjust my

Quoted 1 line

streaming size since the sampling freq used when audio data was

converted is

Quoted 1 line

not supported by the speaker?

Quoted 8 lines

ALSA will allow only those sample rates/formats that the driver says it supports (in the snd_pcm_hardware structure, and with any constraints set in the open callback).

HTH
Clemens

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#22 lore raw

Hi Clemens,

Can I directly stream the recorded data as playback without going for any conversion or anything to the captured data?

I am hearing pure noise if I am streaming back directly the recorded sound that I captured. Is this an expected behaviour?

Really appreciate any advice.

Thanks,

grace

Quoted 25 lines · Grace Baldonasa

Hi,

Do you know of any means how to test the streaming IN raw data. I am attaching a headset and could only test the speaker or streaming OUT. I need to test as well the streaming IN.

I am writing every single byte I received into a buffer, and after some period, I am streaming it out again, but I can only hear noise and no clarity in the quality of the audio captured.

My captured settings are as follows:
Sampling Freq = 48000
Channel = 1
Sampling Bit = 16

when i streamed it out, the playback settings are as follows:
Sampling Freq = 48000
Channel = 2
Sampling Bit = 16

I forcefully change the channel number to 2, would this cause any problem? Any advise can be deeply appreciated.
Thanks.

Quoted 25 lines

regards,

Grace

Quoted 16 lines · Clemens Ladisch
Quoted 1 line · Grace Baldonasa

Got another question, following to my previos emails, do I have to

adjust my

Quoted 1 line

streaming size since the sampling freq used when audio data was

converted is

Quoted 1 line

not supported by the speaker?

ALSA will allow only those sample rates/formats that the driver says it supports (in the snd_pcm_hardware structure, and with any constraints set in the open callback).

HTH
Clemens

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#23 lore raw
Quoted 2 lines · Grace Baldonasa

Can I directly stream the recorded data as playback without going for any conversion or anything to the captured data?

Only if both streams use exactly the same sample format/rate.

Quoted 2 lines

I am hearing pure noise if I am streaming back directly the recorded sound that I captured. Is this an expected behaviour?

That may be a different sample format, or possibly just wrong data.

How does the recorded data look like? Do you have a file or a hexdump?

Regards,
Clemens

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV