[one part solved] which format as audio src for A2dp source example is supported?

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

[one part solved] which format as audio src for A2dp source example is supported?

Postby rudi ;-) » Thu Feb 08, 2018 6:28 pm

Hi guys

does someone know, which audio format as source is supported by the A2db source example as data?

Code: Select all

static int32_t bt_app_a2d_data_cb(uint8_t *data, int32_t len)
{
    if (len < 0 || data == NULL) {
        return 0;
    }

    // generate random sequence
    int val = rand() % (1 << 16);
    for (int i = 0; i < (len >> 1); i++) {
        data[(i << 1)] = val & 0xff;
        data[(i << 1) + 1] = (val >> 8) & 0xff;
    }

    return len;
}
- is uncompressed wav 16bit stereo supported ? MSB ?
- which source formats also supported ?
- does SBC function can read a header or RAW data only ?
- have we an option to select which source we gives the SBC encoder ?
where we must set this?

example ( where is this setup ) :
Audio channels:
--Mono (1 channel)
--Stereo (2 channels)
Audio sample type:
--Unsigned 8-bit PCM
--Signed 16-bit little endian PCM
Audio sample rate:
--8000 ~ 48000 Hz

is there likewise ?
audio_in_get_channel(), audio_in_get_sample_type() , audio_in_get_sample_rate()

- must we decode mp3 files to uncompressed 16bit stereo first to send it to the SBC encoder ?

from where the SBC encoder knows this, which (properties) PCM RAW stream is as source?

EDIT: esp_a2d_source_init
further things are in the binary BT LIB and we did not know more about details - :|
only that this is PCM stream.. perhabs i read the things wrong?



best wishes
rudi ;-)

btw:
this gives me a simple test tone ( not to loud ) without noices

Code: Select all

static int32_t bt_app_a2d_data_cb(uint8_t *data, int32_t len)
{
    if (len < 0 || data == NULL) {
        return 0;
    }

      for (int i = 0; i < (len >> 1); i++) {
        data[(i << 1)] = 0x20;
        data[(i << 1) + 1] = 0x20;

    return len;
}
Last edited by rudi ;-) on Fri Feb 09, 2018 2:48 am, edited 2 times in total.
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: which format as audio src for A2dp source example is supported?

Postby rudi ;-) » Thu Feb 08, 2018 10:22 pm

:mrgreen:

ok i figured it out - but i make one mistake and i do not know what i do wrong:

my audio stream now plays near "perfect" only doubled fast :) ( mikey mouse ) and backward :P

i use for the test ( without header ) raw audio data 44.1 khz, signed 16bit and read it as LSB

what i do wrong?

best wishes
rudi ;-)
Last edited by rudi ;-) on Fri Feb 09, 2018 2:54 am, edited 1 time in total.
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: which format as audio src for A2dp source example is supported?

Postby rudi ;-) » Fri Feb 09, 2018 12:30 am

:mrgreen:
i used now a half speed source ( 16Bit signed RAW 44.1 )
i did change the original to half speed and exported it as 16 bit signed
and this is playing with A2dp source now nice. no mickey mouse.

so my question is:
what we must set for the right speed for the SBC encoder?
or how must be the format for the source?
Last edited by rudi ;-) on Fri Feb 09, 2018 2:53 am, edited 1 time in total.
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: which format as audio src for A2dp source example is supported?

Postby rudi ;-) » Fri Feb 09, 2018 2:47 am

:mrgreen:

solved and done!

..now i try to use sd card cause this snipets on headers are wiry.
after this i wil try i2s as source and mems mic / line in.

why it was run 2x speed:
i used in my last test now
PCM 16Bit Stereo 44.1 RAW
with this the speed is ok.

thanks for helps ;)

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: [one part solved] which format as audio src for A2dp source example is supported?

Postby rudi ;-) » Fri Feb 09, 2018 3:13 am

if i did right understand,
we allways need as src for the SBC encoder
16Bit 2channel signed RAW packets.
so if we have example mp3 as source, we must allways first ( can be on the fly by fifo ..)
decode this to 16Bit 2channel signed RAW packets?

is there an option to set this at SBC encoder as input and the SBC decode this byself?
example can we use more different source formats then? or must we allways do this by self first?
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: [one part solved] which format as audio src for A2dp source example is supported?

Postby WiFive » Fri Feb 09, 2018 4:05 am

Where are the Lyra demos?

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: [one part solved] which format as audio src for A2dp source example is supported?

Postby rudi ;-) » Fri Feb 09, 2018 4:19 am

WiFive wrote:Where are the Lyra demos?
only on spi flash as .bin just in time
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: [one part solved] which format as audio src for A2dp source example is supported?

Postby rudi ;-) » Tue Feb 20, 2018 2:06 pm

WiFive wrote:Where are the Lyra demos?
ESP32-LyraTD-MSC Audio Mic HDK Demo with Baidu DuerOS
Microsemi ZL38063 Documentation & Tools
microsemi_tools_datasheet_cnxlinux.jpg
microsemi_tools_datasheet_cnxlinux.jpg (113.83 KiB) Viewed 14033 times
hope this helps in the meantime
wishes
rudi ;-)

fyi: sry i got this documents and tools not - microsemi did not response since 8 weeks :cry:
( i gived up this theme. final i will visit microsemi on eMbeddedWorld2018 too and ask them personaly for the "Why not"
also i will told them that i will not use they DSP in my future design cause they do not response to us developers
)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

gtalusan
Posts: 3
Joined: Sun Mar 18, 2018 6:58 pm

Re: [one part solved] which format as audio src for A2dp source example is supported?

Postby gtalusan » Sun Mar 18, 2018 11:49 pm

I got A2DP source working with raw 44.1kHz PCM data streaming to a fidget spinner :D

https://www.youtube.com/watch?v=qr1t3I-Gxk0

mingshi
Posts: 2
Joined: Fri Mar 09, 2018 4:42 pm

Re: [one part solved] which format as audio src for A2dp source example is supported?

Postby mingshi » Fri Mar 30, 2018 9:42 am

Hi, rudi, I am now doing a project about a2dp, I use a microphone to collect the voice and tranmist to the a2dp sink, I use the code below, but can't get a good result , it is said in the log : limiting frames to be sent. So what should I do to transform the voltage value into the right format of a2dp?

Code: Select all

static int32_t bt_app_a2d_data_cb(uint8_t *data, int32_t len)
{
    if (len < 0 || data == NULL) {
        return 0;
    }
	
	// generate random sequence
	//ADC, ADC1_CHANNEL_5 is GPIO33, 12bits, 0db->full 1.1V
	adc1_config_width(ADC_WIDTH_12Bit);
	adc1_config_channel_atten(ADC1_CHANNEL_5,ADC_ATTEN_0db);   
    // int val = rand() % (1 << 16);
    for (int i = 0; i < (len >> 1); i++) {
		int val = adc1_get_voltage(ADC1_CHANNEL_5);
		val = val % (1 << 16);
		data[(i << 1)] = val & 0xff;
        data[(i << 1) + 1] = (val >> 8) & 0xff;
    }

    return len;
}

Who is online

Users browsing this forum: Baidu [Spider] and 112 guests